From e939db2fad6fd4acd8575d44de89860e50584925 Mon Sep 17 00:00:00 2001 From: Amisha Prabhat <55580080+Aprabhat19@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:34:29 +0530 Subject: [PATCH] feat(routing): add domain type for Routing id (#5733) Co-authored-by: Sanchith Hegde Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> --- crates/api_models/src/routing.rs | 13 +++++--- crates/common_utils/src/id_type.rs | 2 ++ crates/common_utils/src/id_type/routing.rs | 21 +++++++++++++ crates/common_utils/src/lib.rs | 6 ++++ crates/diesel_models/src/business_profile.rs | 12 +++---- .../src/query/routing_algorithm.rs | 14 ++++----- crates/diesel_models/src/routing_algorithm.rs | 13 ++++---- .../src/business_profile.rs | 8 ++--- crates/router/src/core/admin.rs | 4 +-- crates/router/src/core/payments/routing.rs | 8 ++--- crates/router/src/core/routing.rs | 31 +++++++------------ crates/router/src/db/kafka_store.rs | 6 ++-- crates/router/src/db/routing_algorithm.rs | 18 +++++------ crates/router/src/routes/routing.rs | 4 +-- 14 files changed, 93 insertions(+), 67 deletions(-) create mode 100644 crates/common_utils/src/id_type/routing.rs diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index f9bcf3901b99..1416e9855234 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -89,7 +89,8 @@ pub enum LinkedRoutingConfigRetrieveResponse { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] /// Routing Algorithm specific to merchants pub struct MerchantRoutingAlgorithm { - pub id: String, + #[schema(value_type = String)] + pub id: common_utils::id_type::RoutingId, #[schema(value_type = String)] pub profile_id: common_utils::id_type::ProfileId, pub name: String, @@ -422,14 +423,14 @@ impl RoutingAlgorithm { #[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)] pub struct RoutingAlgorithmRef { - pub algorithm_id: Option, + pub algorithm_id: Option, pub timestamp: i64, pub config_algo_id: Option, pub surcharge_config_algo_id: Option, } impl RoutingAlgorithmRef { - pub fn update_algorithm_id(&mut self, new_id: String) { + pub fn update_algorithm_id(&mut self, new_id: common_utils::id_type::RoutingId) { self.algorithm_id = Some(new_id); self.timestamp = common_utils::date_time::now_unix_timestamp(); } @@ -456,7 +457,8 @@ impl RoutingAlgorithmRef { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] pub struct RoutingDictionaryRecord { - pub id: String, + #[schema(value_type = String)] + pub id: common_utils::id_type::RoutingId, #[schema(value_type = String)] pub profile_id: common_utils::id_type::ProfileId, pub name: String, @@ -484,7 +486,8 @@ pub enum RoutingKind { #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)] pub struct RoutingAlgorithmId { - pub routing_algorithm_id: String, + #[schema(value_type = String)] + pub routing_algorithm_id: common_utils::id_type::RoutingId, } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs index b6de37fab4f5..5182c821d0f3 100644 --- a/crates/common_utils/src/id_type.rs +++ b/crates/common_utils/src/id_type.rs @@ -8,6 +8,7 @@ mod merchant; mod merchant_connector_account; mod organization; mod profile; +mod routing; mod global_id; @@ -23,6 +24,7 @@ pub use merchant::MerchantId; pub use merchant_connector_account::MerchantConnectorAccountId; pub use organization::OrganizationId; pub use profile::ProfileId; +pub use routing::RoutingId; use serde::{Deserialize, Serialize}; use thiserror::Error; diff --git a/crates/common_utils/src/id_type/routing.rs b/crates/common_utils/src/id_type/routing.rs new file mode 100644 index 000000000000..cb6597174a2d --- /dev/null +++ b/crates/common_utils/src/id_type/routing.rs @@ -0,0 +1,21 @@ +crate::id_type!( + RoutingId, + " A type for routing_id that can be used for routing ids" +); + +crate::impl_id_type_methods!(RoutingId, "routing_id"); + +// This is to display the `RoutingId` as RoutingId(abcd) +crate::impl_debug_id_type!(RoutingId); +crate::impl_try_from_cow_str_id_type!(RoutingId, "routing_id"); + +crate::impl_generate_id_id_type!(RoutingId, "routing"); +crate::impl_serializable_secret_id_type!(RoutingId); +crate::impl_queryable_id_type!(RoutingId); +crate::impl_to_sql_from_sql_id_type!(RoutingId); + +impl crate::events::ApiEventMetric for RoutingId { + fn get_api_event_type(&self) -> Option { + Some(crate::events::ApiEventsType::Routing) + } +} diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rs index f51ed6eab058..3bf3db11ba39 100644 --- a/crates/common_utils/src/lib.rs +++ b/crates/common_utils/src/lib.rs @@ -233,6 +233,12 @@ pub fn generate_profile_id_of_default_length() -> id_type::ProfileId { id_type::ProfileId::generate() } +/// Generate a routing id with default length, with prefix as `routing` +pub fn generate_routing_id_of_default_length() -> id_type::RoutingId { + use id_type::GenerateId; + + id_type::RoutingId::generate() +} /// Generate a merchant_connector_account id with default length, with prefix as `mca` pub fn generate_merchant_connector_account_id_of_default_length( ) -> id_type::MerchantConnectorAccountId { diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs index 5a4f4fa0b499..2096779262ee 100644 --- a/crates/diesel_models/src/business_profile.rs +++ b/crates/diesel_models/src/business_profile.rs @@ -269,11 +269,11 @@ pub struct BusinessProfile { pub outgoing_webhook_custom_http_headers: Option, pub always_collect_billing_details_from_wallet_connector: Option, pub always_collect_shipping_details_from_wallet_connector: Option, - pub routing_algorithm_id: Option, + pub routing_algorithm_id: Option, pub order_fulfillment_time: Option, pub order_fulfillment_time_origin: Option, pub frm_routing_algorithm_id: Option, - pub payout_routing_algorithm_id: Option, + pub payout_routing_algorithm_id: Option, pub default_fallback_routing: Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: Option, @@ -310,11 +310,11 @@ pub struct BusinessProfileNew { pub outgoing_webhook_custom_http_headers: Option, pub always_collect_billing_details_from_wallet_connector: Option, pub always_collect_shipping_details_from_wallet_connector: Option, - pub routing_algorithm_id: Option, + pub routing_algorithm_id: Option, pub order_fulfillment_time: Option, pub order_fulfillment_time_origin: Option, pub frm_routing_algorithm_id: Option, - pub payout_routing_algorithm_id: Option, + pub payout_routing_algorithm_id: Option, pub default_fallback_routing: Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: Option, @@ -348,11 +348,11 @@ pub struct BusinessProfileUpdateInternal { pub outgoing_webhook_custom_http_headers: Option, pub always_collect_billing_details_from_wallet_connector: Option, pub always_collect_shipping_details_from_wallet_connector: Option, - pub routing_algorithm_id: Option, + pub routing_algorithm_id: Option, pub order_fulfillment_time: Option, pub order_fulfillment_time_origin: Option, pub frm_routing_algorithm_id: Option, - pub payout_routing_algorithm_id: Option, + pub payout_routing_algorithm_id: Option, pub default_fallback_routing: Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: Option, diff --git a/crates/diesel_models/src/query/routing_algorithm.rs b/crates/diesel_models/src/query/routing_algorithm.rs index f0fc75430e8f..c4d56736aa2a 100644 --- a/crates/diesel_models/src/query/routing_algorithm.rs +++ b/crates/diesel_models/src/query/routing_algorithm.rs @@ -19,7 +19,7 @@ impl RoutingAlgorithm { pub async fn find_by_algorithm_id_merchant_id( conn: &PgPooledConn, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult { generics::generic_find_one::<::Table, _, _>( @@ -33,7 +33,7 @@ impl RoutingAlgorithm { pub async fn find_by_algorithm_id_profile_id( conn: &PgPooledConn, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, profile_id: &common_utils::id_type::ProfileId, ) -> StorageResult { generics::generic_find_one::<::Table, _, _>( @@ -47,7 +47,7 @@ impl RoutingAlgorithm { pub async fn find_metadata_by_algorithm_id_profile_id( conn: &PgPooledConn, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, profile_id: &common_utils::id_type::ProfileId, ) -> StorageResult { Self::table() @@ -69,7 +69,7 @@ impl RoutingAlgorithm { .limit(1) .load_async::<( common_utils::id_type::ProfileId, - String, + common_utils::id_type::RoutingId, String, Option, enums::RoutingAlgorithmKind, @@ -128,7 +128,7 @@ impl RoutingAlgorithm { .limit(limit) .offset(offset) .load_async::<( - String, + common_utils::id_type::RoutingId, common_utils::id_type::ProfileId, String, Option, @@ -189,7 +189,7 @@ impl RoutingAlgorithm { .order(dsl::modified_at.desc()) .load_async::<( common_utils::id_type::ProfileId, - String, + common_utils::id_type::RoutingId, String, Option, enums::RoutingAlgorithmKind, @@ -251,7 +251,7 @@ impl RoutingAlgorithm { .order(dsl::modified_at.desc()) .load_async::<( common_utils::id_type::ProfileId, - String, + common_utils::id_type::RoutingId, String, Option, enums::RoutingAlgorithmKind, diff --git a/crates/diesel_models/src/routing_algorithm.rs b/crates/diesel_models/src/routing_algorithm.rs index 6be0be3d5e42..5f5a0560811b 100644 --- a/crates/diesel_models/src/routing_algorithm.rs +++ b/crates/diesel_models/src/routing_algorithm.rs @@ -1,3 +1,4 @@ +use common_utils::id_type; use diesel::{Identifiable, Insertable, Queryable, Selectable}; use serde::{Deserialize, Serialize}; @@ -6,9 +7,9 @@ use crate::{enums, schema::routing_algorithm}; #[derive(Clone, Debug, Identifiable, Insertable, Queryable, Selectable, Serialize, Deserialize)] #[diesel(table_name = routing_algorithm, primary_key(algorithm_id), check_for_backend(diesel::pg::Pg))] pub struct RoutingAlgorithm { - pub algorithm_id: String, - pub profile_id: common_utils::id_type::ProfileId, - pub merchant_id: common_utils::id_type::MerchantId, + pub algorithm_id: id_type::RoutingId, + pub profile_id: id_type::ProfileId, + pub merchant_id: id_type::MerchantId, pub name: String, pub description: Option, pub kind: enums::RoutingAlgorithmKind, @@ -19,7 +20,7 @@ pub struct RoutingAlgorithm { } pub struct RoutingAlgorithmMetadata { - pub algorithm_id: String, + pub algorithm_id: id_type::RoutingId, pub name: String, pub description: Option, pub kind: enums::RoutingAlgorithmKind, @@ -29,8 +30,8 @@ pub struct RoutingAlgorithmMetadata { } pub struct RoutingProfileMetadata { - pub profile_id: common_utils::id_type::ProfileId, - pub algorithm_id: String, + pub profile_id: id_type::ProfileId, + pub algorithm_id: id_type::RoutingId, pub name: String, pub description: Option, pub kind: enums::RoutingAlgorithmKind, diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs index 9a6edc50e733..4f9c562a565c 100644 --- a/crates/hyperswitch_domain_models/src/business_profile.rs +++ b/crates/hyperswitch_domain_models/src/business_profile.rs @@ -479,11 +479,11 @@ pub struct BusinessProfile { pub outgoing_webhook_custom_http_headers: OptionalEncryptableValue, pub always_collect_billing_details_from_wallet_connector: Option, pub always_collect_shipping_details_from_wallet_connector: Option, - pub routing_algorithm_id: Option, + pub routing_algorithm_id: Option, pub order_fulfillment_time: Option, pub order_fulfillment_time_origin: Option, pub frm_routing_algorithm_id: Option, - pub payout_routing_algorithm_id: Option, + pub payout_routing_algorithm_id: Option, pub default_fallback_routing: Option, pub tax_connector_id: Option, pub is_tax_connector_enabled: bool, @@ -536,8 +536,8 @@ pub struct BusinessProfileGeneralUpdate { pub enum BusinessProfileUpdate { Update(Box), RoutingAlgorithmUpdate { - routing_algorithm_id: Option, - payout_routing_algorithm_id: Option, + routing_algorithm_id: Option, + payout_routing_algorithm_id: Option, }, DefaultRoutingFallbackUpdate { default_fallback_routing: Option, diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 4057c1a108ce..9afc4de9136e 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -4073,7 +4073,7 @@ impl BusinessProfileWrapper { db: &dyn StorageInterface, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - algorithm_id: String, + algorithm_id: common_utils::id_type::RoutingId, transaction_type: &storage::enums::TransactionType, ) -> RouterResult<()> { let routing_cache_key = self.clone().get_routing_config_cache_key(); @@ -4114,7 +4114,7 @@ impl BusinessProfileWrapper { pub fn get_routing_algorithm_id<'a, F>( &'a self, transaction_data: &'a routing::TransactionData<'_, F>, - ) -> Option + ) -> Option where F: Send + Clone, { diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index 6f1912d7c65b..1c8a58662f1e 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -114,7 +114,7 @@ impl Default for MerchantAccountRoutingAlgorithm { #[derive(Debug, serde::Serialize, serde::Deserialize)] #[serde(untagged)] enum MerchantAccountRoutingAlgorithm { - V1(Option), + V1(Option), } #[cfg(feature = "payouts")] @@ -289,7 +289,7 @@ where pub async fn perform_static_routing_v1( state: &SessionState, merchant_id: &common_utils::id_type::MerchantId, - algorithm_id: Option, + algorithm_id: Option, business_profile: &domain::BusinessProfile, transaction_data: &routing::TransactionData<'_, F>, ) -> RoutingResult> { @@ -352,7 +352,7 @@ pub async fn perform_static_routing_v1( async fn ensure_algorithm_cached_v1( state: &SessionState, merchant_id: &common_utils::id_type::MerchantId, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, profile_id: common_utils::id_type::ProfileId, transaction_type: &api_enums::TransactionType, ) -> RoutingResult> { @@ -437,7 +437,7 @@ fn execute_dsl_and_get_connector_v1( pub async fn refresh_routing_cache_v1( state: &SessionState, key: String, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, profile_id: common_utils::id_type::ProfileId, ) -> RoutingResult> { let algorithm = { diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index d5a3a96d1550..b0cc088b0ff2 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -14,8 +14,12 @@ use super::payments; use super::payouts; #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))] use crate::utils::ValueExt; +#[cfg(all(feature = "v2", feature = "routing_v2"))] +use crate::{ + core::{admin, errors::RouterResult}, + db::StorageInterface, +}; use crate::{ - consts, core::{ errors::{self, RouterResponse, StorageErrorExt}, metrics, utils as core_utils, @@ -28,11 +32,6 @@ use crate::{ }, utils::{self, OptionExt}, }; -#[cfg(all(feature = "v2", feature = "routing_v2"))] -use crate::{ - core::{admin, errors::RouterResult}, - db::StorageInterface, -}; pub enum TransactionData<'a, F> where F: Clone, @@ -53,10 +52,7 @@ impl RoutingAlgorithmUpdate { profile_id: common_utils::id_type::ProfileId, transaction_type: &enums::TransactionType, ) -> Self { - let algorithm_id = common_utils::generate_id( - consts::ROUTING_CONFIG_ID_LENGTH, - &format!("routing_{}", merchant_id.get_string_repr()), - ); + let algorithm_id = common_utils::generate_routing_id_of_default_length(); let timestamp = common_utils::date_time::now(); let algo = RoutingAlgorithm { algorithm_id, @@ -74,7 +70,7 @@ impl RoutingAlgorithmUpdate { } pub async fn fetch_routing_algo( merchant_id: &common_utils::id_type::MerchantId, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, db: &dyn StorageInterface, ) -> RouterResult { let routing_algo = db @@ -215,10 +211,7 @@ pub async fn create_routing_algorithm_under_profile( }) .attach_printable("Algorithm of config not given")?; - let algorithm_id = common_utils::generate_id( - consts::ROUTING_CONFIG_ID_LENGTH, - &format!("routing_{}", merchant_account.get_id().get_string_repr()), - ); + let algorithm_id = common_utils::generate_routing_id_of_default_length(); let profile_id = request .profile_id @@ -280,7 +273,7 @@ pub async fn link_routing_config_under_profile( merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, profile_id: common_utils::id_type::ProfileId, - algorithm_id: String, + algorithm_id: common_utils::id_type::RoutingId, transaction_type: &enums::TransactionType, ) -> RouterResponse { metrics::ROUTING_LINK_CONFIG.add(&metrics::CONTEXT, 1, &[]); @@ -352,7 +345,7 @@ pub async fn link_routing_config( state: SessionState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, - algorithm_id: String, + algorithm_id: common_utils::id_type::RoutingId, transaction_type: &enums::TransactionType, ) -> RouterResponse { metrics::ROUTING_LINK_CONFIG.add(&metrics::CONTEXT, 1, &[]); @@ -428,7 +421,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id( state: SessionState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, - algorithm_id: String, + algorithm_id: common_utils::id_type::RoutingId, ) -> RouterResponse { metrics::ROUTING_RETRIEVE_CONFIG.add(&metrics::CONTEXT, 1, &[]); let db = state.store.as_ref(); @@ -461,7 +454,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id( state: SessionState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, - algorithm_id: String, + algorithm_id: common_utils::id_type::RoutingId, ) -> RouterResponse { metrics::ROUTING_RETRIEVE_CONFIG.add(&metrics::CONTEXT, 1, &[]); let db = state.store.as_ref(); diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index eb99b6bb85e8..a41671eefe4e 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -2495,7 +2495,7 @@ impl RoutingAlgorithmInterface for KafkaStore { async fn find_routing_algorithm_by_profile_id_algorithm_id( &self, profile_id: &id_type::ProfileId, - algorithm_id: &str, + algorithm_id: &id_type::RoutingId, ) -> CustomResult { self.diesel_store .find_routing_algorithm_by_profile_id_algorithm_id(profile_id, algorithm_id) @@ -2504,7 +2504,7 @@ impl RoutingAlgorithmInterface for KafkaStore { async fn find_routing_algorithm_by_algorithm_id_merchant_id( &self, - algorithm_id: &str, + algorithm_id: &id_type::RoutingId, merchant_id: &id_type::MerchantId, ) -> CustomResult { self.diesel_store @@ -2514,7 +2514,7 @@ impl RoutingAlgorithmInterface for KafkaStore { async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id( &self, - algorithm_id: &str, + algorithm_id: &id_type::RoutingId, profile_id: &id_type::ProfileId, ) -> CustomResult { self.diesel_store diff --git a/crates/router/src/db/routing_algorithm.rs b/crates/router/src/db/routing_algorithm.rs index 5672777bfa21..3849b9272e07 100644 --- a/crates/router/src/db/routing_algorithm.rs +++ b/crates/router/src/db/routing_algorithm.rs @@ -21,18 +21,18 @@ pub trait RoutingAlgorithmInterface { async fn find_routing_algorithm_by_profile_id_algorithm_id( &self, profile_id: &common_utils::id_type::ProfileId, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, ) -> StorageResult; async fn find_routing_algorithm_by_algorithm_id_merchant_id( &self, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult; async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id( &self, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, profile_id: &common_utils::id_type::ProfileId, ) -> StorageResult; @@ -77,7 +77,7 @@ impl RoutingAlgorithmInterface for Store { async fn find_routing_algorithm_by_profile_id_algorithm_id( &self, profile_id: &common_utils::id_type::ProfileId, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, ) -> StorageResult { let conn = connection::pg_connection_write(self).await?; routing_storage::RoutingAlgorithm::find_by_algorithm_id_profile_id( @@ -92,7 +92,7 @@ impl RoutingAlgorithmInterface for Store { #[instrument(skip_all)] async fn find_routing_algorithm_by_algorithm_id_merchant_id( &self, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult { let conn = connection::pg_connection_write(self).await?; @@ -108,7 +108,7 @@ impl RoutingAlgorithmInterface for Store { #[instrument(skip_all)] async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id( &self, - algorithm_id: &str, + algorithm_id: &common_utils::id_type::RoutingId, profile_id: &common_utils::id_type::ProfileId, ) -> StorageResult { let conn = connection::pg_connection_write(self).await?; @@ -186,14 +186,14 @@ impl RoutingAlgorithmInterface for MockDb { async fn find_routing_algorithm_by_profile_id_algorithm_id( &self, _profile_id: &common_utils::id_type::ProfileId, - _algorithm_id: &str, + _algorithm_id: &common_utils::id_type::RoutingId, ) -> StorageResult { Err(errors::StorageError::MockDbError)? } async fn find_routing_algorithm_by_algorithm_id_merchant_id( &self, - _algorithm_id: &str, + _algorithm_id: &common_utils::id_type::RoutingId, _merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult { Err(errors::StorageError::MockDbError)? @@ -201,7 +201,7 @@ impl RoutingAlgorithmInterface for MockDb { async fn find_routing_algorithm_metadata_by_algorithm_id_profile_id( &self, - _algorithm_id: &str, + _algorithm_id: &common_utils::id_type::RoutingId, _profile_id: &common_utils::id_type::ProfileId, ) -> StorageResult { Err(errors::StorageError::MockDbError)? diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs index ecce0f96198e..aefc91f759c4 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, req: HttpRequest, - path: web::Path, + path: web::Path, transaction_type: &enums::TransactionType, ) -> impl Responder { let flow = Flow::RoutingLinkConfig; @@ -139,7 +139,7 @@ pub async fn routing_link_config( pub async fn routing_retrieve_config( state: web::Data, req: HttpRequest, - path: web::Path, + path: web::Path, ) -> impl Responder { let algorithm_id = path.into_inner(); let flow = Flow::RoutingRetrieveConfig;