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): fix routing routes to deserialise correctly (#5724)

Amisha Prabhat346d2d7ad647
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 267a3d55ce..d5a3a96d15 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -428,18 +428,15 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- algorithm_id: routing_types::RoutingAlgorithmId,
+ algorithm_id: String,
) -> RouterResponse<routing_types::MerchantRoutingAlgorithm> {
metrics::ROUTING_RETRIEVE_CONFIG.add(&metrics::CONTEXT, 1, &[]);
let db = state.store.as_ref();
let key_manager_state = &(&state).into();
- let routing_algorithm = RoutingAlgorithmUpdate::fetch_routing_algo(
- merchant_account.get_id(),
- &algorithm_id.routing_algorithm_id,
- db,
- )
- .await?;
+ let routing_algorithm =
+ RoutingAlgorithmUpdate::fetch_routing_algo(merchant_account.get_id(), &algorithm_id, db)
+ .await?;
core_utils::validate_and_get_business_profile(
db,
key_manager_state,
@@ -464,7 +461,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id(
state: SessionState,
merchant_account: domain::MerchantAccount,
key_store: domain::MerchantKeyStore,
- algorithm_id: routing_types::RoutingAlgorithmId,
+ algorithm_id: String,
) -> RouterResponse<routing_types::MerchantRoutingAlgorithm> {
metrics::ROUTING_RETRIEVE_CONFIG.add(&metrics::CONTEXT, 1, &[]);
let db = state.store.as_ref();
@@ -472,7 +469,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id(
let routing_algorithm = db
.find_routing_algorithm_by_algorithm_id_merchant_id(
- &algorithm_id.routing_algorithm_id,
+ &algorithm_id,
merchant_account.get_id(),
)
.await
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 61d89e5e77..ecce0f9619 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -60,7 +60,7 @@ pub async fn routing_create_config(
pub async fn routing_link_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<routing_types::RoutingAlgorithmId>,
+ path: web::Path<String>,
transaction_type: &enums::TransactionType,
) -> impl Responder {
let flow = Flow::RoutingLinkConfig;
@@ -74,7 +74,7 @@ pub async fn routing_link_config(
state,
auth.merchant_account,
auth.key_store,
- algorithm.routing_algorithm_id,
+ algorithm,
transaction_type,
)
},
@@ -139,7 +139,7 @@ pub async fn routing_link_config(
pub async fn routing_retrieve_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<routing_types::RoutingAlgorithmId>,
+ path: web::Path<String>,
) -> impl Responder {
let algorithm_id = path.into_inner();
let flow = Flow::RoutingRetrieveConfig;