From be78dfc04eff671fb0b4e6037c84aee8ab367e70 Mon Sep 17 00:00:00 2001 From: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com> Date: Mon, 22 Jul 2024 22:33:57 +0530 Subject: [PATCH] fix(router): store `network_transaction_id` in stripe `authorize` flow (#5399) --- crates/router/src/connector/stripe/transformers.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs index 786f4a060b..90ddc9f0b9 100644 --- a/crates/router/src/connector/stripe/transformers.rs +++ b/crates/router/src/connector/stripe/transformers.rs @@ -2389,7 +2389,18 @@ impl //Note: we might have to call retrieve_setup_intent to get the network_transaction_id in case its not sent in PaymentIntentResponse // Or we identify the mandate txns before hand and always call SetupIntent in case of mandate payment call - let network_txn_id = Option::foreign_from(item.response.latest_attempt); + let network_txn_id = match item.response.latest_charge.as_ref() { + Some(StripeChargeEnum::ChargeObject(charge_object)) => charge_object + .payment_method_details + .as_ref() + .and_then(|payment_method_details| match payment_method_details { + StripePaymentMethodDetailsResponse::Card { card } => { + card.network_transaction_id.clone() + } + _ => None, + }), + _ => None, + }; let connector_metadata = get_connector_metadata(item.response.next_action.as_ref(), item.response.amount)?;