feat(connector): [Mollie] Implement Przelewy24 and BancontactCard Bank Redirects for Mollie connector (#1303)

Co-authored-by: Jagan Elavarasan <jaganelavarasan@gmail.com>
This commit is contained in:
Swangi Kumari
2023-07-01 15:27:33 +05:30
committed by GitHub
parent 2f9c28938f
commit f091be60cc
3 changed files with 90 additions and 12 deletions

View File

@ -1,4 +1,5 @@
use api_models::payments;
use common_utils::pii::Email;
use error_stack::IntoReport;
use masking::Secret;
use serde::{Deserialize, Serialize};
@ -46,6 +47,8 @@ pub enum PaymentMethodData {
Ideal(Box<IdealMethodData>),
Paypal(Box<PaypalMethodData>),
Sofort,
Przelewy24(Box<Przelewy24MethodData>),
Bancontact,
DirectDebit(Box<DirectDebitMethodData>),
}
@ -68,6 +71,12 @@ pub struct PaypalMethodData {
shipping_address: Option<Address>,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Przelewy24MethodData {
billing_email: Option<Email>,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DirectDebitMethodData {
@ -159,6 +168,12 @@ impl TryFrom<&api_models::payments::BankRedirectData> for PaymentMethodData {
})))
}
api_models::payments::BankRedirectData::Sofort { .. } => Ok(Self::Sofort),
api_models::payments::BankRedirectData::Przelewy24 {
billing_details, ..
} => Ok(Self::Przelewy24(Box::new(Przelewy24MethodData {
billing_email: billing_details.email.clone(),
}))),
api_models::payments::BankRedirectData::BancontactCard { .. } => Ok(Self::Bancontact),
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}