Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

911 B
Raw Blame
use hyperswitch_domain_models::router_data::ConnectorAuthType;
use hyperswitch_interfaces::errors;

/// Ecommpay Gate API v2 credentials.
/// `api_key` = project secret key (HMAC-SHA512 signing key, never transmitted)
/// `key1`    = project id (`general.project_id`)
pub struct EcommpayAuthType {
    pub secret_key: hyperswitch_masking::Secret<String>,
    pub project_id: hyperswitch_masking::Secret<String>,
}

impl TryFrom<&ConnectorAuthType> for EcommpayAuthType {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
        match auth_type {
            ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
                secret_key: api_key.to_owned(),
                project_id: key1.to_owned(),
            }),
            _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
        }
    }
}