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), BankRedirect(Box), - #[serde(rename = "bank")] - Wallet, + Wallet(Box), Klarna, } @@ -84,6 +83,15 @@ pub struct BankRedirectionPMData { shopper_result_url: Option, } +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct WalletPMData { + payment_brand: PaymentBrand, + #[serde(rename = "virtualAccount.accountId")] + account_id: Option>, + shopper_result_url: Option, +} + #[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 { .. } => {