mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(openapi): Add open api routes for routing v2 (#5686)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
openapi: patch /v2/profiles/{profile_id}/activate_routing_algorithm
|
||||||
|
---
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
openapi: patch /v2/profiles/{profile_id}/deactivate_routing_algorithm
|
||||||
|
---
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
openapi: get /v2/profiles/{profile_id}/routing_algorithm
|
||||||
|
---
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
openapi: get /v2/profiles/{profile_id}/fallback_routing
|
||||||
|
---
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
openapi: post /v2/profiles/{profile_id}/fallback_routing
|
||||||
|
---
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
openapi: post /v2/routing_algorithm
|
||||||
|
---
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
openapi: get /v2/routing_algorithm/{routing_algorithm_id}
|
||||||
|
---
|
||||||
@ -63,7 +63,19 @@
|
|||||||
"pages": [
|
"pages": [
|
||||||
"api-reference/business-profile/business-profile--create",
|
"api-reference/business-profile/business-profile--create",
|
||||||
"api-reference/business-profile/business-profile--update",
|
"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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -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": {
|
"components": {
|
||||||
@ -16479,6 +16889,17 @@
|
|||||||
"propertyName": "type"
|
"propertyName": "type"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"RoutingAlgorithmId": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"routing_algorithm_id"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"routing_algorithm_id": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"RoutingAlgorithmKind": {
|
"RoutingAlgorithmKind": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
|
|||||||
@ -3487,7 +3487,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/routing/{algorithm_id}/activate": {
|
"/routing/{routing_algorithm_id}/activate": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"Routing"
|
"Routing"
|
||||||
@ -3497,7 +3497,7 @@
|
|||||||
"operationId": "Activate a routing config",
|
"operationId": "Activate a routing config",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "algorithm_id",
|
"name": "routing_algorithm_id",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"description": "The unique identifier for a config",
|
"description": "The unique identifier for a config",
|
||||||
"required": true,
|
"required": true,
|
||||||
@ -3537,7 +3537,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/routing/{algorithm_id}": {
|
"/routing/{routing_algorithm_id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"Routing"
|
"Routing"
|
||||||
@ -3547,7 +3547,7 @@
|
|||||||
"operationId": "Retrieve a routing config",
|
"operationId": "Retrieve a routing config",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "algorithm_id",
|
"name": "routing_algorithm_id",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"description": "The unique identifier for a config",
|
"description": "The unique identifier for a config",
|
||||||
"required": true,
|
"required": true,
|
||||||
|
|||||||
@ -478,10 +478,10 @@ pub enum RoutingKind {
|
|||||||
RoutingAlgorithm(Vec<RoutingDictionaryRecord>),
|
RoutingAlgorithm(Vec<RoutingDictionaryRecord>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
pub struct RoutingAlgorithmId {
|
||||||
#[serde(transparent)]
|
pub routing_algorithm_id: String,
|
||||||
pub struct RoutingAlgorithmId(pub String);
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct RoutingLinkWrapper {
|
pub struct RoutingLinkWrapper {
|
||||||
|
|||||||
@ -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_create,
|
||||||
routes::business_profile::business_profile_retrieve,
|
routes::business_profile::business_profile_retrieve,
|
||||||
routes::business_profile::business_profile_update,
|
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(
|
components(schemas(
|
||||||
common_utils::types::MinorUnit,
|
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::ValueType,
|
||||||
api_models::routing::ast::MetadataValue,
|
api_models::routing::ast::MetadataValue,
|
||||||
api_models::routing::ast::NumberComparison,
|
api_models::routing::ast::NumberComparison,
|
||||||
|
api_models::routing::RoutingAlgorithmId,
|
||||||
api_models::payment_methods::RequestPaymentMethodTypes,
|
api_models::payment_methods::RequestPaymentMethodTypes,
|
||||||
api_models::payments::PaymentLinkStatus,
|
api_models::payments::PaymentLinkStatus,
|
||||||
api_models::blocklist::BlocklistRequest,
|
api_models::blocklist::BlocklistRequest,
|
||||||
|
|||||||
@ -205,3 +205,121 @@ pub async fn business_profile_retrieve() {}
|
|||||||
security(("admin_api_key" = []))
|
security(("admin_api_key" = []))
|
||||||
)]
|
)]
|
||||||
pub async fn business_profile_retrieve() {}
|
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() {}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Create
|
/// Routing - Create
|
||||||
///
|
///
|
||||||
/// Create a routing config
|
/// Create a routing config
|
||||||
@ -19,14 +20,37 @@
|
|||||||
)]
|
)]
|
||||||
pub async fn routing_create_config() {}
|
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
|
/// Routing - Activate config
|
||||||
///
|
///
|
||||||
/// Activate a routing config
|
/// Activate a routing config
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
post,
|
post,
|
||||||
path = "/routing/{algorithm_id}/activate",
|
path = "/routing/{routing_algorithm_id}/activate",
|
||||||
params(
|
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(
|
responses(
|
||||||
(status = 200, description = "Routing config activated", body = RoutingDictionaryRecord),
|
(status = 200, description = "Routing config activated", body = RoutingDictionaryRecord),
|
||||||
@ -40,15 +64,16 @@ pub async fn routing_create_config() {}
|
|||||||
)]
|
)]
|
||||||
pub async fn routing_link_config() {}
|
pub async fn routing_link_config() {}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Retrieve
|
/// Routing - Retrieve
|
||||||
///
|
///
|
||||||
/// Retrieve a routing algorithm
|
/// Retrieve a routing algorithm
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/routing/{algorithm_id}",
|
path = "/routing/{routing_algorithm_id}",
|
||||||
params(
|
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(
|
responses(
|
||||||
(status = 200, description = "Successfully fetched routing config", body = MerchantRoutingAlgorithm),
|
(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() {}
|
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
|
/// Routing - List
|
||||||
///
|
///
|
||||||
/// List all routing configs
|
/// List all routing configs
|
||||||
@ -84,6 +133,7 @@ pub async fn routing_retrieve_config() {}
|
|||||||
)]
|
)]
|
||||||
pub async fn list_routing_configs() {}
|
pub async fn list_routing_configs() {}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Deactivate
|
/// Routing - Deactivate
|
||||||
///
|
///
|
||||||
/// Deactivates a routing config
|
/// Deactivates a routing config
|
||||||
@ -104,6 +154,7 @@ pub async fn list_routing_configs() {}
|
|||||||
)]
|
)]
|
||||||
pub async fn routing_unlink_config() {}
|
pub async fn routing_unlink_config() {}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Update Default Config
|
/// Routing - Update Default Config
|
||||||
///
|
///
|
||||||
/// Update default fallback config
|
/// Update default fallback config
|
||||||
@ -123,6 +174,7 @@ pub async fn routing_unlink_config() {}
|
|||||||
)]
|
)]
|
||||||
pub async fn routing_update_default_config() {}
|
pub async fn routing_update_default_config() {}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Retrieve Default Config
|
/// Routing - Retrieve Default Config
|
||||||
///
|
///
|
||||||
/// Retrieve default fallback config
|
/// Retrieve default fallback config
|
||||||
@ -139,6 +191,7 @@ pub async fn routing_update_default_config() {}
|
|||||||
)]
|
)]
|
||||||
pub async fn routing_retrieve_default_config() {}
|
pub async fn routing_retrieve_default_config() {}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Retrieve Config
|
/// Routing - Retrieve Config
|
||||||
///
|
///
|
||||||
/// Retrieve active config
|
/// Retrieve active config
|
||||||
@ -160,6 +213,7 @@ pub async fn routing_retrieve_default_config() {}
|
|||||||
)]
|
)]
|
||||||
pub async fn routing_retrieve_linked_config() {}
|
pub async fn routing_retrieve_linked_config() {}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Retrieve Default For Profile
|
/// Routing - Retrieve Default For Profile
|
||||||
///
|
///
|
||||||
/// Retrieve default config for profiles
|
/// 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() {}
|
pub async fn routing_retrieve_default_config_for_profiles() {}
|
||||||
|
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
/// Routing - Update Default For Profile
|
/// Routing - Update Default For Profile
|
||||||
///
|
///
|
||||||
/// Update default config for profiles
|
/// Update default config for profiles
|
||||||
|
|||||||
@ -424,7 +424,7 @@ pub async fn link_routing_config(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "v2", feature = "routing_v2",))]
|
#[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,
|
state: SessionState,
|
||||||
merchant_account: domain::MerchantAccount,
|
merchant_account: domain::MerchantAccount,
|
||||||
key_store: domain::MerchantKeyStore,
|
key_store: domain::MerchantKeyStore,
|
||||||
@ -434,9 +434,12 @@ pub async fn retrieve_active_routing_config(
|
|||||||
let db = state.store.as_ref();
|
let db = state.store.as_ref();
|
||||||
let key_manager_state = &(&state).into();
|
let key_manager_state = &(&state).into();
|
||||||
|
|
||||||
let routing_algorithm =
|
let routing_algorithm = RoutingAlgorithmUpdate::fetch_routing_algo(
|
||||||
RoutingAlgorithmUpdate::fetch_routing_algo(merchant_account.get_id(), &algorithm_id.0, db)
|
merchant_account.get_id(),
|
||||||
.await?;
|
&algorithm_id.routing_algorithm_id,
|
||||||
|
db,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
core_utils::validate_and_get_business_profile(
|
core_utils::validate_and_get_business_profile(
|
||||||
db,
|
db,
|
||||||
key_manager_state,
|
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")))]
|
#[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,
|
state: SessionState,
|
||||||
merchant_account: domain::MerchantAccount,
|
merchant_account: domain::MerchantAccount,
|
||||||
key_store: domain::MerchantKeyStore,
|
key_store: domain::MerchantKeyStore,
|
||||||
@ -469,7 +472,7 @@ pub async fn retrieve_active_routing_config(
|
|||||||
|
|
||||||
let routing_algorithm = db
|
let routing_algorithm = db
|
||||||
.find_routing_algorithm_by_algorithm_id_merchant_id(
|
.find_routing_algorithm_by_algorithm_id_merchant_id(
|
||||||
&algorithm_id.0,
|
&algorithm_id.routing_algorithm_id,
|
||||||
merchant_account.get_id(),
|
merchant_account.get_id(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@ -69,12 +69,12 @@ pub async fn routing_link_config(
|
|||||||
state,
|
state,
|
||||||
&req,
|
&req,
|
||||||
path.into_inner(),
|
path.into_inner(),
|
||||||
|state, auth: auth::AuthenticationData, algorithm_id, _| {
|
|state, auth: auth::AuthenticationData, algorithm, _| {
|
||||||
routing::link_routing_config(
|
routing::link_routing_config(
|
||||||
state,
|
state,
|
||||||
auth.merchant_account,
|
auth.merchant_account,
|
||||||
auth.key_store,
|
auth.key_store,
|
||||||
algorithm_id.0,
|
algorithm.routing_algorithm_id,
|
||||||
transaction_type,
|
transaction_type,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -117,7 +117,7 @@ pub async fn routing_link_config(
|
|||||||
auth.merchant_account,
|
auth.merchant_account,
|
||||||
auth.key_store,
|
auth.key_store,
|
||||||
wrapper.profile_id,
|
wrapper.profile_id,
|
||||||
wrapper.algorithm_id.0,
|
wrapper.algorithm_id.routing_algorithm_id,
|
||||||
transaction_type,
|
transaction_type,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -149,7 +149,7 @@ pub async fn routing_retrieve_config(
|
|||||||
&req,
|
&req,
|
||||||
algorithm_id,
|
algorithm_id,
|
||||||
|state, auth: auth::AuthenticationData, algorithm_id, _| {
|
|state, auth: auth::AuthenticationData, algorithm_id, _| {
|
||||||
routing::retrieve_active_routing_config(
|
routing::retrieve_routing_algorithm_from_algorithm_id(
|
||||||
state,
|
state,
|
||||||
auth.merchant_account,
|
auth.merchant_account,
|
||||||
auth.key_store,
|
auth.key_store,
|
||||||
|
|||||||
Reference in New Issue
Block a user