Feat(Connector): [ACI] Implement Przelewy24 Bank Redirect (#1064)

This commit is contained in:
Sakil Mostak
2023-05-10 20:43:35 +05:30
committed by GitHub
parent e833a1ddee
commit cef8914372
2 changed files with 25 additions and 1 deletions

View File

@ -646,7 +646,10 @@ pub enum BankRedirectData {
// Issuer value corresponds to the bank
issuer: api_enums::BankNames,
},
Przelewy24 {},
Przelewy24 {
// Shopper Email
email: Email,
},
Sofort {
/// The billing details for bank redirection
billing_details: BankRedirectBilling,

View File

@ -1,5 +1,6 @@
use std::str::FromStr;
use common_utils::pii::Email;
use error_stack::report;
use masking::Secret;
use reqwest::Url;
@ -73,6 +74,8 @@ pub struct BankRedirectionPMData {
bank_account_bic: Option<Secret<String>>,
#[serde(rename = "bankAccount.iban")]
bank_account_iban: Option<Secret<String>>,
#[serde(rename = "customer.email")]
customer_email: Option<Email>,
shopper_result_url: Option<String>,
}
@ -83,6 +86,9 @@ pub enum PaymentBrand {
Ideal,
Giropay,
Sofortueberweisung,
InteracOnline,
Przelewy,
Trustly,
}
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
@ -145,6 +151,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
bank_account_bank_name: None,
bank_account_bic: None,
bank_account_iban: None,
customer_email: None,
shopper_result_url: item.request.router_return_url.clone(),
}))
}
@ -158,6 +165,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
bank_account_bank_name: None,
bank_account_bic: bank_account_bic.clone(),
bank_account_iban: bank_account_iban.clone(),
customer_email: None,
shopper_result_url: item.request.router_return_url.clone(),
})),
api_models::payments::BankRedirectData::Ideal { bank_name, .. } => {
@ -167,6 +175,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
bank_account_bank_name: Some(bank_name.to_string()),
bank_account_bic: None,
bank_account_iban: None,
customer_email: None,
shopper_result_url: item.request.router_return_url.clone(),
}))
}
@ -177,6 +186,18 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
bank_account_bank_name: None,
bank_account_bic: None,
bank_account_iban: None,
customer_email: None,
shopper_result_url: item.request.router_return_url.clone(),
}))
}
api_models::payments::BankRedirectData::Przelewy24 { email } => {
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
payment_brand: PaymentBrand::Przelewy,
bank_account_country: None,
bank_account_bank_name: None,
bank_account_bic: None,
bank_account_iban: None,
customer_email: Some(email.to_owned()),
shopper_result_url: item.request.router_return_url.clone(),
}))
}