From e29a121bfd10f00486dfa33e9d8cbd18ecc625eb Mon Sep 17 00:00:00 2001 From: Debarati Ghatak <88573135+dgeee13@users.noreply.github.com> Date: Fri, 19 Sep 2025 17:58:58 +0530 Subject: [PATCH] fix(connector): [CYBERSOURCE] Pass transaction type for only wallet MITs (#9444) Co-authored-by: Debarati Ghatak --- .../src/connectors/cybersource/transformers.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs index b7d175b648..cbd97ccf84 100644 --- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs +++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs @@ -575,7 +575,8 @@ pub struct MandateCard { #[serde(rename_all = "camelCase")] pub struct MandatePaymentInformation { payment_instrument: CybersoucrePaymentInstrument, - tokenized_card: MandatePaymentTokenizedCard, + #[serde(skip_serializing_if = "Option::is_none")] + tokenized_card: Option, card: Option, } @@ -2584,6 +2585,15 @@ impl TryFrom<(&CybersourceRouterData<&PaymentsAuthorizeRouterData>, String)> _ => None, }; + let tokenized_card = match item.router_data.request.payment_method_type { + Some(enums::PaymentMethodType::GooglePay) + | Some(enums::PaymentMethodType::ApplePay) + | Some(enums::PaymentMethodType::SamsungPay) => Some(MandatePaymentTokenizedCard { + transaction_type: TransactionType::StoredCredentials, + }), + _ => None, + }; + let bill_to = item .router_data .get_optional_billing_email() @@ -2593,9 +2603,7 @@ impl TryFrom<(&CybersourceRouterData<&PaymentsAuthorizeRouterData>, String)> let payment_information = PaymentInformation::MandatePayment(Box::new(MandatePaymentInformation { payment_instrument, - tokenized_card: MandatePaymentTokenizedCard { - transaction_type: TransactionType::StoredCredentials, - }, + tokenized_card, card: mandate_card_information, })); let client_reference_information = ClientReferenceInformation::from(item);