feat(router): Default configs and toggle api for dynamic routing feature (#5830)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Prajjwal Kumar
2024-09-16 12:23:32 +05:30
committed by GitHub
parent 4137d7b48a
commit 9f9a414042
26 changed files with 995 additions and 40 deletions

View File

@ -158,6 +158,8 @@ Never share your secret api keys. Keep them guarded and secure.
routes::routing::routing_retrieve_linked_config,
routes::routing::routing_retrieve_default_config_for_profiles,
routes::routing::routing_update_default_config_for_profile,
routes::routing::toggle_success_based_routing,
routes::routing::success_based_routing_update_configs,
// Routes for blocklist
routes::blocklist::remove_entry_from_blocklist,
@ -546,6 +548,13 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::routing::StraightThroughAlgorithm,
api_models::routing::ConnectorVolumeSplit,
api_models::routing::ConnectorSelection,
api_models::routing::ToggleSuccessBasedRoutingQuery,
api_models::routing::SuccessBasedRoutingConfig,
api_models::routing::SuccessBasedRoutingConfigParams,
api_models::routing::SuccessBasedRoutingConfigBody,
api_models::routing::CurrentBlockThreshold,
api_models::routing::SuccessBasedRoutingUpdateConfigQuery,
api_models::routing::ToggleSuccessBasedRoutingPath,
api_models::routing::ast::RoutableChoiceKind,
api_models::enums::RoutableConnectors,
api_models::routing::ast::ProgramConnectorSelection,

View File

@ -255,3 +255,56 @@ pub async fn routing_retrieve_default_config_for_profiles() {}
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_update_default_config_for_profile() {}
#[cfg(feature = "v1")]
/// Routing - Toggle success based dynamic routing for profile
///
/// Create a success based dynamic routing algorithm
#[utoipa::path(
post,
path = "/account/:account_id/business_profile/:profile_id/dynamic_routing/success_based/toggle",
params(
("account_id" = String, Path, description = "Merchant id"),
("profile_id" = String, Path, description = "Profile id under which Dynamic routing needs to be toggled"),
("status" = bool, Query, description = "Boolean value for mentioning the expected state of dynamic routing"),
),
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 success based dynamic routing algprithm",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn toggle_success_based_routing() {}
#[cfg(feature = "v1")]
/// Routing - Update config for success based dynamic routing
///
/// Update config for success based dynamic routing
#[utoipa::path(
patch,
path = "/account/:account_id/business_profile/:profile_id/dynamic_routing/success_based/config/:algorithm_id",
request_body = SuccessBasedRoutingConfig,
params(
("account_id" = String, Path, description = "Merchant id"),
("profile_id" = String, Path, description = "The unique identifier for a profile"),
("algorithm_id" = String, Path, description = "The unique identifier for routing algorithm"),
),
responses(
(status = 200, description = "Routing Algorithm updated", 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 = "Update configs for success based dynamic routing algorithm",
security(("admin_api_key" = []))
)]
pub async fn success_based_routing_update_configs() {}