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
fix(routing): remove unauthorized dynamic_routing config update endpoints (#14963)
Jagan1665f4dce6f0
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 30e19d68e9..6685f06735 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -6664,101 +6664,6 @@]}},- "/account/{account_id}/business_profile/{profile_id}/dynamic_routing/success_based/config/{algorithm_id}": {- "patch": {- "tags": [- "Routing"- ],- "summary": "Routing - Update success based dynamic routing config for profile",- "description": "Update success based dynamic routing algorithm",- "operationId": "Update success 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": "Success based routing algorithm id which was last activated to update the config",- "required": true,- "schema": {- "type": "string"- }- },- {- "name": "X-Connected-Merchant-Id",- "in": "header",- "description": "Merchant ID of the connected merchant on whose behalf the operation is performed. Required when authenticating with a platform merchant's API key. Standard and connected merchants must not send it.",- "required": false,- "schema": {- "type": "string",- "nullable": true- },- "example": "merchant_abc"- }- ],- "requestBody": {- "content": {- "application/json": {- "schema": {- "$ref": "#/components/schemas/SuccessBasedRoutingConfig"- }- }- },- "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": []- }- ]- }- },"/account/{account_id}/business_profile/{profile_id}/dynamic_routing/success_based/toggle": {"post": {"tags": [@@ -7192,101 +7097,6 @@]}},- "/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"- }- },- {- "name": "X-Connected-Merchant-Id",- "in": "header",- "description": "Merchant ID of the connected merchant on whose behalf the operation is performed. Required when authenticating with a platform merchant's API key. Standard and connected merchants must not send it.",- "required": false,- "schema": {- "type": "string",- "nullable": true- },- "example": "merchant_abc"- }- ],- "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": []- }- ]- }- },"/routing/evaluate": {"post": {"tags": [diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rsindex 47bf0c21bb..fe8c7420d4 100644--- a/crates/openapi/src/openapi.rs+++ b/crates/openapi/src/openapi.rs@@ -189,13 +189,11 @@ 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::success_based_routing_update_configs,routes::routing::toggle_success_based_routing,routes::routing::toggle_elimination_routing,routes::routing::create_success_based_routing,routes::routing::create_elimination_routing,routes::routing::contract_based_routing_setup_config,- routes::routing::contract_based_routing_update_configs,routes::routing::call_decide_gateway_open_router,routes::routing::call_update_gateway_score_open_router,routes::routing::evaluate_routing_rule,diff --git a/crates/openapi/src/routes/routing.rs b/crates/openapi/src/routes/routing.rsindex bbcd717ae3..b7a38b2ae6 100644--- a/crates/openapi/src/routes/routing.rs+++ b/crates/openapi/src/routes/routing.rs@@ -394,40 +394,6 @@ pub async fn toggle_success_based_routing() {})]pub async fn create_success_based_routing() {}-#[cfg(feature = "v1")]-/// Routing - Update success based dynamic routing config for profile-///-/// Update success based dynamic routing algorithm-#[utoipa::path(- patch,- path = "/account/{account_id}/business_profile/{profile_id}/dynamic_routing/success_based/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 = "Success based routing algorithm id which was last activated to update the config"),- (- "X-Connected-Merchant-Id" = Option<String>, Header,- description = "Merchant ID of the connected merchant on whose behalf the operation is performed. \- Required when authenticating with a platform merchant's API key. \- Standard and connected merchants must not send it.",- example = "merchant_abc"- )- ),- request_body = SuccessBasedRoutingConfig,- 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 success based dynamic routing configs",- security(("api_key" = []), ("jwt_key" = []))-)]-pub async fn success_based_routing_update_configs() {}-#[cfg(feature = "v1")]/// Routing - Toggle elimination routing for profile///@@ -522,40 +488,6 @@ pub async fn create_elimination_routing() {})]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"),- (- "X-Connected-Merchant-Id" = Option<String>, Header,- description = "Merchant ID of the connected merchant on whose behalf the operation is performed. \- Required when authenticating with a platform merchant's API key. \- Standard and connected merchants must not send it.",- example = "merchant_abc"- )- ),- 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() {}-#[cfg(feature = "v1")]/// Routing - Evaluate///diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rsindex 26575c43dc..61757d48b9 100644--- a/crates/router/src/core/routing.rs+++ b/crates/router/src/core/routing.rs@@ -16,18 +16,10 @@ use api_models::{},};use async_trait::async_trait;-#[cfg(all(feature = "v1", feature = "dynamic_routing"))]-use common_utils::ext_traits::AsyncExt;use common_utils::{ext_traits::Encode, request::Method};use diesel_models::routing_algorithm::RoutingAlgorithm;use error_stack::ResultExt;#[cfg(all(feature = "v1", feature = "dynamic_routing"))]-use external_services::grpc_client::dynamic_routing::{- contract_routing_client::ContractBasedDynamicRouting,- elimination_based_client::EliminationBasedRouting,- success_rate_client::SuccessBasedDynamicRouting,-};-#[cfg(all(feature = "v1", feature = "dynamic_routing"))]use helpers::{enable_decision_engine_dynamic_routing_setup, update_decision_engine_dynamic_routing_setup,};@@ -35,8 +27,6 @@ use hyperswitch_domain_models::{mandates, payment_address};use hyperswitch_masking::Secret;use payment_methods::helpers::StorageErrorExt;use rustc_hash::FxHashSet;-#[cfg(all(feature = "v1", feature = "dynamic_routing"))]-use storage_impl::redis::cache;#[cfg(feature = "payouts")]use super::payouts;@@ -2693,214 +2683,6 @@ pub async fn retrieve_dynamic_routing_volume_split(Ok(service_api::ApplicationResponse::Json(resp))}-// check if this needs to stay-#[cfg(all(feature = "v1", feature = "dynamic_routing"))]-pub async fn success_based_routing_update_configs(- state: SessionState,- request: routing_types::SuccessBasedRoutingConfig,- algorithm_id: common_utils::id_type::RoutingId,- profile_id: common_utils::id_type::ProfileId,-) -> RouterResponse<routing_types::RoutingDictionaryRecord> {- metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE.add(- 1,- router_env::metric_attributes!(- ("profile_id", profile_id.clone()),- (- "algorithm_type",- routing::DynamicRoutingType::SuccessRateBasedRouting.to_string()- )- ),- );- let db = state.store.as_ref();-- let dynamic_routing_algo_to_update = db- .find_routing_algorithm_by_profile_id_algorithm_id(&profile_id, &algorithm_id)- .await- .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;-- let mut config_to_update: routing::SuccessBasedRoutingConfig = dynamic_routing_algo_to_update- .algorithm_data- .parse_value::<routing::SuccessBasedRoutingConfig>("SuccessBasedRoutingConfig")- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("unable to deserialize algorithm data from routing table into SuccessBasedRoutingConfig")?;-- config_to_update.update(request);-- let updated_algorithm_id = common_utils::generate_routing_id_of_default_length();- let timestamp = common_utils::date_time::now();- let algo = RoutingAlgorithm {- algorithm_id: updated_algorithm_id,- profile_id: dynamic_routing_algo_to_update.profile_id,- merchant_id: dynamic_routing_algo_to_update.merchant_id,- name: dynamic_routing_algo_to_update.name,- description: dynamic_routing_algo_to_update.description,- kind: dynamic_routing_algo_to_update.kind,- algorithm_data: serde_json::json!(config_to_update.clone()),- created_at: timestamp,- modified_at: timestamp,- algorithm_for: dynamic_routing_algo_to_update.algorithm_for,- decision_engine_routing_id: None,- processor_merchant_id: dynamic_routing_algo_to_update.processor_merchant_id,- created_by: dynamic_routing_algo_to_update.created_by,- };- let record = db- .insert_routing_algorithm(algo)- .await- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Unable to insert record in routing algorithm table")?;-- // redact cache for success based routing configs- let cache_key = format!(- "{}_{}",- profile_id.get_string_repr(),- algorithm_id.get_string_repr()- );- let cache_entries_to_redact = vec![cache::CacheKind::SuccessBasedDynamicRoutingCache(- cache_key.into(),- )];- let _ = cache::redact_from_redis_and_publish(- &*state.store,- cache_entries_to_redact,- )- .await- .map_err(|e| router_env::logger::error!("unable to publish into the redact channel for evicting the success based routing config cache {e:?}"));-- let new_record = record.foreign_into();-- metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE_SUCCESS_RESPONSE.add(- 1,- router_env::metric_attributes!(("profile_id", profile_id.clone())),- );-- if !state.conf.open_router.dynamic_routing_enabled {- state- .grpc_client- .dynamic_routing- .as_ref()- .async_map(|dr_client| async {- dr_client- .success_rate_client- .invalidate_success_rate_routing_keys(- profile_id.get_string_repr().into(),- state.get_grpc_headers(),- )- .await- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Failed to invalidate the routing keys")- })- .await- .transpose()?;- }-- Ok(service_api::ApplicationResponse::Json(new_record))-}--#[cfg(all(feature = "v1", feature = "dynamic_routing"))]-pub async fn elimination_routing_update_configs(- state: SessionState,- request: routing_types::EliminationRoutingConfig,- algorithm_id: common_utils::id_type::RoutingId,- profile_id: common_utils::id_type::ProfileId,-) -> RouterResponse<routing_types::RoutingDictionaryRecord> {- metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE.add(- 1,- router_env::metric_attributes!(- ("profile_id", profile_id.clone()),- (- "algorithm_type",- routing::DynamicRoutingType::EliminationRouting.to_string()- )- ),- );-- let db = state.store.as_ref();-- let dynamic_routing_algo_to_update = db- .find_routing_algorithm_by_profile_id_algorithm_id(&profile_id, &algorithm_id)- .await- .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;-- let mut config_to_update: routing::EliminationRoutingConfig = dynamic_routing_algo_to_update- .algorithm_data- .parse_value::<routing::EliminationRoutingConfig>("EliminationRoutingConfig")- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable(- "unable to deserialize algorithm data from routing table into EliminationRoutingConfig",- )?;-- config_to_update.update(request);-- let updated_algorithm_id = common_utils::generate_routing_id_of_default_length();- let timestamp = common_utils::date_time::now();- let algo = RoutingAlgorithm {- algorithm_id: updated_algorithm_id,- profile_id: dynamic_routing_algo_to_update.profile_id,- merchant_id: dynamic_routing_algo_to_update.merchant_id,- name: dynamic_routing_algo_to_update.name,- description: dynamic_routing_algo_to_update.description,- kind: dynamic_routing_algo_to_update.kind,- algorithm_data: serde_json::json!(config_to_update),- created_at: timestamp,- modified_at: timestamp,- algorithm_for: dynamic_routing_algo_to_update.algorithm_for,- decision_engine_routing_id: None,- processor_merchant_id: dynamic_routing_algo_to_update.processor_merchant_id,- created_by: dynamic_routing_algo_to_update.created_by,- };-- let record = db- .insert_routing_algorithm(algo)- .await- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Unable to insert record in routing algorithm table")?;-- // redact cache for elimination routing configs- let cache_key = format!(- "{}_{}",- profile_id.get_string_repr(),- algorithm_id.get_string_repr()- );- let cache_entries_to_redact = vec![cache::CacheKind::EliminationBasedDynamicRoutingCache(- cache_key.into(),- )];-- cache::redact_from_redis_and_publish(- &*state.store,- cache_entries_to_redact,- )- .await- .map_err(|e| router_env::logger::error!("unable to publish into the redact channel for evicting the elimination routing config cache {e:?}")).ok();-- let new_record = record.foreign_into();-- metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE_SUCCESS_RESPONSE.add(- 1,- router_env::metric_attributes!(("profile_id", profile_id.clone())),- );-- if !state.conf.open_router.dynamic_routing_enabled {- state- .grpc_client- .dynamic_routing- .as_ref()- .async_map(|dr_client| async {- dr_client- .elimination_based_client- .invalidate_elimination_bucket(- profile_id.get_string_repr().into(),- state.get_grpc_headers(),- )- .await- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Failed to invalidate the elimination routing keys")- })- .await- .transpose()?;- }-- Ok(service_api::ApplicationResponse::Json(new_record))-}-#[cfg(all(feature = "v1", feature = "dynamic_routing"))]pub async fn contract_based_dynamic_routing_setup(state: SessionState,@@ -3060,117 +2842,6 @@ pub async fn contract_based_dynamic_routing_setup(Ok(service_api::ApplicationResponse::Json(new_record))}-#[cfg(all(feature = "v1", feature = "dynamic_routing"))]-pub async fn contract_based_routing_update_configs(- state: SessionState,- request: routing_types::ContractBasedRoutingConfig,- processor: domain::Processor,- algorithm_id: common_utils::id_type::RoutingId,- profile_id: common_utils::id_type::ProfileId,-) -> RouterResponse<routing_types::RoutingDictionaryRecord> {- metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE.add(- 1,- router_env::metric_attributes!(- ("profile_id", profile_id.get_string_repr().to_owned()),- (- "algorithm_type",- routing::DynamicRoutingType::ContractBasedRouting.to_string()- )- ),- );- let db = state.store.as_ref();-- let dynamic_routing_algo_to_update = db- .find_routing_algorithm_by_profile_id_algorithm_id(&profile_id, &algorithm_id)- .await- .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;-- let mut config_to_update: routing::ContractBasedRoutingConfig = dynamic_routing_algo_to_update- .algorithm_data- .parse_value::<routing::ContractBasedRoutingConfig>("ContractBasedRoutingConfig")- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("unable to deserialize algorithm data from routing table into ContractBasedRoutingConfig")?;-- // validate the contained mca_ids- if let Some(info_vec) = &request.label_info {- helpers::validate_contract_based_label_info(- db,- processor.get_account().get_id(),- &profile_id,- info_vec,- )- .await?;- }-- config_to_update.update(request);-- let updated_algorithm_id = common_utils::generate_routing_id_of_default_length();- let timestamp = common_utils::date_time::now();- let algo = RoutingAlgorithm {- algorithm_id: updated_algorithm_id,- profile_id: dynamic_routing_algo_to_update.profile_id,- merchant_id: dynamic_routing_algo_to_update.merchant_id,- name: dynamic_routing_algo_to_update.name,- description: dynamic_routing_algo_to_update.description,- kind: dynamic_routing_algo_to_update.kind,- algorithm_data: serde_json::json!(config_to_update),- created_at: timestamp,- modified_at: timestamp,- algorithm_for: dynamic_routing_algo_to_update.algorithm_for,- decision_engine_routing_id: None,- processor_merchant_id: dynamic_routing_algo_to_update.processor_merchant_id,- created_by: dynamic_routing_algo_to_update.created_by,- };- let record = db- .insert_routing_algorithm(algo)- .await- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Unable to insert record in routing algorithm table")?;-- // redact cache for contract based routing configs- let cache_key = format!(- "{}_{}",- profile_id.get_string_repr(),- algorithm_id.get_string_repr()- );- let cache_entries_to_redact = vec![cache::CacheKind::ContractBasedDynamicRoutingCache(- cache_key.into(),- )];- let _ = cache::redact_from_redis_and_publish(- &*state.store,- cache_entries_to_redact,- )- .await- .map_err(|e| router_env::logger::error!("unable to publish into the redact channel for evicting the contract based routing config cache {e:?}"));-- let new_record = record.foreign_into();-- metrics::ROUTING_UPDATE_CONFIG_FOR_PROFILE_SUCCESS_RESPONSE.add(- 1,- router_env::metric_attributes!(("profile_id", profile_id.get_string_repr().to_owned())),- );-- state- .grpc_client- .dynamic_routing- .as_ref()- .async_map(|dr_client| async {- dr_client- .contract_based_client- .invalidate_contracts(- profile_id.get_string_repr().into(),- state.get_grpc_headers(),- )- .await- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Failed to invalidate the contract based routing keys")- })- .await- .transpose()?;-- Ok(service_api::ApplicationResponse::Json(new_record))-}-#[async_trait]pub trait GetRoutableConnectorsForChoice {async fn get_routable_connectors<F, D>(diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rsindex 5ef8f7ad88..11ac95aee2 100644--- a/crates/router/src/routes/app.rs+++ b/crates/router/src/routes/app.rs@@ -2733,58 +2733,35 @@ impl Profile {#[cfg(feature = "dynamic_routing")]{- route = route.service(- web::scope("/{profile_id}/dynamic_routing")- .service(- web::scope("/success_based")- .service(+ route =+ route.service(+ web::scope("/{profile_id}/dynamic_routing")+ .service(+ web::scope("/success_based").service(web::resource("/create").route(web::post().to(routing::create_success_based_routing)),- )- .service(web::resource("/config/{algorithm_id}").route(- web::patch().to(|state, req, path, payload| {- routing::success_based_routing_update_configs(- state, req, path, payload,- )- }),- )),- )- .service(- web::resource("/set_volume_split")- .route(web::post().to(routing::set_dynamic_routing_volume_split)),- )- .service(- web::resource("/get_volume_split")- .route(web::get().to(routing::get_dynamic_routing_volume_split)),- )- .service(- web::scope("/elimination")- .service(+ ),+ )+ .service(+ web::resource("/set_volume_split")+ .route(web::post().to(routing::set_dynamic_routing_volume_split)),+ )+ .service(+ web::resource("/get_volume_split")+ .route(web::get().to(routing::get_dynamic_routing_volume_split)),+ )+ .service(+ web::scope("/elimination").service(web::resource("/create").route(web::post().to(routing::create_elimination_routing)),- )- .service(web::resource("config/{algorithm_id}").route(- web::patch().to(|state, req, path, payload| {- routing::elimination_routing_update_configs(- state, req, path, payload,- )- }),- )),- )- .service(- web::scope("/contracts")- .service(web::resource("/toggle").route(+ ),+ )+ .service(web::scope("/contracts").service(+ web::resource("/toggle").route(web::post().to(routing::contract_based_routing_setup_config),- ))- .service(web::resource("/config/{algorithm_id}").route(- web::patch().to(|state, req, path, payload| {- routing::contract_based_routing_update_configs(- state, req, path, payload,- )- }),- )),- ),- );+ ),+ )),+ );}route = route.service(diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rsindex 007f614690..803061031e 100644--- a/crates/router/src/routes/routing.rs+++ b/crates/router/src/routes/routing.rs@@ -1328,98 +1328,6 @@ pub async fn create_success_based_routing(.await}-#[cfg(all(feature = "olap", feature = "v1", feature = "dynamic_routing"))]-#[instrument(skip_all)]-pub async fn success_based_routing_update_configs(- state: web::Data<AppState>,- req: HttpRequest,- path: web::Path<routing_types::DynamicRoutingUpdateConfigQuery>,- json_payload: web::Json<routing_types::SuccessBasedRoutingConfig>,-) -> impl Responder {- let flow = Flow::UpdateDynamicRoutingConfigs;- let routing_payload_wrapper = routing_types::SuccessBasedRoutingPayloadWrapper {- updated_config: json_payload.into_inner(),- algorithm_id: path.clone().algorithm_id,- profile_id: path.clone().profile_id,- };- Box::pin(oss_api::server_wrap(- flow,- state,- &req,- routing_payload_wrapper.clone(),- |state, _, wrapper: routing_types::SuccessBasedRoutingPayloadWrapper, _| async {- Box::pin(routing::success_based_routing_update_configs(- state,- wrapper.updated_config,- wrapper.algorithm_id,- wrapper.profile_id,- ))- .await- },- auth::auth_type(- &auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: true,- allow_platform_self_operation: false,- }),- &auth::JWTAuthProfileFromRoute {- profile_id: routing_payload_wrapper.profile_id,- required_permission: Permission::ProfileRoutingWrite,- allow_connected: true,- allow_platform: false,- },- req.headers(),- ),- api_locking::LockAction::NotApplicable,- ))- .await-}--#[cfg(all(feature = "olap", feature = "v1", feature = "dynamic_routing"))]-#[instrument(skip_all)]-pub async fn elimination_routing_update_configs(- state: web::Data<AppState>,- req: HttpRequest,- path: web::Path<routing_types::DynamicRoutingUpdateConfigQuery>,- json_payload: web::Json<routing_types::EliminationRoutingConfig>,-) -> impl Responder {- let flow = Flow::UpdateDynamicRoutingConfigs;- let routing_payload_wrapper = routing_types::EliminationRoutingPayloadWrapper {- updated_config: json_payload.into_inner(),- algorithm_id: path.clone().algorithm_id,- profile_id: path.clone().profile_id,- };- Box::pin(oss_api::server_wrap(- flow,- state,- &req,- routing_payload_wrapper.clone(),- |state, _, wrapper: routing_types::EliminationRoutingPayloadWrapper, _| async {- Box::pin(routing::elimination_routing_update_configs(- state,- wrapper.updated_config,- wrapper.algorithm_id,- wrapper.profile_id,- ))- .await- },- auth::auth_type(- &auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: true,- allow_platform_self_operation: false,- }),- &auth::JWTAuthProfileFromRoute {- profile_id: routing_payload_wrapper.profile_id,- required_permission: Permission::ProfileRoutingWrite,- allow_connected: true,- allow_platform: false,- },- req.headers(),- ),- api_locking::LockAction::NotApplicable,- ))- .await-}-#[cfg(all(feature = "olap", feature = "v1", feature = "dynamic_routing"))]#[instrument(skip_all)]pub async fn contract_based_routing_setup_config(@@ -1471,56 +1379,6 @@ pub async fn contract_based_routing_setup_config(.await}-#[cfg(all(feature = "olap", feature = "v1", feature = "dynamic_routing"))]-#[instrument(skip_all)]-pub async fn contract_based_routing_update_configs(- state: web::Data<AppState>,- req: HttpRequest,- path: web::Path<routing_types::DynamicRoutingUpdateConfigQuery>,- json_payload: web::Json<routing_types::ContractBasedRoutingConfig>,-) -> impl Responder {- let flow = Flow::UpdateDynamicRoutingConfigs;- let routing_payload_wrapper = routing_types::ContractBasedRoutingPayloadWrapper {- updated_config: json_payload.into_inner(),- algorithm_id: path.algorithm_id.clone(),- profile_id: path.profile_id.clone(),- };- Box::pin(oss_api::server_wrap(- flow,- state,- &req,- routing_payload_wrapper.clone(),- |state,- auth: auth::AuthenticationData,- wrapper: routing_types::ContractBasedRoutingPayloadWrapper,- _| async move {- Box::pin(routing::contract_based_routing_update_configs(- state,- wrapper.updated_config,- auth.platform.get_processor().clone(),- wrapper.algorithm_id,- wrapper.profile_id,- ))- .await- },- auth::auth_type(- &auth::HeaderAuth(auth::ApiKeyAuth {- allow_connected_scope_operation: true,- allow_platform_self_operation: false,- }),- &auth::JWTAuthProfileFromRoute {- profile_id: routing_payload_wrapper.profile_id,- required_permission: Permission::ProfileRoutingWrite,- allow_connected: true,- allow_platform: false,- },- req.headers(),- ),- api_locking::LockAction::NotApplicable,- ))- .await-}-#[cfg(all(feature = "olap", feature = "v1", feature = "dynamic_routing"))]#[instrument(skip_all)]pub async fn create_elimination_routing(