diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index d077a33e46..3d05948dff 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -1541,7 +1541,7 @@ fn get_connector_data_with_routing_decision( let routing_decision = routing_helpers::RoutingDecisionData::get_debit_routing_decision_data( card_network, - debit_routing_output, + Some(debit_routing_output), ); return Ok((data, Some(routing_decision))); } diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs index 7b63b27537..a4d1cc5151 100644 --- a/crates/router/src/core/payments/retry.rs +++ b/crates/router/src/core/payments/retry.rs @@ -16,6 +16,7 @@ use crate::{ flows::{ConstructFlowSpecificData, Feature}, operations, }, + routing::helpers as routing_helpers, }, db::StorageInterface, routes::{ @@ -109,6 +110,7 @@ where frm_suggestion, business_profile, false, //should_retry_with_pan is not applicable for step-up + None, ) .await?; } @@ -155,11 +157,20 @@ where .unwrap_or(false) && business_profile.is_clear_pan_retries_enabled; - let connector = if should_retry_with_pan { + let (connector, routing_decision) = if should_retry_with_pan { // If should_retry_with_pan is true, it indicates that we are retrying with PAN using the same connector. - original_connector_data.clone() + (original_connector_data.clone(), None) } else { - super::get_connector_data(&mut connector_routing_data)?.connector_data + let connector_routing_data = + super::get_connector_data(&mut connector_routing_data)?; + let routing_decision = connector_routing_data.network.map(|card_network| { + routing_helpers::RoutingDecisionData::get_debit_routing_decision_data( + card_network, + None, + ) + }); + + (connector_routing_data.connector_data, routing_decision) }; router_data = do_retry( @@ -178,6 +189,7 @@ where frm_suggestion, business_profile, should_retry_with_pan, + routing_decision, ) .await?; @@ -329,6 +341,7 @@ pub async fn do_retry( frm_suggestion: Option, business_profile: &domain::Profile, should_retry_with_pan: bool, + routing_decision: Option, ) -> RouterResult> where F: Clone + Send + Sync, @@ -372,7 +385,7 @@ where business_profile, true, should_retry_with_pan, - None, + routing_decision, None, ) .await?; diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs index 12e6923a4f..c342f11d55 100644 --- a/crates/router/src/core/routing/helpers.rs +++ b/crates/router/src/core/routing/helpers.rs @@ -330,7 +330,7 @@ pub enum RoutingDecisionData { #[cfg(feature = "v1")] pub struct DebitRoutingDecisionData { pub card_network: common_enums::enums::CardNetwork, - pub debit_routing_result: open_router::DebitRoutingOutput, + pub debit_routing_result: Option, } #[cfg(feature = "v1")] impl RoutingDecisionData { @@ -350,7 +350,7 @@ impl RoutingDecisionData { pub fn get_debit_routing_decision_data( network: common_enums::enums::CardNetwork, - debit_routing_result: open_router::DebitRoutingOutput, + debit_routing_result: Option, ) -> Self { Self::DebitRouting(DebitRoutingDecisionData { card_network: network, @@ -370,7 +370,9 @@ impl DebitRoutingDecisionData { + Clone, { payment_data.set_card_network(self.card_network.clone()); - payment_data.set_co_badged_card_data(&self.debit_routing_result); + self.debit_routing_result + .as_ref() + .map(|data| payment_data.set_co_badged_card_data(data)); } } #[derive(Clone, Debug)]