mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
feat(connector): [Mollie] Implement Sepa Direct Debit (#1301)
This commit is contained in:
@ -46,6 +46,7 @@ pub enum PaymentMethodData {
|
|||||||
Ideal(Box<IdealMethodData>),
|
Ideal(Box<IdealMethodData>),
|
||||||
Paypal(Box<PaypalMethodData>),
|
Paypal(Box<PaypalMethodData>),
|
||||||
Sofort,
|
Sofort,
|
||||||
|
DirectDebit(Box<DirectDebitMethodData>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
@ -67,6 +68,13 @@ pub struct PaypalMethodData {
|
|||||||
shipping_address: Option<Address>,
|
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)]
|
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum SequenceType {
|
pub enum SequenceType {
|
||||||
@ -103,6 +111,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for MolliePaymentsRequest {
|
|||||||
api_models::payments::PaymentMethodData::Wallet(ref wallet_data) => {
|
api_models::payments::PaymentMethodData::Wallet(ref wallet_data) => {
|
||||||
get_payment_method_for_wallet(item, 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(
|
_ => Err(errors::ConnectorError::NotImplemented(
|
||||||
"Payment Method".to_string(),
|
"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(
|
fn get_payment_method_for_wallet(
|
||||||
item: &types::PaymentsAuthorizeRouterData,
|
item: &types::PaymentsAuthorizeRouterData,
|
||||||
wallet_data: &api_models::payments::WalletData,
|
wallet_data: &api_models::payments::WalletData,
|
||||||
|
|||||||
Reference in New Issue
Block a user