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): [ACI] Implement Alipay and MB WAY Wallets (#1140)

Sakil Mostakd7cfb4a17908
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index 760dfa3809..e09010e88e 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -57,8 +57,7 @@ pub enum PaymentDetails {
#[serde(rename = "card")]
AciCard(Box<CardDetails>),
BankRedirect(Box<BankRedirectionPMData>),
- #[serde(rename = "bank")]
- Wallet,
+ Wallet(Box<WalletPMData>),
Klarna,
}
@@ -84,6 +83,15 @@ pub struct BankRedirectionPMData {
shopper_result_url: Option<String>,
}
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WalletPMData {
+ payment_brand: PaymentBrand,
+ #[serde(rename = "virtualAccount.accountId")]
+ account_id: Option<Secret<String>>,
+ shopper_result_url: Option<String>,
+}
+
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum PaymentBrand {
@@ -94,6 +102,9 @@ pub enum PaymentBrand {
InteracOnline,
Przelewy,
Trustly,
+ Mbway,
+ #[serde(rename = "ALIPAY")]
+ AliPay,
}
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
@@ -146,7 +157,25 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
card_cvv: ccard.card_cvc,
})),
api::PaymentMethodData::PayLater(_) => PaymentDetails::Klarna,
- api::PaymentMethodData::Wallet(_) => PaymentDetails::Wallet,
+ api::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
+ api_models::payments::WalletData::MbWay(data) => {
+ PaymentDetails::Wallet(Box::new(WalletPMData {
+ payment_brand: PaymentBrand::Mbway,
+ account_id: Some(data.telephone_number.clone()),
+ shopper_result_url: item.request.router_return_url.clone(),
+ }))
+ }
+ api_models::payments::WalletData::AliPay { .. } => {
+ PaymentDetails::Wallet(Box::new(WalletPMData {
+ payment_brand: PaymentBrand::AliPay,
+ account_id: None,
+ shopper_result_url: item.request.router_return_url.clone(),
+ }))
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Payment method".to_string(),
+ ))?,
+ },
api::PaymentMethodData::BankRedirect(ref redirect_banking_data) => {
match redirect_banking_data {
api_models::payments::BankRedirectData::Eps { .. } => {