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): [BOA] Implement apple pay manual flow (#3191)

DEEPANSHU BANSAL25fd3d502e48
diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs
index deca1dc674..2c91166fd5 100644
--- a/crates/router/src/connector/bankofamerica/transformers.rs
+++ b/crates/router/src/connector/bankofamerica/transformers.rs
@@ -111,6 +111,19 @@ pub struct GooglePayPaymentInformation {
fluid_data: FluidData,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplePayTokenizedCard {
+ transaction_type: TransactionType,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplePayTokenPaymentInformation {
+ fluid_data: FluidData,
+ tokenized_card: ApplePayTokenizedCard,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ApplePayPaymentInformation {
@@ -123,6 +136,7 @@ pub enum PaymentInformation {
Cards(CardPaymentInformation),
GooglePay(GooglePayPaymentInformation),
ApplePay(ApplePayPaymentInformation),
+ ApplePayToken(ApplePayTokenPaymentInformation),
}
#[derive(Debug, Serialize)]
@@ -434,14 +448,42 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>>
match item.router_data.request.payment_method_data.clone() {
payments::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
payments::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- payments::WalletData::ApplePay(_) => {
- let payment_method_token = item.router_data.get_payment_method_token()?;
- match payment_method_token {
- types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => {
- Self::try_from((item, decrypt_data))
- }
- types::PaymentMethodToken::Token(_) => {
- Err(errors::ConnectorError::InvalidWalletToken)?
+ payments::WalletData::ApplePay(apple_pay_data) => {
+ match item.router_data.payment_method_token.clone() {
+ Some(payment_method_token) => match payment_method_token {
+ types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => {
+ Self::try_from((item, decrypt_data))
+ }
+ types::PaymentMethodToken::Token(_) => {
+ Err(errors::ConnectorError::InvalidWalletToken)?
+ }
+ },
+ None => {
+ let email = item.router_data.request.get_email()?;
+ let bill_to = build_bill_to(item.router_data.get_billing()?, email)?;
+ let order_information = OrderInformationWithBill::from((item, bill_to));
+ let processing_information = ProcessingInformation::from((
+ item,
+ Some(PaymentSolution::ApplePay),
+ ));
+ let client_reference_information =
+ ClientReferenceInformation::from(item);
+ let payment_information = PaymentInformation::ApplePayToken(
+ ApplePayTokenPaymentInformation {
+ fluid_data: FluidData {
+ value: Secret::from(apple_pay_data.payment_data),
+ },
+ tokenized_card: ApplePayTokenizedCard {
+ transaction_type: TransactionType::ApplePay,
+ },
+ },
+ );
+ Ok(Self {
+ processing_information,
+ payment_information,
+ order_information,
+ client_reference_information,
+ })
}
}
}