Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,10 @@ pub enum BankRedirectData {
// Issuer value corresponds to the bank
issuer: api_enums::BankNames,
},
Przelewy24 {},
Przelewy24 {
// Shopper Email
email: Option<Email>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove option for the email as earlier we don't know what could be the data needed for this payment method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done👍

},
Sofort {
/// The billing details for bank redirection
billing_details: BankRedirectBilling,
Expand Down
21 changes: 21 additions & 0 deletions crates/router/src/connector/aci/transformers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::str::FromStr;

use common_utils::pii::Email;
use error_stack::report;
use masking::Secret;
use reqwest::Url;
Expand Down Expand Up @@ -72,6 +73,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>,
}

Expand All @@ -82,6 +85,9 @@ pub enum PaymentBrand {
Ideal,
Giropay,
Sofortueberweisung,
InteracOnline,
Przelewy,
Trustly,
}

#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
Expand Down Expand Up @@ -144,6 +150,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(),
}))
}
Expand All @@ -157,6 +164,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, .. } => {
Expand All @@ -166,6 +174,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(),
}))
}
Expand All @@ -176,6 +185,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: email.clone(),
shopper_result_url: item.request.router_return_url.clone(),
}))
}
Expand Down