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

feat(connector): [Mollie] Implement Sepa Direct Debit (#1301)

Swangi Kumarib4b6440a9135
diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs
index a3e2e91111..c8e6dad6db 100644
--- a/crates/router/src/connector/mollie/transformers.rs
+++ b/crates/router/src/connector/mollie/transformers.rs
@@ -46,6 +46,7 @@ pub enum PaymentMethodData {
Ideal(Box<IdealMethodData>),
Paypal(Box<PaypalMethodData>),
Sofort,
+ DirectDebit(Box<DirectDebitMethodData>),
}
#[derive(Debug, Serialize)]
@@ -67,6 +68,13 @@ pub struct PaypalMethodData {
shipping_address: Option<Address>,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct DirectDebitMethodData {
+ consumer_name: Option<Secret<String>>,
+ consumer_account: Secret<String>,
+}
+
#[derive(Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum SequenceType {
@@ -103,6 +111,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for MolliePaymentsRequest {
api_models::payments::PaymentMethodData::Wallet(ref wallet_data) => {
get_payment_method_for_wallet(item, wallet_data)
}
+ api_models::payments::PaymentMethodData::BankDebit(ref directdebit_data) => {
+ PaymentMethodData::try_from(directdebit_data)
+ }
_ => Err(errors::ConnectorError::NotImplemented(
"Payment Method".to_string(),
))
@@ -153,6 +164,23 @@ impl TryFrom<&api_models::payments::BankRedirectData> for PaymentMethodData {
}
}
+impl TryFrom<&api_models::payments::BankDebitData> for PaymentMethodData {
+ type Error = Error;
+ fn try_from(value: &api_models::payments::BankDebitData) -> Result<Self, Self::Error> {
+ match value {
+ api_models::payments::BankDebitData::SepaBankDebit {
+ bank_account_holder_name,
+ iban,
+ ..
+ } => Ok(Self::DirectDebit(Box::new(DirectDebitMethodData {
+ consumer_name: bank_account_holder_name.clone(),
+ consumer_account: iban.clone(),
+ }))),
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
fn get_payment_method_for_wallet(
item: &types::PaymentsAuthorizeRouterData,
wallet_data: &api_models::payments::WalletData,