Skip to content

Commit

Permalink
chore: Resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarthak1799 committed Dec 18, 2024
1 parent 6a01879 commit 01907d5
Show file tree
Hide file tree
Showing 3 changed files with 307 additions and 4 deletions.
247 changes: 245 additions & 2 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3963,7 +3963,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DynamicRoutingFeatures"
"$ref": "#/components/schemas/SuccessBasedRoutingConfig"
}
}
},
Expand Down Expand Up @@ -4110,13 +4110,97 @@
{
"name": "enable",
"in": "query",
"description": "Feature to enable for success based routing",
"description": "Feature to enable for elimination based routing",
"required": true,
"schema": {
"$ref": "#/components/schemas/DynamicRoutingFeatures"
}
}
],
"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": []
}
]
}
},
"/account/:account_id/business_profile/:profile_id/dynamic_routing/contracts/toggle": {
"post": {
"tags": [
"Routing"
],
"summary": "Routing - Toggle Contract routing for profile",
"description": "Create a Contract based dynamic routing algorithm",
"operationId": "Toggle contract routing algorithm",
"parameters": [
{
"name": "account_id",
"in": "path",
"description": "Merchant id",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "profile_id",
"in": "path",
"description": "Profile id under which Dynamic routing needs to be toggled",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "enable",
"in": "query",
"description": "Feature to enable for contract based routing",
"required": true,
"schema": {
"$ref": "#/components/schemas/DynamicRoutingFeatures"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ContractBasedRoutingConfig"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Routing Algorithm created",
Expand Down Expand Up @@ -4154,6 +4238,90 @@
]
}
},
"/account/{account_id}/business_profile/{profile_id}/dynamic_routing/contracts/config/{algorithm_id}": {
"patch": {
"tags": [
"Routing"
],
"summary": "Routing - Update contract based dynamic routing config for profile",
"description": "Update contract based dynamic routing algorithm",
"operationId": "Update contract based dynamic routing configs",
"parameters": [
{
"name": "account_id",
"in": "path",
"description": "Merchant id",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "profile_id",
"in": "path",
"description": "Profile id under which Dynamic routing needs to be toggled",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "algorithm_id",
"in": "path",
"description": "Contract based routing algorithm id which was last activated to update the config",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ContractBasedRoutingConfig"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Routing Algorithm updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RoutingDictionaryRecord"
}
}
}
},
"400": {
"description": "Update body is malformed"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Resource missing"
},
"422": {
"description": "Unprocessable request"
},
"500": {
"description": "Internal server error"
}
},
"security": [
{
"api_key": []
},
{
"jwt_key": []
}
]
}
},
"/blocklist": {
"delete": {
"tags": [
Expand Down Expand Up @@ -9159,6 +9327,54 @@
},
"additionalProperties": false
},
"ContractBasedRoutingConfig": {
"type": "object",
"properties": {
"config": {
"allOf": [
{
"$ref": "#/components/schemas/ContractBasedRoutingConfigBody"
}
],
"nullable": true
},
"label_info": {
"type": "array",
"items": {
"$ref": "#/components/schemas/LabelInformation"
},
"nullable": true
}
}
},
"ContractBasedRoutingConfigBody": {
"type": "object",
"properties": {
"constants": {
"type": "array",
"items": {
"type": "number",
"format": "double"
},
"nullable": true
},
"time_scale": {
"allOf": [
{
"$ref": "#/components/schemas/ContractBasedTimeScale"
}
],
"nullable": true
}
}
},
"ContractBasedTimeScale": {
"type": "string",
"enum": [
"day",
"month"
]
},
"CountryAlpha2": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -12461,6 +12677,33 @@
}
}
},
"LabelInformation": {
"type": "object",
"required": [
"label",
"target_count",
"target_time",
"mca_id"
],
"properties": {
"label": {
"type": "string"
},
"target_count": {
"type": "integer",
"format": "int64",
"minimum": 0
},
"target_time": {
"type": "integer",
"format": "int64",
"minimum": 0
},
"mca_id": {
"$ref": "#/components/schemas/common_utils.id_type.MerchantConnectorAccountId"
}
}
},
"LinkedRoutingConfigRetrieveResponse": {
"oneOf": [
{
Expand Down
6 changes: 6 additions & 0 deletions crates/openapi/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ Never share your secret api keys. Keep them guarded and secure.
routes::routing::success_based_routing_update_configs,
routes::routing::toggle_success_based_routing,
routes::routing::toggle_elimination_routing,
routes::routing::contract_based_routing_setup_config,
routes::routing::contract_based_routing_update_configs,
// Routes for blocklist
routes::blocklist::remove_entry_from_blocklist,
Expand Down Expand Up @@ -596,6 +598,10 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::routing::DynamicRoutingConfigParams,
api_models::routing::CurrentBlockThreshold,
api_models::routing::SuccessBasedRoutingConfigBody,
api_models::routing::ContractBasedRoutingConfig,
api_models::routing::ContractBasedRoutingConfigBody,
api_models::routing::LabelInformation,
api_models::routing::ContractBasedTimeScale,
api_models::routing::LinkedRoutingConfigRetrieveResponse,
api_models::routing::RoutingRetrieveResponse,
api_models::routing::ProfileDefaultRoutingConfig,
Expand Down
58 changes: 56 additions & 2 deletions crates/openapi/src/routes/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ pub async fn toggle_success_based_routing() {}
("profile_id" = String, Path, description = "Profile id under which Dynamic routing needs to be toggled"),
("algorithm_id" = String, Path, description = "Success based routing algorithm id which was last activated to update the config"),
),
request_body = DynamicRoutingFeatures,
request_body = SuccessBasedRoutingConfig,
responses(
(status = 200, description = "Routing Algorithm updated", body = RoutingDictionaryRecord),
(status = 400, description = "Update body is malformed"),
Expand All @@ -317,7 +317,7 @@ pub async fn success_based_routing_update_configs() {}
params(
("account_id" = String, Path, description = "Merchant id"),
("profile_id" = String, Path, description = "Profile id under which Dynamic routing needs to be toggled"),
("enable" = DynamicRoutingFeatures, Query, description = "Feature to enable for success based routing"),
("enable" = DynamicRoutingFeatures, Query, description = "Feature to enable for elimination based routing"),
),
responses(
(status = 200, description = "Routing Algorithm created", body = RoutingDictionaryRecord),
Expand All @@ -332,3 +332,57 @@ pub async fn success_based_routing_update_configs() {}
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn toggle_elimination_routing() {}

#[cfg(feature = "v1")]
/// Routing - Toggle Contract routing for profile
///
/// Create a Contract based dynamic routing algorithm
#[utoipa::path(
post,
path = "/account/:account_id/business_profile/:profile_id/dynamic_routing/contracts/toggle",
params(
("account_id" = String, Path, description = "Merchant id"),
("profile_id" = String, Path, description = "Profile id under which Dynamic routing needs to be toggled"),
("enable" = DynamicRoutingFeatures, Query, description = "Feature to enable for contract based routing"),
),
request_body = ContractBasedRoutingConfig,
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 = "Toggle contract routing algorithm",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn contract_based_routing_setup_config() {}

#[cfg(feature = "v1")]
/// Routing - Update contract based dynamic routing config for profile
///
/// Update contract based dynamic routing algorithm
#[utoipa::path(
patch,
path = "/account/{account_id}/business_profile/{profile_id}/dynamic_routing/contracts/config/{algorithm_id}",
params(
("account_id" = String, Path, description = "Merchant id"),
("profile_id" = String, Path, description = "Profile id under which Dynamic routing needs to be toggled"),
("algorithm_id" = String, Path, description = "Contract based routing algorithm id which was last activated to update the config"),
),
request_body = ContractBasedRoutingConfig,
responses(
(status = 200, description = "Routing Algorithm updated", body = RoutingDictionaryRecord),
(status = 400, description = "Update 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 = "Update contract based dynamic routing configs",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn contract_based_routing_update_configs() {}

0 comments on commit 01907d5

Please sign in to comment.