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

refactor(fix): [Mollie] Add support for both HeaderKey and BodyKey AuthType (#1761)

Swangi Kumari07c60f8abf32
diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs
index a8ff89250c..ca10225a0e 100644
--- a/crates/router/src/connector/mollie/transformers.rs
+++ b/crates/router/src/connector/mollie/transformers.rs
@@ -253,7 +253,9 @@ impl TryFrom<&types::TokenizationRouterData> for MollieCardTokenRequest {
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "test_mode",
})?;
- let profile_token = auth.key1;
+ let profile_token = auth
+ .profile_token
+ .ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(Self {
card_holder,
card_number,
@@ -434,19 +436,22 @@ pub struct BankDetails {
pub struct MollieAuthType {
pub(super) api_key: Secret<String>,
- pub(super) key1: Secret<String>,
+ pub(super) profile_token: Option<Secret<String>>,
}
impl TryFrom<&types::ConnectorAuthType> for MollieAuthType {
type Error = Error;
fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
- if let types::ConnectorAuthType::BodyKey { api_key, key1 } = auth_type {
- Ok(Self {
+ match auth_type {
+ types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
api_key: Secret::new(api_key.to_owned()),
- key1: Secret::new(key1.to_owned()),
- })
- } else {
- Err(errors::ConnectorError::FailedToObtainAuthType.into())
+ profile_token: None,
+ }),
+ types::ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
+ api_key: Secret::new(api_key.to_owned()),
+ profile_token: Some(Secret::new(key1.to_owned())),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType)?,
}
}
}