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

fix(routing): update_gateway_score_condition (#9452)

Ankit Kumar Gupta31f1cd77c2f8
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 533e654c6c..529bb649cc 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -9487,9 +9487,8 @@ impl RoutingApproach {
pub fn from_decision_engine_approach(approach: &str) -> Self {
match approach {
"SR_SELECTION_V3_ROUTING" => Self::SuccessRateExploitation,
- "SR_V3_HEDGING" => Self::SuccessRateExploration,
+ "SR_V3_HEDGING" | "DEFAULT" => Self::SuccessRateExploration,
"NTW_BASED_ROUTING" => Self::DebitRouting,
- "DEFAULT" => Self::StraightThroughRouting,
_ => Self::DefaultFallback,
}
}
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index adadbee102..7b996e586b 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -2268,8 +2268,13 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
async move {
let should_route_to_open_router =
state.conf.open_router.dynamic_routing_enabled;
+ let is_success_rate_based = matches!(
+ payment_attempt.routing_approach,
+ Some(enums::RoutingApproach::SuccessRateExploitation)
+ | Some(enums::RoutingApproach::SuccessRateExploration)
+ );
- if should_route_to_open_router {
+ if should_route_to_open_router && is_success_rate_based {
routing_helpers::update_gateway_score_helper_with_open_router(
&state,
&payment_attempt,