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
feat(openapi): Add open api routes for routing v2 (#5686)
Amisha Prabhat6bb97671e7df
diff --git a/api-reference-v2/api-reference/business-profile/business-profile--activate-routing-algorithm.mdx b/api-reference-v2/api-reference/business-profile/business-profile--activate-routing-algorithm.mdxnew file mode 100644index 0000000000..9ff6f4fdd5--- /dev/null+++ b/api-reference-v2/api-reference/business-profile/business-profile--activate-routing-algorithm.mdx@@ -0,0 +1,3 @@+---+openapi: patch /v2/profiles/{profile_id}/activate_routing_algorithm+---\ No newline at end of filediff --git a/api-reference-v2/api-reference/business-profile/business-profile--deactivate-routing-algorithm.mdx b/api-reference-v2/api-reference/business-profile/business-profile--deactivate-routing-algorithm.mdxnew file mode 100644index 0000000000..5cc815612e--- /dev/null+++ b/api-reference-v2/api-reference/business-profile/business-profile--deactivate-routing-algorithm.mdx@@ -0,0 +1,3 @@+---+openapi: patch /v2/profiles/{profile_id}/deactivate_routing_algorithm+---\ No newline at end of filediff --git a/api-reference-v2/api-reference/business-profile/business-profile--retrieve-active-routing-algorithm.mdx b/api-reference-v2/api-reference/business-profile/business-profile--retrieve-active-routing-algorithm.mdxnew file mode 100644index 0000000000..7aba27485e--- /dev/null+++ b/api-reference-v2/api-reference/business-profile/business-profile--retrieve-active-routing-algorithm.mdx@@ -0,0 +1,3 @@+---+openapi: get /v2/profiles/{profile_id}/routing_algorithm+---\ No newline at end of filediff --git a/api-reference-v2/api-reference/business-profile/business-profile--retrieve-default-fallback-routing-algorithm.mdx b/api-reference-v2/api-reference/business-profile/business-profile--retrieve-default-fallback-routing-algorithm.mdxnew file mode 100644index 0000000000..9b1b942907--- /dev/null+++ b/api-reference-v2/api-reference/business-profile/business-profile--retrieve-default-fallback-routing-algorithm.mdx@@ -0,0 +1,3 @@+---+openapi: get /v2/profiles/{profile_id}/fallback_routing+---\ No newline at end of filediff --git a/api-reference-v2/api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm.mdx b/api-reference-v2/api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm.mdxnew file mode 100644index 0000000000..ca4cb5f8fe--- /dev/null+++ b/api-reference-v2/api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm.mdx@@ -0,0 +1,3 @@+---+openapi: post /v2/profiles/{profile_id}/fallback_routing+---\ No newline at end of filediff --git a/api-reference-v2/api-reference/routing/routing--create.mdx b/api-reference-v2/api-reference/routing/routing--create.mdxnew file mode 100644index 0000000000..65ef15008f--- /dev/null+++ b/api-reference-v2/api-reference/routing/routing--create.mdx@@ -0,0 +1,3 @@+---+openapi: post /v2/routing_algorithm+---\ No newline at end of filediff --git a/api-reference-v2/api-reference/routing/routing--retrieve.mdx b/api-reference-v2/api-reference/routing/routing--retrieve.mdxnew file mode 100644index 0000000000..03f209951c--- /dev/null+++ b/api-reference-v2/api-reference/routing/routing--retrieve.mdx@@ -0,0 +1,3 @@+---+openapi: get /v2/routing_algorithm/{routing_algorithm_id}+---\ No newline at end of filediff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.jsonindex b93e4e6000..27bc39d076 100644--- a/api-reference-v2/mint.json+++ b/api-reference-v2/mint.json@@ -63,7 +63,19 @@"pages": ["api-reference/business-profile/business-profile--create","api-reference/business-profile/business-profile--update",- "api-reference/business-profile/business-profile--retrieve"+ "api-reference/business-profile/business-profile--retrieve",+ "api-reference/business-profile/business-profile--activate-routing-algorithm",+ "api-reference/business-profile/business-profile--retrieve-active-routing-algorithm",+ "api-reference/business-profile/business-profile--deactivate-routing-algorithm",+ "api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm",+ "api-reference/business-profile/business-profile--retrieve-default-fallback-routing-algorithm"+ ]+ },+ {+ "group": "Routing",+ "pages": [+ "api-reference/routing/routing--create",+ "api-reference/routing/routing--retrieve"]}],diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.jsonindex f0be48afec..bdbdd9aec7 100644--- a/api-reference-v2/openapi_spec.json+++ b/api-reference-v2/openapi_spec.json@@ -718,6 +718,416 @@}]}+ },+ "/v2/profiles/{profile_id}/activate_routing_algorithm": {+ "patch": {+ "tags": [+ "Business Profile"+ ],+ "summary": "Business Profile - Activate routing algorithm",+ "description": "Business Profile - Activate routing algorithm\n\nActivates a routing algorithm under a business profile",+ "operationId": "Activates a routing algorithm under a business profile",+ "parameters": [+ {+ "name": "profile_id",+ "in": "path",+ "description": "The unique identifier for the business profile",+ "required": true,+ "schema": {+ "type": "string"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RoutingAlgorithmId"+ },+ "examples": {+ "Activate a routing algorithm": {+ "value": {+ "routing_algorithm_id": "routing_algorithm_123"+ }+ }+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "Routing Algorithm is activated",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RoutingDictionaryRecord"+ }+ }+ }+ },+ "400": {+ "description": "Bad request"+ },+ "404": {+ "description": "Resource missing"+ },+ "500": {+ "description": "Internal server error"+ }+ },+ "security": [+ {+ "api_key": []+ },+ {+ "jwt_key": []+ }+ ]+ }+ },+ "/v2/profiles/{profile_id}/deactivate_routing_algorithm": {+ "patch": {+ "tags": [+ "Business Profile"+ ],+ "summary": "Business Profile - Deactivate routing algorithm",+ "description": "Business Profile - Deactivate routing algorithm\n\nDeactivates a routing algorithm under a business profile",+ "operationId": " Deactivates a routing algorithm under a business profile",+ "parameters": [+ {+ "name": "profile_id",+ "in": "path",+ "description": "The unique identifier for the business profile",+ "required": true,+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "Successfully deactivated routing config",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RoutingDictionaryRecord"+ }+ }+ }+ },+ "400": {+ "description": "Malformed request"+ },+ "403": {+ "description": "Malformed request"+ },+ "422": {+ "description": "Unprocessable request"+ },+ "500": {+ "description": "Internal server error"+ }+ },+ "security": [+ {+ "api_key": []+ },+ {+ "jwt_key": []+ }+ ]+ }+ },+ "/v2/profiles/{profile_id}/fallback_routing": {+ "post": {+ "tags": [+ "Business Profile"+ ],+ "summary": "Business Profile - Update Default Fallback Routing Algorithm",+ "description": "Business Profile - Update Default Fallback Routing Algorithm\n\nUpdate the default fallback routing algorithm for the business profile",+ "operationId": "Update the default fallback routing algorithm for the business profile",+ "parameters": [+ {+ "name": "profile_id",+ "in": "path",+ "description": "The unique identifier for the business profile",+ "required": true,+ "schema": {+ "type": "string"+ }+ }+ ],+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/RoutableConnectorChoice"+ }+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "Successfully updated the default fallback routing algorithm",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/RoutableConnectorChoice"+ }+ }+ }+ }+ },+ "400": {+ "description": "Malformed request"+ },+ "422": {+ "description": "Unprocessable request"+ },+ "500": {+ "description": "Internal server error"+ }+ },+ "security": [+ {+ "api_key": []+ },+ {+ "jwt_key": []+ }+ ]+ },+ "get": {+ "tags": [+ "Business Profile"+ ],+ "summary": "Business Profile - Retrieve Default Fallback Routing Algorithm",+ "description": "Business Profile - Retrieve Default Fallback Routing Algorithm\n\nRetrieve the default fallback routing algorithm for the business profile",+ "operationId": "Retrieve the default fallback routing algorithm for the business profile",+ "parameters": [+ {+ "name": "profile_id",+ "in": "path",+ "description": "The unique identifier for the business profile",+ "required": true,+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "Successfully retrieved default fallback routing algorithm",+ "content": {+ "application/json": {+ "schema": {+ "type": "array",+ "items": {+ "$ref": "#/components/schemas/RoutableConnectorChoice"+ }+ }+ }+ }+ },+ "500": {+ "description": "Internal server error"+ }+ },+ "security": [+ {+ "api_key": []+ },+ {+ "jwt_key": []+ }+ ]+ }+ },+ "/v2/profiles/{profile_id}/routing_algorithm": {+ "get": {+ "tags": [+ "Business Profile"+ ],+ "summary": "Business Profile - Retrieve Active Routing Algorithm",+ "description": "Business Profile - Retrieve Active Routing Algorithm\n\nRetrieve active routing algorithm under the business profile",+ "operationId": "Retrieve the active routing algorithm under the business profile",+ "parameters": [+ {+ "name": "profile_id",+ "in": "path",+ "description": "The unique identifier for the business profile",+ "required": true,+ "schema": {+ "type": "string"+ }+ },+ {+ "name": "limit",+ "in": "query",+ "description": "The number of records of the algorithms to be returned",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32",+ "nullable": true,+ "minimum": 0+ }+ },+ {+ "name": "offset",+ "in": "query",+ "description": "The record offset of the algorithm from which to start gathering the results",+ "required": false,+ "schema": {+ "type": "integer",+ "format": "int32",+ "nullable": true,+ "minimum": 0+ }+ }+ ],+ "responses": {+ "200": {+ "description": "Successfully retrieved active config",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/LinkedRoutingConfigRetrieveResponse"+ }+ }+ }+ },+ "403": {+ "description": "Forbidden"+ },+ "404": {+ "description": "Resource missing"+ },+ "500": {+ "description": "Internal server error"+ }+ },+ "security": [+ {+ "api_key": []+ },+ {+ "jwt_key": []+ }+ ]+ }+ },+ "/v2/routing_algorithm": {+ "post": {+ "tags": [+ "Routing"+ ],+ "summary": "Routing - Create",+ "description": "Routing - Create\n\nCreate a routing algorithm",+ "operationId": "Create a routing algprithm",+ "requestBody": {+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RoutingConfigRequest"+ }+ }+ },+ "required": true+ },+ "responses": {+ "200": {+ "description": "Routing Algorithm created",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/RoutingDictionaryRecord"+ }+ }+ }+ },+ "400": {+ "description": "Request body is malformed"+ },+ "403": {+ "description": "Forbidden"+ },+ "404": {+ "description": "Resource missing"+ },+ "422": {+ "description": "Unprocessable request"+ },+ "500": {+ "description": "Internal server error"+ }+ },+ "security": [+ {+ "api_key": []+ },+ {+ "jwt_key": []+ }+ ]+ }+ },+ "/v2/routing_algorithm/{routing_algorithm_id}": {+ "get": {+ "tags": [+ "Routing"+ ],+ "summary": "Routing - Retrieve",+ "description": "Routing - Retrieve\n\nRetrieve a routing algorithm with its algorithm id",+ "operationId": "Retrieve a routing algorithm with its algorithm id",+ "parameters": [+ {+ "name": "routing_algorithm_id",+ "in": "path",+ "description": "The unique identifier for a routing algorithm",+ "required": true,+ "schema": {+ "type": "string"+ }+ }+ ],+ "responses": {+ "200": {+ "description": "Successfully fetched routing algorithm",+ "content": {+ "application/json": {+ "schema": {+ "$ref": "#/components/schemas/MerchantRoutingAlgorithm"+ }+ }+ }+ },+ "403": {+ "description": "Forbidden"+ },+ "404": {+ "description": "Resource missing"+ },+ "500": {+ "description": "Internal server error"+ }+ },+ "security": [+ {+ "api_key": []+ },+ {+ "jwt_key": []+ }+ ]+ }}},"components": {@@ -16479,6 +16889,17 @@"propertyName": "type"}},+ "RoutingAlgorithmId": {+ "type": "object",+ "required": [+ "routing_algorithm_id"+ ],+ "properties": {+ "routing_algorithm_id": {+ "type": "string"+ }+ }+ },"RoutingAlgorithmKind": {"type": "string","enum": [diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.jsonindex 682814f08d..cfd2fe4350 100644--- a/api-reference/openapi_spec.json+++ b/api-reference/openapi_spec.json@@ -3487,7 +3487,7 @@]}},- "/routing/{algorithm_id}/activate": {+ "/routing/{routing_algorithm_id}/activate": {"post": {"tags": ["Routing"@@ -3497,7 +3497,7 @@"operationId": "Activate a routing config","parameters": [{- "name": "algorithm_id",+ "name": "routing_algorithm_id","in": "path","description": "The unique identifier for a config","required": true,@@ -3537,7 +3537,7 @@]}},- "/routing/{algorithm_id}": {+ "/routing/{routing_algorithm_id}": {"get": {"tags": ["Routing"@@ -3547,7 +3547,7 @@"operationId": "Retrieve a routing config","parameters": [{- "name": "algorithm_id",+ "name": "routing_algorithm_id","in": "path","description": "The unique identifier for a config","required": true,diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rsindex 04ca1fd442..2c52f726c8 100644--- a/crates/api_models/src/routing.rs+++ b/crates/api_models/src/routing.rs@@ -478,10 +478,10 @@ pub enum RoutingKind {RoutingAlgorithm(Vec<RoutingDictionaryRecord>),}-#[repr(transparent)]-#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]-#[serde(transparent)]-pub struct RoutingAlgorithmId(pub String);+#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]+pub struct RoutingAlgorithmId {+ pub routing_algorithm_id: String,+}#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]pub struct RoutingLinkWrapper {diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rsindex f516839950..2b02ec7f71 100644--- a/crates/openapi/src/openapi_v2.rs+++ b/crates/openapi/src/openapi_v2.rs@@ -89,6 +89,17 @@ Never share your secret api keys. Keep them guarded and secure.routes::business_profile::business_profile_create,routes::business_profile::business_profile_retrieve,routes::business_profile::business_profile_update,++ // Routes for routing under business profile+ routes::business_profile::routing_link_config,+ routes::business_profile::routing_unlink_config,+ routes::business_profile::routing_update_default_config,+ routes::business_profile::routing_retrieve_default_config,+ routes::business_profile::routing_retrieve_linked_config,++ // Routes for routing+ routes::routing::routing_create_config,+ routes::routing::routing_retrieve_config,),components(schemas(common_utils::types::MinorUnit,@@ -452,6 +463,7 @@ Never share your secret api keys. Keep them guarded and secure.api_models::routing::ast::ValueType,api_models::routing::ast::MetadataValue,api_models::routing::ast::NumberComparison,+ api_models::routing::RoutingAlgorithmId,api_models::payment_methods::RequestPaymentMethodTypes,api_models::payments::PaymentLinkStatus,api_models::blocklist::BlocklistRequest,diff --git a/crates/openapi/src/routes/business_profile.rs b/crates/openapi/src/routes/business_profile.rsindex ac0a4c6776..07442f9757 100644--- a/crates/openapi/src/routes/business_profile.rs+++ b/crates/openapi/src/routes/business_profile.rs@@ -205,3 +205,121 @@ pub async fn business_profile_retrieve() {}security(("admin_api_key" = [])))]pub async fn business_profile_retrieve() {}++#[cfg(feature = "v2")]+/// Business Profile - Retrieve Active Routing Algorithm+///+/// Retrieve active routing algorithm under the business profile+#[utoipa::path(+ get,+ path = "/v2/profiles/{profile_id}/routing_algorithm",+ params(+ ("profile_id" = String, Path, description = "The unique identifier for the business profile"),+ ("limit" = Option<u16>, Query, description = "The number of records of the algorithms to be returned"),+ ("offset" = Option<u8>, Query, description = "The record offset of the algorithm from which to start gathering the results")),+ responses(+ (status = 200, description = "Successfully retrieved active config", body = LinkedRoutingConfigRetrieveResponse),+ (status = 500, description = "Internal server error"),+ (status = 404, description = "Resource missing"),+ (status = 403, description = "Forbidden")+ ),+ tag = "Business Profile",+ operation_id = "Retrieve the active routing algorithm under the business profile",+ security(("api_key" = []), ("jwt_key" = []))+)]+pub async fn routing_retrieve_linked_config() {}+#[cfg(feature = "v2")]+/// Business Profile - Activate routing algorithm+///+/// Activates a routing algorithm under a business profile+#[utoipa::path(+ patch,+ path = "/v2/profiles/{profile_id}/activate_routing_algorithm",+ request_body ( content = RoutingAlgorithmId,+ examples( (+ "Activate a routing algorithm" = (+ value = json!({+ "routing_algorithm_id": "routing_algorithm_123"+ })+ )+ ))),+ params(+ ("profile_id" = String, Path, description = "The unique identifier for the business profile"),+ ),+ responses(+ (status = 200, description = "Routing Algorithm is activated", body = RoutingDictionaryRecord),+ (status = 500, description = "Internal server error"),+ (status = 404, description = "Resource missing"),+ (status = 400, description = "Bad request")+ ),+ tag = "Business Profile",+ operation_id = "Activates a routing algorithm under a business profile",+ security(("api_key" = []), ("jwt_key" = []))+)]+pub async fn routing_link_config() {}++#[cfg(feature = "v2")]+/// Business Profile - Deactivate routing algorithm+///+/// Deactivates a routing algorithm under a business profile+#[utoipa::path(+ patch,+ path = "/v2/profiles/{profile_id}/deactivate_routing_algorithm",+ params(+ ("profile_id" = String, Path, description = "The unique identifier for the business profile"),+ ),+ responses(+ (status = 200, description = "Successfully deactivated routing config", body = RoutingDictionaryRecord),+ (status = 500, description = "Internal server error"),+ (status = 400, description = "Malformed request"),+ (status = 403, description = "Malformed request"),+ (status = 422, description = "Unprocessable request")+ ),+ tag = "Business Profile",+ operation_id = " Deactivates a routing algorithm under a business profile",+ security(("api_key" = []), ("jwt_key" = []))+)]+pub async fn routing_unlink_config() {}++#[cfg(feature = "v2")]+/// Business Profile - Update Default Fallback Routing Algorithm+///+/// Update the default fallback routing algorithm for the business profile+#[utoipa::path(+ post,+ path = "/v2/profiles/{profile_id}/fallback_routing",+ request_body = Vec<RoutableConnectorChoice>,+ params(+ ("profile_id" = String, Path, description = "The unique identifier for the business profile"),+ ),+ responses(+ (status = 200, description = "Successfully updated the default fallback routing algorithm", body = Vec<RoutableConnectorChoice>),+ (status = 500, description = "Internal server error"),+ (status = 400, description = "Malformed request"),+ (status = 422, description = "Unprocessable request")+ ),+ tag = "Business Profile",+ operation_id = "Update the default fallback routing algorithm for the business profile",+ security(("api_key" = []), ("jwt_key" = []))+)]+pub async fn routing_update_default_config() {}++#[cfg(feature = "v2")]+/// Business Profile - Retrieve Default Fallback Routing Algorithm+///+/// Retrieve the default fallback routing algorithm for the business profile+#[utoipa::path(+ get,+ path = "/v2/profiles/{profile_id}/fallback_routing",+ params(+ ("profile_id" = String, Path, description = "The unique identifier for the business profile"),+ ),+ responses(+ (status = 200, description = "Successfully retrieved default fallback routing algorithm", body = Vec<RoutableConnectorChoice>),+ (status = 500, description = "Internal server error")+ ),+ tag = "Business Profile",+ operation_id = "Retrieve the default fallback routing algorithm for the business profile",+ security(("api_key" = []), ("jwt_key" = []))+)]+pub async fn routing_retrieve_default_config() {}diff --git a/crates/openapi/src/routes/routing.rs b/crates/openapi/src/routes/routing.rsindex ecfac39f9e..5e1e3f60c6 100644--- a/crates/openapi/src/routes/routing.rs+++ b/crates/openapi/src/routes/routing.rs@@ -1,3 +1,4 @@+#[cfg(feature = "v1")]/// Routing - Create////// Create a routing config@@ -19,14 +20,37 @@)]pub async fn routing_create_config() {}+#[cfg(feature = "v2")]+/// Routing - Create+///+/// Create a routing algorithm+#[utoipa::path(+ post,+ path = "/v2/routing_algorithm",+ request_body = RoutingConfigRequest,+ responses(+ (status = 200, description = "Routing Algorithm created", body = RoutingDictionaryRecord),+ (status = 400, description = "Request body is malformed"),+ (status = 500, description = "Internal server error"),+ (status = 404, description = "Resource missing"),+ (status = 422, description = "Unprocessable request"),+ (status = 403, description = "Forbidden"),+ ),+ tag = "Routing",+ operation_id = "Create a routing algprithm",+ security(("api_key" = []), ("jwt_key" = []))+)]+pub async fn routing_create_config() {}++#[cfg(feature = "v1")]/// Routing - Activate config////// Activate a routing config#[utoipa::path(post,- path = "/routing/{algorithm_id}/activate",+ path = "/routing/{routing_algorithm_id}/activate",params(- ("algorithm_id" = String, Path, description = "The unique identifier for a config"),+ ("routing_algorithm_id" = String, Path, description = "The unique identifier for a config"),),responses((status = 200, description = "Routing config activated", body = RoutingDictionaryRecord),@@ -40,15 +64,16 @@ pub async fn routing_create_config() {})]pub async fn routing_link_config() {}+#[cfg(feature = "v1")]/// Routing - Retrieve////// Retrieve a routing algorithm#[utoipa::path(get,- path = "/routing/{algorithm_id}",+ path = "/routing/{routing_algorithm_id}",params(- ("algorithm_id" = String, Path, description = "The unique identifier for a config"),+ ("routing_algorithm_id" = String, Path, description = "The unique identifier for a config"),),responses((status = 200, description = "Successfully fetched routing config", body = MerchantRoutingAlgorithm),@@ -62,6 +87,30 @@ pub async fn routing_link_config() {})]pub async fn routing_retrieve_config() {}+#[cfg(feature = "v2")]+/// Routing - Retrieve+///+/// Retrieve a routing algorithm with its algorithm id++#[utoipa::path(+ get,+ path = "/v2/routing_algorithm/{routing_algorithm_id}",+ params(+ ("routing_algorithm_id" = String, Path, description = "The unique identifier for a routing algorithm"),+ ),+ responses(+ (status = 200, description = "Successfully fetched routing algorithm", body = MerchantRoutingAlgorithm),+ (status = 500, description = "Internal server error"),+ (status = 404, description = "Resource missing"),+ (status = 403, description = "Forbidden")+ ),+ tag = "Routing",+ operation_id = "Retrieve a routing algorithm with its algorithm id",+ security(("api_key" = []), ("jwt_key" = []))+)]+pub async fn routing_retrieve_config() {}++#[cfg(feature = "v1")]/// Routing - List////// List all routing configs@@ -84,6 +133,7 @@ pub async fn routing_retrieve_config() {})]pub async fn list_routing_configs() {}+#[cfg(feature = "v1")]/// Routing - Deactivate////// Deactivates a routing config@@ -104,6 +154,7 @@ pub async fn list_routing_configs() {})]pub async fn routing_unlink_config() {}+#[cfg(feature = "v1")]/// Routing - Update Default Config////// Update default fallback config@@ -123,6 +174,7 @@ pub async fn routing_unlink_config() {})]pub async fn routing_update_default_config() {}+#[cfg(feature = "v1")]/// Routing - Retrieve Default Config////// Retrieve default fallback config@@ -139,6 +191,7 @@ pub async fn routing_update_default_config() {})]pub async fn routing_retrieve_default_config() {}+#[cfg(feature = "v1")]/// Routing - Retrieve Config////// Retrieve active config@@ -160,6 +213,7 @@ pub async fn routing_retrieve_default_config() {})]pub async fn routing_retrieve_linked_config() {}+#[cfg(feature = "v1")]/// Routing - Retrieve Default For Profile////// Retrieve default config for profiles@@ -177,6 +231,7 @@ pub async fn routing_retrieve_linked_config() {})]pub async fn routing_retrieve_default_config_for_profiles() {}+#[cfg(feature = "v1")]/// Routing - Update Default For Profile////// Update default config for profilesdiff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rsindex 2b7f2d1830..640b12c52c 100644--- a/crates/router/src/core/routing.rs+++ b/crates/router/src/core/routing.rs@@ -424,7 +424,7 @@ pub async fn link_routing_config(}#[cfg(all(feature = "v2", feature = "routing_v2",))]-pub async fn retrieve_active_routing_config(+pub async fn retrieve_routing_algorithm_from_algorithm_id(state: SessionState,merchant_account: domain::MerchantAccount,key_store: domain::MerchantKeyStore,@@ -434,9 +434,12 @@ pub async fn retrieve_active_routing_config(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.0, db)- .await?;+ let routing_algorithm = RoutingAlgorithmUpdate::fetch_routing_algo(+ merchant_account.get_id(),+ &algorithm_id.routing_algorithm_id,+ db,+ )+ .await?;core_utils::validate_and_get_business_profile(db,key_manager_state,@@ -457,7 +460,7 @@ pub async fn retrieve_active_routing_config(}#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]-pub async fn retrieve_active_routing_config(+pub async fn retrieve_routing_algorithm_from_algorithm_id(state: SessionState,merchant_account: domain::MerchantAccount,key_store: domain::MerchantKeyStore,@@ -469,7 +472,7 @@ pub async fn retrieve_active_routing_config(let routing_algorithm = db.find_routing_algorithm_by_algorithm_id_merchant_id(- &algorithm_id.0,+ &algorithm_id.routing_algorithm_id,merchant_account.get_id(),).awaitdiff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rsindex 30edfc187b..79e8ec11f2 100644--- a/crates/router/src/routes/routing.rs+++ b/crates/router/src/routes/routing.rs@@ -69,12 +69,12 @@ pub async fn routing_link_config(state,&req,path.into_inner(),- |state, auth: auth::AuthenticationData, algorithm_id, _| {+ |state, auth: auth::AuthenticationData, algorithm, _| {routing::link_routing_config(state,auth.merchant_account,auth.key_store,- algorithm_id.0,+ algorithm.routing_algorithm_id,transaction_type,)},@@ -117,7 +117,7 @@ pub async fn routing_link_config(auth.merchant_account,auth.key_store,wrapper.profile_id,- wrapper.algorithm_id.0,+ wrapper.algorithm_id.routing_algorithm_id,transaction_type,)},@@ -149,7 +149,7 @@ pub async fn routing_retrieve_config(&req,algorithm_id,|state, auth: auth::AuthenticationData, algorithm_id, _| {- routing::retrieve_active_routing_config(+ routing::retrieve_routing_algorithm_from_algorithm_id(state,auth.merchant_account,auth.key_store,