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): skip Decision Engine evaluation when the profile has no active routing algorithm (#13702)

Prajjwal Kumare9e7bee2352e
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index 5fb761dddb..ca608125cb 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -1614,8 +1614,29 @@ pub async fn perform_hybrid_routing_if_enabled(
utils::get_routing_result_source(state, dimensions).await,
api_models::routing::RoutingResultSource::DecisionEngine
);
+ let has_active_routing_algorithm = business_profile
+ .routing_algorithm
+ .clone()
+ .and_then(|ra| {
+ ra.parse_value::<api::routing::RoutingAlgorithmRef>("RoutingAlgorithmRef")
+ .ok()
+ })
+ .and_then(|algorithm_ref| algorithm_ref.algorithm_id)
+ .is_some();
+
+ if !has_active_routing_algorithm {
+ logger::debug!(
+ business_profile_id=?business_profile.get_id(),
+ "decision_engine_euclid: no active routing algorithm, skipping DE evaluation"
+ );
+ logger::info!(
+ business_profile_id=?business_profile.get_id(),
+ routing_source = "hyperswitch_static",
+ "decision_engine_euclid: selected routing source after hybrid stage"
+ );
- if is_decision_engine_cutover_enabled {
+ (static_connectors.to_vec(), static_approach)
+ } else if is_decision_engine_cutover_enabled {
let hybrid_stage_outcome = stage
.route(input)
.await