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
refactor(debit_routing): Handle missing merchant_business_country by defaulting to US (#8141)
Shankar Singh C1acf525a4681
diff --git a/crates/router/src/core/debit_routing.rs b/crates/router/src/core/debit_routing.rsindex 5824946c3e..adbd663c5c 100644--- a/crates/router/src/core/debit_routing.rs+++ b/crates/router/src/core/debit_routing.rs@@ -49,10 +49,17 @@ wherelet debit_routing_config = state.conf.debit_routing_config.clone();let debit_routing_supported_connectors = debit_routing_config.supported_connectors.clone();- if let Some((call_connector_type, acquirer_country)) = connector- .clone()- .zip(business_profile.merchant_business_country)- {+ // If the business profile does not have a country set, we cannot perform debit routing,+ // because the merchant_business_country will be treated as the acquirer_country,+ // which is used to determine whether a transaction is local or global in the open router.+ // For now, since debit routing is only implemented for USD, we can safely assume the+ // acquirer_country is US if not provided by the merchant.++ let acquirer_country = business_profile+ .merchant_business_country+ .unwrap_or_default();++ if let Some(call_connector_type) = connector.clone() {debit_routing_output = match call_connector_type {ConnectorCallType::PreDetermined(connector_data) => {logger::info!("Performing debit routing for PreDetermined connector");@@ -115,10 +122,7 @@ whereF: Send + Clone,D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,{- if business_profile.is_debit_routing_enabled- && state.conf.open_router.enabled- && business_profile.merchant_business_country.is_some()- {+ if business_profile.is_debit_routing_enabled && state.conf.open_router.enabled {logger::info!("Debit routing is enabled for the profile");let debit_routing_config = &state.conf.debit_routing_config;