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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(routing): sync rule deactivation to DE for non-cutover profiles (#14043)
Ankit Kumar Guptaddf21bbde67e
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rsindex e5497b7c9c..132b1f138a 100644--- a/crates/router/src/core/routing.rs+++ b/crates/router/src/core/routing.rs@@ -1895,6 +1895,12 @@ pub async fn unlink_routing_config().await.to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;++ let decision_engine_rule_id = record+ .decision_engine_routing_id+ .clone()+ .unwrap_or_else(|| algorithm_id.get_string_repr().to_string());+let response = record.foreign_into();helpers::update_profile_active_algorithm_ref(db,@@ -1921,6 +1927,28 @@ pub async fn unlink_routing_config().await?;+ if state.conf.open_router.static_routing_enabled+ && transaction_type != enums::TransactionType::ThreeDsAuthentication+ {+ if let Err(error) = deactivate_de_euclid_routing_algorithm(+ &state,+ DeactivateRoutingConfigRequest {+ created_by: profile_id.get_string_repr().to_string(),+ routing_algorithm_id: decision_engine_rule_id,+ },+ )+ .await+ {+ router_env::logger::error!(+ decision_engine_error = ?error,+ routing_flow = ?"unlink_routing_algorithm",+ profile_id = ?profile_id.get_string_repr(),+ algorithm_id = ?algorithm_id.get_string_repr(),+ "decision_engine_euclid: rule deactivation failed on the Decision Engine for a Hyperswitch-routed profile"+ );+ }+ }+metrics::ROUTING_UNLINK_CONFIG_SUCCESS_RESPONSE.add(1, &[]);Ok(service_api::ApplicationResponse::Json(response))}