From 33987a49d382eb78a3e0020238d8a9403e4a9d1c Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 29 Nov 2023 13:05:52 +0530 Subject: [PATCH 01/14] backwards compat for profile_specific routing removed --- crates/router/Cargo.toml | 5 +- crates/router/src/core/payments/routing.rs | 74 +++++++--------------- 2 files changed, 26 insertions(+), 53 deletions(-) diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index f0316d69249e..7ce04942fe52 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -9,13 +9,13 @@ readme = "README.md" license.workspace = true [features] -default = ["kv_store", "stripe", "oltp", "olap", "backwards_compatibility", "accounts_cache", "dummy_connector", "payouts", "profile_specific_fallback_routing", "retry"] +default = ["kv_store", "stripe", "oltp", "olap", "backwards_compatibility", "accounts_cache", "dummy_connector", "payouts", "retry"] s3 = ["dep:aws-sdk-s3", "dep:aws-config"] kms = ["external_services/kms", "dep:aws-config"] email = ["external_services/email", "dep:aws-config"] basilisk = ["kms"] stripe = ["dep:serde_qs"] -release = ["kms", "stripe", "basilisk", "s3", "email", "business_profile_routing", "accounts_cache", "kv_store", "profile_specific_fallback_routing"] +release = ["kms", "stripe", "basilisk", "s3", "email", "business_profile_routing", "accounts_cache", "kv_store", ] olap = ["data_models/olap", "storage_impl/olap", "scheduler/olap"] oltp = ["storage_impl/oltp"] kv_store = ["scheduler/kv_store"] @@ -24,7 +24,6 @@ openapi = ["olap", "oltp", "payouts"] vergen = ["router_env/vergen"] backwards_compatibility = ["api_models/backwards_compatibility"] business_profile_routing = ["api_models/business_profile_routing"] -profile_specific_fallback_routing = [] dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector", "kgraph_utils/dummy_connector"] connector_choice_mca_id = ["api_models/connector_choice_mca_id", "euclid/connector_choice_mca_id", "kgraph_utils/connector_choice_mca_id"] external_access_dc = ["dummy_connector"] diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index 841b48b9444a..8e0e1797b28c 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -72,10 +72,7 @@ pub struct SessionRoutingPmTypeInput<'a> { routing_algorithm: &'a MerchantAccountRoutingAlgorithm, backend_input: dsl_inputs::BackendInput, allowed_connectors: FxHashMap, - #[cfg(any( - feature = "business_profile_routing", - feature = "profile_specific_fallback_routing" - ))] + #[cfg(any(feature = "business_profile_routing",))] profile_id: Option, } static ROUTING_CACHE: StaticCache = StaticCache::new(); @@ -213,17 +210,12 @@ pub async fn perform_static_routing_v1( } else { let fallback_config = routing_helpers::get_merchant_default_config( &*state.clone().store, - #[cfg(not(feature = "profile_specific_fallback_routing"))] - merchant_id, - #[cfg(feature = "profile_specific_fallback_routing")] - { - payment_data - .payment_intent - .profile_id - .as_ref() - .get_required_value("profile_id") - .change_context(errors::RoutingError::ProfileIdMissing)? - }, + payment_data + .payment_intent + .profile_id + .as_ref() + .get_required_value("profile_id") + .change_context(errors::RoutingError::ProfileIdMissing)?, ) .await .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; @@ -634,17 +626,12 @@ pub async fn perform_fallback_routing( ) -> RoutingResult> { let fallback_config = routing_helpers::get_merchant_default_config( &*state.store, - #[cfg(not(feature = "profile_specific_fallback_routing"))] - &key_store.merchant_id, - #[cfg(feature = "profile_specific_fallback_routing")] - { - payment_data - .payment_intent - .profile_id - .as_ref() - .get_required_value("profile_id") - .change_context(errors::RoutingError::ProfileIdMissing)? - }, + payment_data + .payment_intent + .profile_id + .as_ref() + .get_required_value("profile_id") + .change_context(errors::RoutingError::ProfileIdMissing)?, ) .await .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; @@ -847,10 +834,7 @@ pub async fn perform_session_flow_routing( routing_algorithm: &routing_algorithm, backend_input: backend_input.clone(), allowed_connectors, - #[cfg(any( - feature = "business_profile_routing", - feature = "profile_specific_fallback_routing" - ))] + #[cfg(any(feature = "business_profile_routing",))] profile_id: session_input.payment_intent.profile_id.clone(), }; let maybe_choice = perform_session_routing_for_pm_type(session_pm_input).await?; @@ -911,16 +895,11 @@ async fn perform_session_routing_for_pm_type( } else { routing_helpers::get_merchant_default_config( &*session_pm_input.state.clone().store, - #[cfg(not(feature = "profile_specific_fallback_routing"))] - merchant_id, - #[cfg(feature = "profile_specific_fallback_routing")] - { - session_pm_input - .profile_id - .as_ref() - .get_required_value("profile_id") - .change_context(errors::RoutingError::ProfileIdMissing)? - }, + session_pm_input + .profile_id + .as_ref() + .get_required_value("profile_id") + .change_context(errors::RoutingError::ProfileIdMissing)?, ) .await .change_context(errors::RoutingError::FallbackConfigFetchFailed)? @@ -943,16 +922,11 @@ async fn perform_session_routing_for_pm_type( if final_selection.is_empty() { let fallback = routing_helpers::get_merchant_default_config( &*session_pm_input.state.clone().store, - #[cfg(not(feature = "profile_specific_fallback_routing"))] - merchant_id, - #[cfg(feature = "profile_specific_fallback_routing")] - { - session_pm_input - .profile_id - .as_ref() - .get_required_value("profile_id") - .change_context(errors::RoutingError::ProfileIdMissing)? - }, + session_pm_input + .profile_id + .as_ref() + .get_required_value("profile_id") + .change_context(errors::RoutingError::ProfileIdMissing)?, ) .await .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; From 8a00d8603c9de08c75cffb405b636e1635249c45 Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 29 Nov 2023 14:07:18 +0530 Subject: [PATCH 02/14] connector_choice_mca_id --- crates/api_models/Cargo.toml | 2 +- crates/api_models/src/routing.rs | 57 +---------- crates/euclid/Cargo.toml | 1 - crates/euclid/src/frontend/ast.rs | 2 - crates/euclid/src/frontend/dir.rs | 54 +---------- crates/euclid_wasm/Cargo.toml | 2 +- crates/euclid_wasm/src/lib.rs | 2 - crates/kgraph_utils/Cargo.toml | 2 +- crates/kgraph_utils/src/mca.rs | 6 +- crates/router/Cargo.toml | 1 - .../stripe/payment_intents/types.rs | 3 - .../stripe/setup_intents/types.rs | 4 +- crates/router/src/core/admin.rs | 4 +- .../router/src/core/payment_methods/cards.rs | 3 - crates/router/src/core/payments.rs | 94 ++++--------------- crates/router/src/core/payments/routing.rs | 8 -- .../src/core/payments/routing/transformers.rs | 2 - crates/router/src/core/routing.rs | 30 +++--- crates/router/src/core/routing/helpers.rs | 17 ---- crates/router/src/types/api/routing.rs | 2 - crates/router/src/types/storage.rs | 5 +- 21 files changed, 43 insertions(+), 258 deletions(-) diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml index 73c2d673c972..034e3c14d353 100644 --- a/crates/api_models/Cargo.toml +++ b/crates/api_models/Cargo.toml @@ -13,7 +13,7 @@ business_profile_routing = [] connector_choice_bcompat = [] errors = ["dep:actix-web", "dep:reqwest"] backwards_compatibility = ["connector_choice_bcompat"] -connector_choice_mca_id = ["euclid/connector_choice_mca_id"] + dummy_connector = ["euclid/dummy_connector"] detailed_errors = [] payouts = [] diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index 2236714da1d1..2419acbdc1e2 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -125,27 +125,17 @@ impl EuclidAnalysable for ConnectorSelection { .into_iter() .map(|connector_choice| { let connector_name = connector_choice.connector.to_string(); - #[cfg(not(feature = "connector_choice_mca_id"))] - let sub_label = connector_choice.sub_label.clone(); - #[cfg(feature = "connector_choice_mca_id")] let mca_id = connector_choice.merchant_connector_id.clone(); ( euclid::frontend::dir::DirValue::Connector(Box::new(connector_choice.into())), std::collections::HashMap::from_iter([( "CONNECTOR_SELECTION".to_string(), - #[cfg(feature = "connector_choice_mca_id")] serde_json::json!({ "rule_name": rule_name, "connector_name": connector_name, "mca_id": mca_id, }), - #[cfg(not(feature = "connector_choice_mca_id"))] - serde_json ::json!({ - "rule_name": rule_name, - "connector_name": connector_name, - "sub_label": sub_label, - }), )]), ) }) @@ -173,10 +163,7 @@ pub enum RoutableChoiceSerde { OnlyConnector(Box), FullStruct { connector: RoutableConnectors, - #[cfg(feature = "connector_choice_mca_id")] merchant_connector_id: Option, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: Option, }, } @@ -191,28 +178,13 @@ pub struct RoutableConnectorChoice { #[cfg(feature = "connector_choice_bcompat")] pub choice_kind: RoutableChoiceKind, pub connector: RoutableConnectors, - #[cfg(feature = "connector_choice_mca_id")] pub merchant_connector_id: Option, - #[cfg(not(feature = "connector_choice_mca_id"))] - pub sub_label: Option, } impl ToString for RoutableConnectorChoice { fn to_string(&self) -> String { - #[cfg(feature = "connector_choice_mca_id")] let base = self.connector.to_string(); - #[cfg(not(feature = "connector_choice_mca_id"))] - let base = { - let mut sub_base = self.connector.to_string(); - if let Some(ref label) = self.sub_label { - sub_base.push('_'); - sub_base.push_str(label); - } - - sub_base - }; - base } } @@ -220,16 +192,8 @@ impl ToString for RoutableConnectorChoice { #[cfg(feature = "connector_choice_bcompat")] impl PartialEq for RoutableConnectorChoice { fn eq(&self, other: &Self) -> bool { - #[cfg(not(feature = "connector_choice_mca_id"))] - { - self.connector.eq(&other.connector) && self.sub_label.eq(&other.sub_label) - } - - #[cfg(feature = "connector_choice_mca_id")] - { - self.connector.eq(&other.connector) - && self.merchant_connector_id.eq(&other.merchant_connector_id) - } + self.connector.eq(&other.connector) + && self.merchant_connector_id.eq(&other.merchant_connector_id) } } @@ -243,25 +207,19 @@ impl From for RoutableConnectorChoice { RoutableChoiceSerde::OnlyConnector(connector) => Self { choice_kind: RoutableChoiceKind::OnlyConnector, connector: *connector, - #[cfg(feature = "connector_choice_mca_id")] + merchant_connector_id: None, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: None, }, RoutableChoiceSerde::FullStruct { connector, - #[cfg(feature = "connector_choice_mca_id")] + merchant_connector_id, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label, } => Self { choice_kind: RoutableChoiceKind::FullStruct, connector, - #[cfg(feature = "connector_choice_mca_id")] + merchant_connector_id, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label, }, } } @@ -274,10 +232,7 @@ impl From for RoutableChoiceSerde { RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)), RoutableChoiceKind::FullStruct => Self::FullStruct { connector: value.connector, - #[cfg(feature = "connector_choice_mca_id")] merchant_connector_id: value.merchant_connector_id, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: value.sub_label, }, } } @@ -287,8 +242,6 @@ impl From for ast::ConnectorChoice { fn from(value: RoutableConnectorChoice) -> Self { Self { connector: value.connector, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: value.sub_label, } } } diff --git a/crates/euclid/Cargo.toml b/crates/euclid/Cargo.toml index 859795964145..9ae8ca741632 100644 --- a/crates/euclid/Cargo.toml +++ b/crates/euclid/Cargo.toml @@ -24,7 +24,6 @@ euclid_macros = { version = "0.1.0", path = "../euclid_macros" } [features] ast_parser = ["dep:nom"] valued_jit = [] -connector_choice_mca_id = [] dummy_connector = [] [dev-dependencies] diff --git a/crates/euclid/src/frontend/ast.rs b/crates/euclid/src/frontend/ast.rs index 0dad9b53c323..e6a0a8308f9b 100644 --- a/crates/euclid/src/frontend/ast.rs +++ b/crates/euclid/src/frontend/ast.rs @@ -10,8 +10,6 @@ use crate::types::{DataType, Metadata}; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] pub struct ConnectorChoice { pub connector: RoutableConnectors, - #[cfg(not(feature = "connector_choice_mca_id"))] - pub sub_label: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] diff --git a/crates/euclid/src/frontend/dir.rs b/crates/euclid/src/frontend/dir.rs index f8cef1f92955..c41c00329ffa 100644 --- a/crates/euclid/src/frontend/dir.rs +++ b/crates/euclid/src/frontend/dir.rs @@ -8,7 +8,6 @@ use strum::IntoEnumIterator; use crate::{enums as euclid_enums, frontend::ast, types}; #[macro_export] -#[cfg(feature = "connector_choice_mca_id")] macro_rules! dirval { (Connector = $name:ident) => { $crate::frontend::dir::DirValue::Connector(Box::new( @@ -45,53 +44,6 @@ macro_rules! dirval { }}; } -#[macro_export] -#[cfg(not(feature = "connector_choice_mca_id"))] -macro_rules! dirval { - (Connector = $name:ident) => { - $crate::frontend::dir::DirValue::Connector(Box::new( - $crate::frontend::ast::ConnectorChoice { - connector: $crate::enums::RoutableConnectors::$name, - sub_label: None, - }, - )) - }; - - (Connector = ($name:ident, $sub_label:literal)) => { - $crate::frontend::dir::DirValue::Connector(Box::new( - $crate::frontend::ast::ConnectorChoice { - connector: $crate::enums::RoutableConnectors::$name, - sub_label: Some($sub_label.to_string()), - }, - )) - }; - - ($key:ident = $val:ident) => {{ - pub use $crate::frontend::dir::enums::*; - - $crate::frontend::dir::DirValue::$key($key::$val) - }}; - - ($key:ident = $num:literal) => {{ - $crate::frontend::dir::DirValue::$key($crate::types::NumValue { - number: $num, - refinement: None, - }) - }}; - - ($key:ident s= $str:literal) => {{ - $crate::frontend::dir::DirValue::$key($crate::types::StrValue { - value: $str.to_string(), - }) - }}; - ($key:literal = $str:literal) => {{ - $crate::frontend::dir::DirValue::MetaData($crate::types::MetadataValue { - key: $key.to_string(), - value: $str.to_string(), - }) - }}; -} - #[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize)] pub struct DirKey { pub kind: DirKeyKind, @@ -466,11 +418,7 @@ impl DirKeyKind { Self::Connector => Some( common_enums::RoutableConnectors::iter() .map(|connector| { - DirValue::Connector(Box::new(ast::ConnectorChoice { - connector, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: None, - })) + DirValue::Connector(Box::new(ast::ConnectorChoice { connector })) }) .collect(), ), diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index 8c96a7f67da2..2e86357a6af6 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib"] [features] default = ["connector_choice_bcompat"] connector_choice_bcompat = ["api_models/connector_choice_bcompat"] -connector_choice_mca_id = ["api_models/connector_choice_mca_id", "euclid/connector_choice_mca_id", "kgraph_utils/connector_choice_mca_id"] + dummy_connector = ["kgraph_utils/dummy_connector"] [dependencies] diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs index cab82f8ce411..6b797136b691 100644 --- a/crates/euclid_wasm/src/lib.rs +++ b/crates/euclid_wasm/src/lib.rs @@ -81,8 +81,6 @@ pub fn seed_knowledge_graph(mcas: JsValue) -> JsResult { .map(|mca| { Ok::<_, strum::ParseError>(ast::ConnectorChoice { connector: RoutableConnectors::from_str(&mca.connector_name)?, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: mca.business_sub_label.clone(), }) }) .collect::>() diff --git a/crates/kgraph_utils/Cargo.toml b/crates/kgraph_utils/Cargo.toml index 44a73dae4d77..1e38b203c94d 100644 --- a/crates/kgraph_utils/Cargo.toml +++ b/crates/kgraph_utils/Cargo.toml @@ -7,7 +7,7 @@ rust-version.workspace = true [features] dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector"] -connector_choice_mca_id = ["api_models/connector_choice_mca_id", "euclid/connector_choice_mca_id"] + [dependencies] api_models = { version = "0.1.0", path = "../api_models", package = "api_models" } diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs index 0e224a8f3d9d..304c86ee8a09 100644 --- a/crates/kgraph_utils/src/mca.rs +++ b/crates/kgraph_utils/src/mca.rs @@ -293,11 +293,7 @@ fn compile_merchant_connector_graph( .make_any_aggregator(&agg_nodes, Some(aggregator_info), None::<()>, Vec::new()) .map_err(KgraphError::GraphConstructionError)?; - let connector_dir_val = dir::DirValue::Connector(Box::new(ast::ConnectorChoice { - connector, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: mca.business_sub_label, - })); + let connector_dir_val = dir::DirValue::Connector(Box::new(ast::ConnectorChoice { connector })); let connector_info = "Connector"; let connector_node_id = builder diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 7ce04942fe52..8eb9a06661ea 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -25,7 +25,6 @@ vergen = ["router_env/vergen"] backwards_compatibility = ["api_models/backwards_compatibility"] business_profile_routing = ["api_models/business_profile_routing"] dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector", "kgraph_utils/dummy_connector"] -connector_choice_mca_id = ["api_models/connector_choice_mca_id", "euclid/connector_choice_mca_id", "kgraph_utils/connector_choice_mca_id"] external_access_dc = ["dummy_connector"] detailed_errors = ["api_models/detailed_errors", "error-stack/serde"] payouts = [] diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index 3c7d5f2918f1..7188a8153da2 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -287,10 +287,7 @@ impl TryFrom for payments::PaymentsRequest { #[cfg(feature = "backwards_compatibility")] choice_kind: api_models::routing::RoutableChoiceKind::FullStruct, connector, - #[cfg(feature = "connector_choice_mca_id")] merchant_connector_id: None, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: None, }, )) }) diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs index 9d3f74af8cb8..3d8364ca62f6 100644 --- a/crates/router/src/compatibility/stripe/setup_intents/types.rs +++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs @@ -190,10 +190,8 @@ impl TryFrom for payments::PaymentsRequest { #[cfg(feature = "backwards_compatibility")] choice_kind: api_models::routing::RoutableChoiceKind::FullStruct, connector, - #[cfg(feature = "connector_choice_mca_id")] + merchant_connector_id: None, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: None, }, )) }) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 107e8f8859d6..ab48f4665871 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -945,10 +945,8 @@ pub async fn create_payment_connector( #[cfg(feature = "backwards_compatibility")] choice_kind: routing_types::RoutableChoiceKind::FullStruct, connector: routable_connector_val, - #[cfg(feature = "connector_choice_mca_id")] + merchant_connector_id: Some(mca.merchant_connector_id.clone()), - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: req.business_sub_label, }; if !default_routing_config.contains(&choice) { diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 044e270a7ea9..c20510b44233 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -1129,10 +1129,7 @@ pub async fn list_payment_methods( .into_report() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("")?, - #[cfg(feature = "connector_choice_mca_id")] merchant_connector_id: choice.connector.merchant_connector_id, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: choice.sub_label, }; pre_routing_results.insert(pm_type, routable_choice); diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index db83dce487a6..502ff99d3c96 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -2322,10 +2322,9 @@ where let mut routing_data = storage::RoutingData { routed_through: payment_data.payment_attempt.connector.clone(), - #[cfg(feature = "connector_choice_mca_id")] + merchant_connector_id: payment_data.payment_attempt.merchant_connector_id.clone(), - #[cfg(not(feature = "connector_choice_mca_id"))] - business_sub_label: payment_data.payment_attempt.business_sub_label.clone(), + algorithm: request_straight_through.clone(), routing_info: payment_data .payment_attempt @@ -2359,14 +2358,8 @@ where .attach_printable("error serializing payment routing info to serde value")?; payment_data.payment_attempt.connector = routing_data.routed_through; - #[cfg(feature = "connector_choice_mca_id")] - { - payment_data.payment_attempt.merchant_connector_id = routing_data.merchant_connector_id; - } - #[cfg(not(feature = "connector_choice_mca_id"))] - { - payment_data.payment_attempt.business_sub_label = routing_data.business_sub_label; - } + + payment_data.payment_attempt.merchant_connector_id = routing_data.merchant_connector_id; payment_data.payment_attempt.straight_through_algorithm = Some(encoded_info); Ok(decided_connector) @@ -2409,20 +2402,16 @@ where &state.conf.connectors, &mandate_connector_details.connector, api::GetToken::Connector, - #[cfg(feature = "connector_choice_mca_id")] mandate_connector_details.merchant_connector_id.clone(), - #[cfg(not(feature = "connector_choice_mca_id"))] - None, ) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received in 'routed_through'")?; routing_data.routed_through = Some(mandate_connector_details.connector.clone()); - #[cfg(feature = "connector_choice_mca_id")] - { - routing_data.merchant_connector_id = - mandate_connector_details.merchant_connector_id.clone(); - } + + routing_data.merchant_connector_id = + mandate_connector_details.merchant_connector_id.clone(); + return Ok(api::ConnectorCallType::PreDetermined(connector_data)); } @@ -2437,23 +2426,15 @@ where &state.conf.connectors, &choice.connector.to_string(), api::GetToken::Connector, - #[cfg(feature = "connector_choice_mca_id")] choice.merchant_connector_id.clone(), - #[cfg(not(feature = "connector_choice_mca_id"))] - None, ) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received")?; routing_data.routed_through = Some(choice.connector.to_string()); - #[cfg(feature = "connector_choice_mca_id")] - { - routing_data.merchant_connector_id = choice.merchant_connector_id.clone(); - } - #[cfg(not(feature = "connector_choice_mca_id"))] - { - routing_data.business_sub_label = choice.sub_label.clone(); - } + + routing_data.merchant_connector_id = choice.merchant_connector_id.clone(); + return Ok(api::ConnectorCallType::PreDetermined(connector_data)); } } @@ -2494,10 +2475,7 @@ where &state.conf.connectors, &conn.connector.to_string(), api::GetToken::Connector, - #[cfg(feature = "connector_choice_mca_id")] conn.merchant_connector_id.clone(), - #[cfg(not(feature = "connector_choice_mca_id"))] - None, ) }) .collect::, _>>() @@ -2505,14 +2483,9 @@ where .attach_printable("Invalid connector name received")?; routing_data.routed_through = Some(first_connector_choice.connector.to_string()); - #[cfg(feature = "connector_choice_mca_id")] - { - routing_data.merchant_connector_id = first_connector_choice.merchant_connector_id; - } - #[cfg(not(feature = "connector_choice_mca_id"))] - { - routing_data.business_sub_label = first_connector_choice.sub_label.clone(); - } + + routing_data.merchant_connector_id = first_connector_choice.merchant_connector_id; + routing_data.routing_info.algorithm = Some(routing_algorithm); return Ok(api::ConnectorCallType::Retryable(connector_data)); } @@ -2553,10 +2526,7 @@ where &state.conf.connectors, &conn.connector.to_string(), api::GetToken::Connector, - #[cfg(feature = "connector_choice_mca_id")] conn.merchant_connector_id, - #[cfg(not(feature = "connector_choice_mca_id"))] - None, ) }) .collect::, _>>() @@ -2564,14 +2534,9 @@ where .attach_printable("Invalid connector name received")?; routing_data.routed_through = Some(first_connector_choice.connector.to_string()); - #[cfg(feature = "connector_choice_mca_id")] - { - routing_data.merchant_connector_id = first_connector_choice.merchant_connector_id; - } - #[cfg(not(feature = "connector_choice_mca_id"))] - { - routing_data.business_sub_label = first_connector_choice.sub_label; - } + + routing_data.merchant_connector_id = first_connector_choice.merchant_connector_id; + return Ok(api::ConnectorCallType::Retryable(connector_data)); } @@ -2685,19 +2650,6 @@ where let mut final_list: Vec = Vec::new(); - #[cfg(not(feature = "connector_choice_mca_id"))] - for mut connector_data in connectors { - if !routing_enabled_pms.contains(&connector_data.payment_method_type) { - final_list.push(connector_data); - } else if let Some(choice) = result.get(&connector_data.payment_method_type) { - if connector_data.connector.connector_name == choice.connector.connector_name { - connector_data.business_sub_label = choice.sub_label.clone(); - final_list.push(connector_data); - } - } - } - - #[cfg(feature = "connector_choice_mca_id")] for connector_data in connectors { if !routing_enabled_pms.contains(&connector_data.payment_method_type) { final_list.push(connector_data); @@ -2768,14 +2720,7 @@ where routing_data.routed_through = Some(first_connector_choice.connector.to_string()); - #[cfg(feature = "connector_choice_mca_id")] - { - routing_data.merchant_connector_id = first_connector_choice.merchant_connector_id; - } - #[cfg(not(feature = "connector_choice_mca_id"))] - { - routing_data.business_sub_label = first_connector_choice.sub_label; - } + routing_data.merchant_connector_id = first_connector_choice.merchant_connector_id; let connector_data = connectors .into_iter() @@ -2784,10 +2729,7 @@ where &state.conf.connectors, &conn.connector.to_string(), api::GetToken::Connector, - #[cfg(feature = "connector_choice_mca_id")] conn.merchant_connector_id, - #[cfg(not(feature = "connector_choice_mca_id"))] - None, ) }) .collect::, _>>() diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index 8e0e1797b28c..5bef291afcb8 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -845,8 +845,6 @@ pub async fn perform_session_flow_routing( pm_type, routing_types::SessionRoutingChoice { connector: data.0, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: data.1, payment_method_type: pm_type, }, ); @@ -953,15 +951,9 @@ async fn perform_session_routing_for_pm_type( &session_pm_input.state.clone().conf.connectors, &connector_name, get_token.clone(), - #[cfg(feature = "connector_choice_mca_id")] selection.merchant_connector_id, - #[cfg(not(feature = "connector_choice_mca_id"))] - None, ) .change_context(errors::RoutingError::InvalidConnectorName(connector_name))?; - #[cfg(not(feature = "connector_choice_mca_id"))] - let sub_label = selection.sub_label; - #[cfg(feature = "connector_choice_mca_id")] let sub_label = None; final_choice = Some((connector_data, sub_label)); diff --git a/crates/router/src/core/payments/routing/transformers.rs b/crates/router/src/core/payments/routing/transformers.rs index b273f18f3fd8..208308da1e5a 100644 --- a/crates/router/src/core/payments/routing/transformers.rs +++ b/crates/router/src/core/payments/routing/transformers.rs @@ -10,8 +10,6 @@ impl ForeignFrom for dsl_ast::ConnectorC // #[cfg(feature = "backwards_compatibility")] // choice_kind: from.choice_kind.foreign_into(), connector: from.connector, - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: from.sub_label, } } } diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index e9ddcb4a5632..f257e4ab5d99 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -826,25 +826,17 @@ pub async fn update_default_routing_config_for_profile( .into_report() })?; - let existing_set = FxHashSet::from_iter(default_config.iter().map(|c| { - ( - c.connector.to_string(), - #[cfg(feature = "connector_choice_mca_id")] - c.merchant_connector_id.as_ref(), - #[cfg(not(feature = "connector_choice_mca_id"))] - c.sub_label.as_ref(), - ) - })); - - let updated_set = FxHashSet::from_iter(updated_config.iter().map(|c| { - ( - c.connector.to_string(), - #[cfg(feature = "connector_choice_mca_id")] - c.merchant_connector_id.as_ref(), - #[cfg(not(feature = "connector_choice_mca_id"))] - c.sub_label.as_ref(), - ) - })); + let existing_set = FxHashSet::from_iter( + default_config + .iter() + .map(|c| (c.connector.to_string(), c.merchant_connector_id.as_ref())), + ); + + let updated_set = FxHashSet::from_iter( + updated_config + .iter() + .map(|c| (c.connector.to_string(), c.merchant_connector_id.as_ref())), + ); let symmetric_diff = existing_set .symmetric_difference(&updated_set) diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs index 6eec39f53bc6..58613db3c419 100644 --- a/crates/router/src/core/routing/helpers.rs +++ b/crates/router/src/core/routing/helpers.rs @@ -349,7 +349,6 @@ pub async fn validate_connectors_in_routing_config( id: merchant_id.to_string(), })?; - #[cfg(feature = "connector_choice_mca_id")] let name_mca_id_set = all_mcas .iter() .filter(|mca| mca.profile_id.as_deref() == Some(profile_id)) @@ -362,7 +361,6 @@ pub async fn validate_connectors_in_routing_config( .map(|mca| &mca.connector_name) .collect::>(); - #[cfg(feature = "connector_choice_mca_id")] let check_connector_choice = |choice: &routing_types::RoutableConnectorChoice| { if let Some(ref mca_id) = choice.merchant_connector_id { error_stack::ensure!( @@ -390,21 +388,6 @@ pub async fn validate_connectors_in_routing_config( Ok(()) }; - #[cfg(not(feature = "connector_choice_mca_id"))] - let check_connector_choice = |choice: &routing_types::RoutableConnectorChoice| { - error_stack::ensure!( - name_set.contains(&choice.connector.to_string()), - errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "connector with name '{}' not found for the given profile", - choice.connector, - ) - } - ); - - Ok(()) - }; - match routing_algorithm { routing_types::RoutingAlgorithm::Single(choice) => { check_connector_choice(choice)?; diff --git a/crates/router/src/types/api/routing.rs b/crates/router/src/types/api/routing.rs index faafac76e3dc..a0629c03e0f5 100644 --- a/crates/router/src/types/api/routing.rs +++ b/crates/router/src/types/api/routing.rs @@ -13,8 +13,6 @@ use super::types::api as api_oss; pub struct SessionRoutingChoice { pub connector: api_oss::ConnectorData, - #[cfg(not(feature = "connector_choice_mca_id"))] - pub sub_label: Option, pub payment_method_type: api_enums::PaymentMethodType, } diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rs index e3e19323357b..d988491e95c0 100644 --- a/crates/router/src/types/storage.rs +++ b/crates/router/src/types/storage.rs @@ -53,10 +53,9 @@ use crate::types::api::routing; #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct RoutingData { pub routed_through: Option, - #[cfg(feature = "connector_choice_mca_id")] + pub merchant_connector_id: Option, - #[cfg(not(feature = "connector_choice_mca_id"))] - pub business_sub_label: Option, + pub routing_info: PaymentRoutingInfo, pub algorithm: Option, } From 63987d3fab0821fd496a4ac1e48722c1d44c1617 Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 29 Nov 2023 16:28:30 +0530 Subject: [PATCH 03/14] remove business_profile_routing as backwards compat --- crates/api_models/Cargo.toml | 2 - crates/api_models/src/events/routing.rs | 6 +- crates/api_models/src/routing.rs | 5 +- crates/router/Cargo.toml | 5 +- crates/router/src/core/payments.rs | 9 +- crates/router/src/core/payments/routing.rs | 89 +- crates/router/src/core/routing.rs | 787 +++++------------- .../router/src/core/routing/transformers.rs | 6 +- crates/router/src/routes/routing.rs | 224 ++--- 9 files changed, 311 insertions(+), 822 deletions(-) diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml index 034e3c14d353..c6c23f78c7d2 100644 --- a/crates/api_models/Cargo.toml +++ b/crates/api_models/Cargo.toml @@ -9,11 +9,9 @@ license.workspace = true [features] default = ["payouts"] -business_profile_routing = [] connector_choice_bcompat = [] errors = ["dep:actix-web", "dep:reqwest"] backwards_compatibility = ["connector_choice_bcompat"] - dummy_connector = ["euclid/dummy_connector"] detailed_errors = [] payouts = [] diff --git a/crates/api_models/src/events/routing.rs b/crates/api_models/src/events/routing.rs index a09735bc5722..1f068678c598 100644 --- a/crates/api_models/src/events/routing.rs +++ b/crates/api_models/src/events/routing.rs @@ -3,10 +3,8 @@ use common_utils::events::{ApiEventMetric, ApiEventsType}; use crate::routing::{ LinkedRoutingConfigRetrieveResponse, MerchantRoutingAlgorithm, ProfileDefaultRoutingConfig, RoutingAlgorithmId, RoutingConfigRequest, RoutingDictionaryRecord, RoutingKind, - RoutingPayloadWrapper, + RoutingPayloadWrapper, RoutingRetrieveLinkQuery, RoutingRetrieveQuery, }; -#[cfg(feature = "business_profile_routing")] -use crate::routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery}; impl ApiEventMetric for RoutingKind { fn get_api_event_type(&self) -> Option { @@ -49,7 +47,6 @@ impl ApiEventMetric for ProfileDefaultRoutingConfig { } } -#[cfg(feature = "business_profile_routing")] impl ApiEventMetric for RoutingRetrieveQuery { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Routing) @@ -62,7 +59,6 @@ impl ApiEventMetric for RoutingConfigRequest { } } -#[cfg(feature = "business_profile_routing")] impl ApiEventMetric for RoutingRetrieveLinkQuery { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Routing) diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index 2419acbdc1e2..01928c44f848 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -45,7 +45,6 @@ pub struct ProfileDefaultRoutingConfig { pub connectors: Vec, } -#[cfg(feature = "business_profile_routing")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct RoutingRetrieveQuery { pub limit: Option, @@ -54,7 +53,6 @@ pub struct RoutingRetrieveQuery { pub profile_id: Option, } -#[cfg(feature = "business_profile_routing")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct RoutingRetrieveLinkQuery { pub profile_id: Option, @@ -75,7 +73,6 @@ pub enum LinkedRoutingConfigRetrieveResponse { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct MerchantRoutingAlgorithm { pub id: String, - #[cfg(feature = "business_profile_routing")] pub profile_id: String, pub name: String, pub description: String, @@ -473,7 +470,7 @@ impl RoutingAlgorithmRef { pub struct RoutingDictionaryRecord { pub id: String, - #[cfg(feature = "business_profile_routing")] + pub profile_id: String, pub name: String, pub kind: RoutingAlgorithmKind, diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 8eb9a06661ea..afc00dd71d03 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -9,13 +9,13 @@ readme = "README.md" license.workspace = true [features] -default = ["kv_store", "stripe", "oltp", "olap", "backwards_compatibility", "accounts_cache", "dummy_connector", "payouts", "retry"] +default = ["kv_store", "stripe", "oltp", "olap","backwards_compatibility", "accounts_cache", "dummy_connector", "payouts", "retry"] s3 = ["dep:aws-sdk-s3", "dep:aws-config"] kms = ["external_services/kms", "dep:aws-config"] email = ["external_services/email", "dep:aws-config"] basilisk = ["kms"] stripe = ["dep:serde_qs"] -release = ["kms", "stripe", "basilisk", "s3", "email", "business_profile_routing", "accounts_cache", "kv_store", ] +release = ["kms", "stripe", "basilisk", "s3", "email", "accounts_cache", "kv_store", ] olap = ["data_models/olap", "storage_impl/olap", "scheduler/olap"] oltp = ["storage_impl/oltp"] kv_store = ["scheduler/kv_store"] @@ -23,7 +23,6 @@ accounts_cache = [] openapi = ["olap", "oltp", "payouts"] vergen = ["router_env/vergen"] backwards_compatibility = ["api_models/backwards_compatibility"] -business_profile_routing = ["api_models/business_profile_routing"] dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector", "kgraph_utils/dummy_connector"] external_access_dc = ["dummy_connector"] detailed_errors = ["api_models/detailed_errors", "error-stack/serde"] diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 502ff99d3c96..4eb4f0a0096c 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -2453,7 +2453,6 @@ where connectors, payment_data, eligible_connectors, - #[cfg(feature = "business_profile_routing")] payment_data.payment_intent.profile_id.clone(), ) .await @@ -2504,7 +2503,6 @@ where connectors, payment_data, eligible_connectors, - #[cfg(feature = "business_profile_routing")] payment_data.payment_intent.profile_id.clone(), ) .await @@ -2675,11 +2673,7 @@ pub async fn route_connector_v1( where F: Send + Clone, { - let routing_algorithm = if cfg!(feature = "business_profile_routing") { - business_profile.routing_algorithm.clone() - } else { - merchant_account.routing_algorithm.clone() - }; + let routing_algorithm = business_profile.routing_algorithm.clone(); let algorithm_ref = routing_algorithm .map(|ra| ra.parse_value::("RoutingAlgorithmRef")) @@ -2704,7 +2698,6 @@ where connectors, payment_data, eligible_connectors, - #[cfg(feature = "business_profile_routing")] payment_data.payment_intent.profile_id.clone(), ) .await diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index 5bef291afcb8..f84abdad102d 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -32,8 +32,6 @@ use rand::{ }; use rustc_hash::FxHashMap; -#[cfg(not(feature = "business_profile_routing"))] -use crate::utils::StringExt; use crate::{ core::{ errors as oss_errors, errors, payments as payments_oss, routing::helpers as routing_helpers, @@ -72,7 +70,6 @@ pub struct SessionRoutingPmTypeInput<'a> { routing_algorithm: &'a MerchantAccountRoutingAlgorithm, backend_input: dsl_inputs::BackendInput, allowed_connectors: FxHashMap, - #[cfg(any(feature = "business_profile_routing",))] profile_id: Option, } static ROUTING_CACHE: StaticCache = StaticCache::new(); @@ -227,7 +224,6 @@ pub async fn perform_static_routing_v1( merchant_id, algorithm_ref.timestamp, &algorithm_id, - #[cfg(feature = "business_profile_routing")] payment_data.payment_intent.profile_id.clone(), ) .await?; @@ -258,9 +254,8 @@ async fn ensure_algorithm_cached_v1( merchant_id: &str, timestamp: i64, algorithm_id: &str, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult { - #[cfg(feature = "business_profile_routing")] let key = { let profile_id = profile_id .clone() @@ -270,9 +265,6 @@ async fn ensure_algorithm_cached_v1( format!("routing_config_{merchant_id}_{profile_id}") }; - #[cfg(not(feature = "business_profile_routing"))] - let key = format!("dsl_{merchant_id}"); - let present = ROUTING_CACHE .present(&key) .into_report() @@ -286,15 +278,7 @@ async fn ensure_algorithm_cached_v1( .attach_printable("Error checking expiry of DSL in cache")?; if !present || expired { - refresh_routing_cache_v1( - state, - key.clone(), - algorithm_id, - timestamp, - #[cfg(feature = "business_profile_routing")] - profile_id, - ) - .await?; + refresh_routing_cache_v1(state, key.clone(), algorithm_id, timestamp, profile_id).await?; }; Ok(key) @@ -350,9 +334,8 @@ pub async fn refresh_routing_cache_v1( key: String, algorithm_id: &str, timestamp: i64, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult<()> { - #[cfg(feature = "business_profile_routing")] let algorithm = { let algorithm = state .store @@ -369,22 +352,6 @@ pub async fn refresh_routing_cache_v1( algorithm }; - #[cfg(not(feature = "business_profile_routing"))] - let algorithm = { - let config = state - .store - .find_config_by_key(algorithm_id) - .await - .change_context(errors::RoutingError::DslMissingInDb) - .attach_printable("DSL not found in DB")?; - - let algorithm: routing_types::RoutingAlgorithm = config - .config - .parse_struct("Program") - .change_context(errors::RoutingError::DslParsingError) - .attach_printable("Error parsing routing algorithm from configs")?; - algorithm - }; let cached_algorithm = match algorithm { routing_types::RoutingAlgorithm::Single(conn) => CachedAlgorithm::Single(conn), routing_types::RoutingAlgorithm::Priority(plist) => CachedAlgorithm::Priority(plist), @@ -450,9 +417,8 @@ pub async fn get_merchant_kgraph<'a>( state: &AppState, key_store: &domain::MerchantKeyStore, merchant_last_modified: i64, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult>> { - #[cfg(feature = "business_profile_routing")] let key = { let profile_id = profile_id .clone() @@ -462,9 +428,6 @@ pub async fn get_merchant_kgraph<'a>( format!("kgraph_{}_{profile_id}", key_store.merchant_id) }; - #[cfg(not(feature = "business_profile_routing"))] - let key = format!("kgraph_{}", key_store.merchant_id); - let kgraph_present = KGRAPH_CACHE .present(&key) .into_report() @@ -483,7 +446,6 @@ pub async fn get_merchant_kgraph<'a>( key_store, merchant_last_modified, key.clone(), - #[cfg(feature = "business_profile_routing")] profile_id, ) .await?; @@ -503,7 +465,7 @@ pub async fn refresh_kgraph_cache( key_store: &domain::MerchantKeyStore, timestamp: i64, key: String, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult<()> { let mut merchant_connector_accounts = state .store @@ -518,7 +480,6 @@ pub async fn refresh_kgraph_cache( merchant_connector_accounts .retain(|mca| mca.connector_type != storage_enums::ConnectorType::PaymentVas); - #[cfg(feature = "business_profile_routing")] let merchant_connector_accounts = payments_oss::helpers::filter_mca_based_on_business_profile( merchant_connector_accounts, profile_id, @@ -551,7 +512,7 @@ async fn perform_kgraph_filtering( chosen: Vec, backend_input: dsl_inputs::BackendInput, eligible_connectors: Option<&Vec>, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult> { let context = euclid_graph::AnalysisContext::from_dir_values( backend_input @@ -559,14 +520,8 @@ async fn perform_kgraph_filtering( .into_report() .change_context(errors::RoutingError::KgraphAnalysisError)?, ); - let cached_kgraph = get_merchant_kgraph( - state, - key_store, - merchant_last_modified, - #[cfg(feature = "business_profile_routing")] - profile_id, - ) - .await?; + let cached_kgraph = + get_merchant_kgraph(state, key_store, merchant_last_modified, profile_id).await?; let mut final_selection = Vec::::new(); for choice in chosen { @@ -599,7 +554,7 @@ pub async fn perform_eligibility_analysis( chosen: Vec, payment_data: &payments_oss::PaymentData, eligible_connectors: Option<&Vec>, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult> { let backend_input = make_dsl_input(payment_data)?; @@ -610,7 +565,6 @@ pub async fn perform_eligibility_analysis( chosen, backend_input, eligible_connectors, - #[cfg(feature = "business_profile_routing")] profile_id, ) .await @@ -622,7 +576,7 @@ pub async fn perform_fallback_routing( merchant_last_modified: i64, payment_data: &payments_oss::PaymentData, eligible_connectors: Option<&Vec>, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult> { let fallback_config = routing_helpers::get_merchant_default_config( &*state.store, @@ -644,7 +598,6 @@ pub async fn perform_fallback_routing( fallback_config, backend_input, eligible_connectors, - #[cfg(feature = "business_profile_routing")] profile_id, ) .await @@ -657,7 +610,7 @@ pub async fn perform_eligibility_analysis_with_fallback( chosen: Vec, payment_data: &payments_oss::PaymentData, eligible_connectors: Option>, - #[cfg(feature = "business_profile_routing")] profile_id: Option, + profile_id: Option, ) -> RoutingResult> { let mut final_selection = perform_eligibility_analysis( state, @@ -666,7 +619,6 @@ pub async fn perform_eligibility_analysis_with_fallback( chosen, payment_data, eligible_connectors.as_ref(), - #[cfg(feature = "business_profile_routing")] profile_id.clone(), ) .await?; @@ -677,7 +629,6 @@ pub async fn perform_eligibility_analysis_with_fallback( merchant_last_modified, payment_data, eligible_connectors.as_ref(), - #[cfg(feature = "business_profile_routing")] profile_id, ) .await; @@ -713,7 +664,6 @@ pub async fn perform_session_flow_routing( .assume_utc() .unix_timestamp(); - #[cfg(feature = "business_profile_routing")] let routing_algorithm: MerchantAccountRoutingAlgorithm = { let profile_id = session_input .payment_intent @@ -738,18 +688,6 @@ pub async fn perform_session_flow_routing( .unwrap_or_default() }; - #[cfg(not(feature = "business_profile_routing"))] - let routing_algorithm: MerchantAccountRoutingAlgorithm = { - session_input - .merchant_account - .routing_algorithm - .clone() - .map(|val| val.parse_value("MerchantAccountRoutingAlgorithm")) - .transpose() - .change_context(errors::RoutingError::InvalidRoutingAlgorithmStructure)? - .unwrap_or_default() - }; - let payment_method_input = dsl_inputs::PaymentMethodInput { payment_method: None, payment_method_type: None, @@ -834,7 +772,7 @@ pub async fn perform_session_flow_routing( routing_algorithm: &routing_algorithm, backend_input: backend_input.clone(), allowed_connectors, - #[cfg(any(feature = "business_profile_routing",))] + profile_id: session_input.payment_intent.profile_id.clone(), }; let maybe_choice = perform_session_routing_for_pm_type(session_pm_input).await?; @@ -867,7 +805,6 @@ async fn perform_session_routing_for_pm_type( merchant_id, algorithm_ref.timestamp, algorithm_id, - #[cfg(feature = "business_profile_routing")] session_pm_input.profile_id.clone(), ) .await?; @@ -912,7 +849,6 @@ async fn perform_session_routing_for_pm_type( chosen_connectors, session_pm_input.backend_input.clone(), None, - #[cfg(feature = "business_profile_routing")] session_pm_input.profile_id.clone(), ) .await?; @@ -936,7 +872,6 @@ async fn perform_session_routing_for_pm_type( fallback, session_pm_input.backend_input, None, - #[cfg(feature = "business_profile_routing")] session_pm_input.profile_id.clone(), ) .await?; diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index f257e4ab5d99..61aea9bf09c4 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -2,76 +2,51 @@ pub mod helpers; pub mod transformers; use api_models::routing::{self as routing_types, RoutingAlgorithmId}; -#[cfg(feature = "business_profile_routing")] -use api_models::routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery}; -#[cfg(not(feature = "business_profile_routing"))] -use common_utils::ext_traits::{Encode, StringExt}; -#[cfg(not(feature = "business_profile_routing"))] -use diesel_models::configs; -#[cfg(feature = "business_profile_routing")] + use diesel_models::routing_algorithm::RoutingAlgorithm; use error_stack::{IntoReport, ResultExt}; use rustc_hash::FxHashSet; -#[cfg(feature = "business_profile_routing")] -use crate::types::transformers::{ForeignInto, ForeignTryInto}; use crate::{ consts, core::{ errors::{RouterResponse, StorageErrorExt}, metrics, utils as core_utils, }, + errors, routes::AppState, - types::domain, + services::api as service_api, + types::{ + domain, + transformers::{ForeignInto, ForeignTryInto}, + }, utils::{self, OptionExt, ValueExt}, }; -#[cfg(not(feature = "business_profile_routing"))] -use crate::{core::errors, services::api as service_api, types::storage}; -#[cfg(feature = "business_profile_routing")] -use crate::{errors, services::api as service_api}; pub async fn retrieve_merchant_routing_dictionary( state: AppState, merchant_account: domain::MerchantAccount, - #[cfg(feature = "business_profile_routing")] query_params: RoutingRetrieveQuery, + query_params: routing_types::RoutingRetrieveQuery, ) -> RouterResponse { metrics::ROUTING_MERCHANT_DICTIONARY_RETRIEVE.add(&metrics::CONTEXT, 1, &[]); - #[cfg(feature = "business_profile_routing")] - { - let routing_metadata = state - .store - .list_routing_algorithm_metadata_by_merchant_id( - &merchant_account.merchant_id, - i64::from(query_params.limit.unwrap_or_default()), - i64::from(query_params.offset.unwrap_or_default()), - ) - .await - .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; - let result = routing_metadata - .into_iter() - .map(ForeignInto::foreign_into) - .collect::>(); - - metrics::ROUTING_MERCHANT_DICTIONARY_RETRIEVE_SUCCESS_RESPONSE.add( - &metrics::CONTEXT, - 1, - &[], - ); - Ok(service_api::ApplicationResponse::Json( - routing_types::RoutingKind::RoutingAlgorithm(result), - )) - } - #[cfg(not(feature = "business_profile_routing"))] + + let routing_metadata = state + .store + .list_routing_algorithm_metadata_by_merchant_id( + &merchant_account.merchant_id, + i64::from(query_params.limit.unwrap_or_default()), + i64::from(query_params.offset.unwrap_or_default()), + ) + .await + .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; + let result = routing_metadata + .into_iter() + .map(ForeignInto::foreign_into) + .collect::>(); + metrics::ROUTING_MERCHANT_DICTIONARY_RETRIEVE_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - #[cfg(not(feature = "business_profile_routing"))] Ok(service_api::ApplicationResponse::Json( - routing_types::RoutingKind::Config( - helpers::get_merchant_routing_dictionary( - state.store.as_ref(), - &merchant_account.merchant_id, - ) - .await?, - ), + routing_types::RoutingKind::RoutingAlgorithm(result), )) } @@ -111,228 +86,107 @@ pub async fn create_routing_config( &format!("routing_{}", &merchant_account.merchant_id), ); - #[cfg(feature = "business_profile_routing")] - { - let profile_id = request - .profile_id - .get_required_value("profile_id") - .change_context(errors::ApiErrorResponse::MissingRequiredField { - field_name: "profile_id", - }) - .attach_printable("Profile_id not provided")?; - - core_utils::validate_and_get_business_profile( - db, - Some(&profile_id), - &merchant_account.merchant_id, - ) - .await?; - - helpers::validate_connectors_in_routing_config( - db, - &key_store, - &merchant_account.merchant_id, - &profile_id, - &algorithm, - ) - .await?; - - let timestamp = common_utils::date_time::now(); - let algo = RoutingAlgorithm { - algorithm_id: algorithm_id.clone(), - profile_id, - merchant_id: merchant_account.merchant_id, - name: name.clone(), - description: Some(description.clone()), - kind: algorithm.get_kind().foreign_into(), - algorithm_data: serde_json::json!(algorithm), - created_at: timestamp, - modified_at: timestamp, - }; - let record = db - .insert_routing_algorithm(algo) - .await - .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; - - let new_record = record.foreign_into(); - - metrics::ROUTING_CREATE_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json(new_record)) - } + let profile_id = request + .profile_id + .get_required_value("profile_id") + .change_context(errors::ApiErrorResponse::MissingRequiredField { + field_name: "profile_id", + }) + .attach_printable("Profile_id not provided")?; - #[cfg(not(feature = "business_profile_routing"))] - { - let algorithm_str = - utils::Encode::::encode_to_string_of_json(&algorithm) - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Unable to serialize routing algorithm to string")?; + core_utils::validate_and_get_business_profile( + db, + Some(&profile_id), + &merchant_account.merchant_id, + ) + .await?; - let mut algorithm_ref: routing_types::RoutingAlgorithmRef = merchant_account - .routing_algorithm - .clone() - .map(|val| val.parse_value("RoutingAlgorithmRef")) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("unable to deserialize routing algorithm ref from merchant account")? - .unwrap_or_default(); - let mut merchant_dictionary = - helpers::get_merchant_routing_dictionary(db, &merchant_account.merchant_id).await?; - - utils::when( - merchant_dictionary.records.len() >= consts::MAX_ROUTING_CONFIGS_PER_MERCHANT, - || { - Err(errors::ApiErrorResponse::PreconditionFailed { - message: format!("Reached the maximum number of routing configs ({}), please delete some to create new ones", consts::MAX_ROUTING_CONFIGS_PER_MERCHANT), - }) - .into_report() - }, - )?; - let timestamp = common_utils::date_time::now_unix_timestamp(); - let records_are_empty = merchant_dictionary.records.is_empty(); - - let new_record = routing_types::RoutingDictionaryRecord { - id: algorithm_id.clone(), - name: name.clone(), - kind: algorithm.get_kind(), - description: description.clone(), - created_at: timestamp, - modified_at: timestamp, - }; - merchant_dictionary.records.push(new_record.clone()); - - let new_algorithm_config = configs::ConfigNew { - key: algorithm_id.clone(), - config: algorithm_str, - }; - - db.insert_config(new_algorithm_config) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to save new routing algorithm config to DB")?; + helpers::validate_connectors_in_routing_config( + db, + &key_store, + &merchant_account.merchant_id, + &profile_id, + &algorithm, + ) + .await?; - if records_are_empty { - merchant_dictionary.active_id = Some(algorithm_id.clone()); - algorithm_ref.update_algorithm_id(algorithm_id); - helpers::update_merchant_active_algorithm_ref(db, &key_store, algorithm_ref).await?; - } + let timestamp = common_utils::date_time::now(); + let algo = RoutingAlgorithm { + algorithm_id: algorithm_id.clone(), + profile_id, + merchant_id: merchant_account.merchant_id, + name: name.clone(), + description: Some(description.clone()), + kind: algorithm.get_kind().foreign_into(), + algorithm_data: serde_json::json!(algorithm), + created_at: timestamp, + modified_at: timestamp, + }; + let record = db + .insert_routing_algorithm(algo) + .await + .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; - helpers::update_merchant_routing_dictionary( - db, - &merchant_account.merchant_id, - merchant_dictionary, - ) - .await?; + let new_record = record.foreign_into(); - metrics::ROUTING_CREATE_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json(new_record)) - } + metrics::ROUTING_CREATE_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); + Ok(service_api::ApplicationResponse::Json(new_record)) } pub async fn link_routing_config( state: AppState, merchant_account: domain::MerchantAccount, - #[cfg(not(feature = "business_profile_routing"))] key_store: domain::MerchantKeyStore, algorithm_id: String, ) -> RouterResponse { metrics::ROUTING_LINK_CONFIG.add(&metrics::CONTEXT, 1, &[]); let db = state.store.as_ref(); - #[cfg(feature = "business_profile_routing")] - { - let routing_algorithm = db - .find_routing_algorithm_by_algorithm_id_merchant_id( - &algorithm_id, - &merchant_account.merchant_id, - ) - .await - .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?; - let business_profile = core_utils::validate_and_get_business_profile( - db, - Some(&routing_algorithm.profile_id), + let routing_algorithm = db + .find_routing_algorithm_by_algorithm_id_merchant_id( + &algorithm_id, &merchant_account.merchant_id, ) - .await? - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { - id: routing_algorithm.profile_id.clone(), - })?; - - let mut routing_ref: routing_types::RoutingAlgorithmRef = business_profile - .routing_algorithm - .clone() - .map(|val| val.parse_value("RoutingAlgorithmRef")) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("unable to deserialize routing algorithm ref from merchant account")? - .unwrap_or_default(); - - utils::when( - routing_ref.algorithm_id == Some(algorithm_id.clone()), - || { - Err(errors::ApiErrorResponse::PreconditionFailed { - message: "Algorithm is already active".to_string(), - }) - .into_report() - }, - )?; - - routing_ref.update_algorithm_id(algorithm_id); - helpers::update_business_profile_active_algorithm_ref(db, business_profile, routing_ref) - .await?; + .await + .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?; - metrics::ROUTING_LINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json( - routing_algorithm.foreign_into(), - )) - } + let business_profile = core_utils::validate_and_get_business_profile( + db, + Some(&routing_algorithm.profile_id), + &merchant_account.merchant_id, + ) + .await? + .get_required_value("BusinessProfile") + .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { + id: routing_algorithm.profile_id.clone(), + })?; - #[cfg(not(feature = "business_profile_routing"))] - { - let mut routing_ref: routing_types::RoutingAlgorithmRef = merchant_account - .routing_algorithm - .clone() - .map(|val| val.parse_value("RoutingAlgorithmRef")) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("unable to deserialize routing algorithm ref from merchant account")? - .unwrap_or_default(); + let mut routing_ref: routing_types::RoutingAlgorithmRef = business_profile + .routing_algorithm + .clone() + .map(|val| val.parse_value("RoutingAlgorithmRef")) + .transpose() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("unable to deserialize routing algorithm ref from merchant account")? + .unwrap_or_default(); - utils::when( - routing_ref.algorithm_id == Some(algorithm_id.clone()), - || { - Err(errors::ApiErrorResponse::PreconditionFailed { - message: "Algorithm is already active".to_string(), - }) - .into_report() - }, - )?; - let mut merchant_dictionary = - helpers::get_merchant_routing_dictionary(db, &merchant_account.merchant_id).await?; - - let modified_at = common_utils::date_time::now_unix_timestamp(); - let record = merchant_dictionary - .records - .iter_mut() - .find(|rec| rec.id == algorithm_id) - .ok_or(errors::ApiErrorResponse::ResourceIdNotFound) + utils::when( + routing_ref.algorithm_id == Some(algorithm_id.clone()), + || { + Err(errors::ApiErrorResponse::PreconditionFailed { + message: "Algorithm is already active".to_string(), + }) .into_report() - .attach_printable("Record with given ID not found for routing config activation")?; + }, + )?; - record.modified_at = modified_at; - merchant_dictionary.active_id = Some(record.id.clone()); - let response = record.clone(); - routing_ref.update_algorithm_id(algorithm_id); - helpers::update_merchant_routing_dictionary( - db, - &merchant_account.merchant_id, - merchant_dictionary, - ) + routing_ref.update_algorithm_id(algorithm_id); + helpers::update_business_profile_active_algorithm_ref(db, business_profile, routing_ref) .await?; - helpers::update_merchant_active_algorithm_ref(db, &key_store, routing_ref).await?; - metrics::ROUTING_LINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json(response)) - } + metrics::ROUTING_LINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); + Ok(service_api::ApplicationResponse::Json( + routing_algorithm.foreign_into(), + )) } pub async fn retrieve_routing_config( @@ -342,250 +196,107 @@ pub async fn retrieve_routing_config( ) -> RouterResponse { metrics::ROUTING_RETRIEVE_CONFIG.add(&metrics::CONTEXT, 1, &[]); let db = state.store.as_ref(); - #[cfg(feature = "business_profile_routing")] - { - let routing_algorithm = db - .find_routing_algorithm_by_algorithm_id_merchant_id( - &algorithm_id.0, - &merchant_account.merchant_id, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; - core_utils::validate_and_get_business_profile( - db, - Some(&routing_algorithm.profile_id), + let routing_algorithm = db + .find_routing_algorithm_by_algorithm_id_merchant_id( + &algorithm_id.0, &merchant_account.merchant_id, ) - .await? - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?; - - let response = routing_algorithm - .foreign_try_into() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("unable to parse routing algorithm")?; - - metrics::ROUTING_RETRIEVE_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json(response)) - } - - #[cfg(not(feature = "business_profile_routing"))] - { - let merchant_dictionary = - helpers::get_merchant_routing_dictionary(db, &merchant_account.merchant_id).await?; + .await + .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; - let record = merchant_dictionary - .records - .into_iter() - .find(|rec| rec.id == algorithm_id.0) - .ok_or(errors::ApiErrorResponse::ResourceIdNotFound) - .into_report() - .attach_printable("Algorithm with the given ID not found in the merchant dictionary")?; + core_utils::validate_and_get_business_profile( + db, + Some(&routing_algorithm.profile_id), + &merchant_account.merchant_id, + ) + .await? + .get_required_value("BusinessProfile") + .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?; - let algorithm_config = db - .find_config_by_key(&algorithm_id.0) - .await - .change_context(errors::ApiErrorResponse::ResourceIdNotFound) - .attach_printable("Routing config not found in DB")?; + let response = routing_algorithm + .foreign_try_into() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("unable to parse routing algorithm")?; - let algorithm: routing_types::RoutingAlgorithm = algorithm_config - .config - .parse_struct("RoutingAlgorithm") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Error deserializing routing algorithm config")?; - - let response = routing_types::MerchantRoutingAlgorithm { - id: record.id, - name: record.name, - description: record.description, - algorithm, - created_at: record.created_at, - modified_at: record.modified_at, - }; - - metrics::ROUTING_RETRIEVE_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json(response)) - } + metrics::ROUTING_RETRIEVE_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); + Ok(service_api::ApplicationResponse::Json(response)) } pub async fn unlink_routing_config( state: AppState, merchant_account: domain::MerchantAccount, - #[cfg(not(feature = "business_profile_routing"))] key_store: domain::MerchantKeyStore, - #[cfg(feature = "business_profile_routing")] request: routing_types::RoutingConfigRequest, + + request: routing_types::RoutingConfigRequest, ) -> RouterResponse { metrics::ROUTING_UNLINK_CONFIG.add(&metrics::CONTEXT, 1, &[]); let db = state.store.as_ref(); - #[cfg(feature = "business_profile_routing")] - { - let profile_id = request - .profile_id - .get_required_value("profile_id") - .change_context(errors::ApiErrorResponse::MissingRequiredField { - field_name: "profile_id", - }) - .attach_printable("Profile_id not provided")?; - let business_profile = core_utils::validate_and_get_business_profile( - db, - Some(&profile_id), - &merchant_account.merchant_id, - ) - .await?; - match business_profile { - Some(business_profile) => { - let routing_algo_ref: routing_types::RoutingAlgorithmRef = business_profile - .routing_algorithm - .clone() - .map(|val| val.parse_value("RoutingAlgorithmRef")) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable( - "unable to deserialize routing algorithm ref from merchant account", - )? - .unwrap_or_default(); - - let timestamp = common_utils::date_time::now_unix_timestamp(); - - match routing_algo_ref.algorithm_id { - Some(algorithm_id) => { - let routing_algorithm: routing_types::RoutingAlgorithmRef = - routing_types::RoutingAlgorithmRef { - algorithm_id: None, - timestamp, - config_algo_id: routing_algo_ref.config_algo_id.clone(), - surcharge_config_algo_id: routing_algo_ref.surcharge_config_algo_id, - }; - - let record = db - .find_routing_algorithm_by_profile_id_algorithm_id( - &profile_id, - &algorithm_id, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; - let response = record.foreign_into(); - helpers::update_business_profile_active_algorithm_ref( - db, - business_profile, - routing_algorithm, + + let profile_id = request + .profile_id + .get_required_value("profile_id") + .change_context(errors::ApiErrorResponse::MissingRequiredField { + field_name: "profile_id", + }) + .attach_printable("Profile_id not provided")?; + let business_profile = core_utils::validate_and_get_business_profile( + db, + Some(&profile_id), + &merchant_account.merchant_id, + ) + .await?; + match business_profile { + Some(business_profile) => { + let routing_algo_ref: routing_types::RoutingAlgorithmRef = business_profile + .routing_algorithm + .clone() + .map(|val| val.parse_value("RoutingAlgorithmRef")) + .transpose() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable( + "unable to deserialize routing algorithm ref from merchant account", + )? + .unwrap_or_default(); + + let timestamp = common_utils::date_time::now_unix_timestamp(); + + match routing_algo_ref.algorithm_id { + Some(algorithm_id) => { + let routing_algorithm: routing_types::RoutingAlgorithmRef = + routing_types::RoutingAlgorithmRef { + algorithm_id: None, + timestamp, + config_algo_id: routing_algo_ref.config_algo_id.clone(), + surcharge_config_algo_id: routing_algo_ref.surcharge_config_algo_id, + }; + + let record = db + .find_routing_algorithm_by_profile_id_algorithm_id( + &profile_id, + &algorithm_id, ) - .await?; - - metrics::ROUTING_UNLINK_CONFIG_SUCCESS_RESPONSE.add( - &metrics::CONTEXT, - 1, - &[], - ); - Ok(service_api::ApplicationResponse::Json(response)) - } - None => Err(errors::ApiErrorResponse::PreconditionFailed { - message: "Algorithm is already inactive".to_string(), - }) - .into_report()?, + .await + .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; + let response = record.foreign_into(); + helpers::update_business_profile_active_algorithm_ref( + db, + business_profile, + routing_algorithm, + ) + .await?; + + metrics::ROUTING_UNLINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); + Ok(service_api::ApplicationResponse::Json(response)) } + None => Err(errors::ApiErrorResponse::PreconditionFailed { + message: "Algorithm is already inactive".to_string(), + }) + .into_report()?, } - None => Err(errors::ApiErrorResponse::InvalidRequestData { - message: "The business_profile is not present".to_string(), - } - .into()), } - } - - #[cfg(not(feature = "business_profile_routing"))] - { - let mut merchant_dictionary = - helpers::get_merchant_routing_dictionary(db, &merchant_account.merchant_id).await?; - - let routing_algo_ref: routing_types::RoutingAlgorithmRef = merchant_account - .routing_algorithm - .clone() - .map(|val| val.parse_value("RoutingAlgorithmRef")) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("unable to deserialize routing algorithm ref from merchant account")? - .unwrap_or_default(); - let timestamp = common_utils::date_time::now_unix_timestamp(); - - utils::when(routing_algo_ref.algorithm_id.is_none(), || { - Err(errors::ApiErrorResponse::PreconditionFailed { - message: "Algorithm is already inactive".to_string(), - }) - .into_report() - })?; - let routing_algorithm: routing_types::RoutingAlgorithmRef = - routing_types::RoutingAlgorithmRef { - algorithm_id: None, - timestamp, - config_algo_id: routing_algo_ref.config_algo_id.clone(), - surcharge_config_algo_id: routing_algo_ref.surcharge_config_algo_id, - }; - - let active_algorithm_id = merchant_dictionary - .active_id - .or(routing_algo_ref.algorithm_id.clone()) - .ok_or(errors::ApiErrorResponse::PreconditionFailed { - // When the merchant_dictionary doesn't have any active algorithm and merchant_account doesn't have any routing_algorithm configured - message: "Algorithm is already inactive".to_string(), - }) - .into_report()?; - - let record = merchant_dictionary - .records - .iter_mut() - .find(|rec| rec.id == active_algorithm_id) - .ok_or(errors::ApiErrorResponse::ResourceIdNotFound) - .into_report() - .attach_printable("Record with the given ID not found for de-activation")?; - - let response = record.clone(); - - merchant_dictionary.active_id = None; - - helpers::update_merchant_routing_dictionary( - db, - &merchant_account.merchant_id, - merchant_dictionary, - ) - .await?; - - let ref_value = - Encode::::encode_to_value(&routing_algorithm) - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed converting routing algorithm ref to json value")?; - - let merchant_account_update = storage::MerchantAccountUpdate::Update { - merchant_name: None, - merchant_details: None, - return_url: None, - webhook_details: None, - sub_merchants_enabled: None, - parent_merchant_id: None, - enable_payment_response_hash: None, - payment_response_hash_key: None, - redirect_to_merchant_with_http_post: None, - publishable_key: None, - locker_id: None, - metadata: None, - routing_algorithm: Some(ref_value), - primary_business_details: None, - intent_fulfillment_time: None, - frm_routing_algorithm: None, - payout_routing_algorithm: None, - default_profile: None, - payment_link_config: None, - }; - - db.update_specific_fields_in_merchant( - &key_store.merchant_id, - merchant_account_update, - &key_store, - ) - .await - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to update routing algorithm ref in merchant account")?; - - metrics::ROUTING_UNLINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json(response)) + None => Err(errors::ApiErrorResponse::InvalidRequestData { + message: "The business_profile is not present".to_string(), + } + .into()), } } @@ -659,106 +370,56 @@ pub async fn retrieve_default_routing_config( pub async fn retrieve_linked_routing_config( state: AppState, merchant_account: domain::MerchantAccount, - #[cfg(feature = "business_profile_routing")] query_params: RoutingRetrieveLinkQuery, + query_params: routing_types::RoutingRetrieveLinkQuery, ) -> RouterResponse { metrics::ROUTING_RETRIEVE_LINK_CONFIG.add(&metrics::CONTEXT, 1, &[]); let db = state.store.as_ref(); - #[cfg(feature = "business_profile_routing")] - { - let business_profiles = if let Some(profile_id) = query_params.profile_id { - core_utils::validate_and_get_business_profile( - db, - Some(&profile_id), - &merchant_account.merchant_id, - ) - .await? - .map(|profile| vec![profile]) - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id })? - } else { - db.list_business_profile_by_merchant_id(&merchant_account.merchant_id) - .await - .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)? - }; + let business_profiles = if let Some(profile_id) = query_params.profile_id { + core_utils::validate_and_get_business_profile( + db, + Some(&profile_id), + &merchant_account.merchant_id, + ) + .await? + .map(|profile| vec![profile]) + .get_required_value("BusinessProfile") + .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_id })? + } else { + db.list_business_profile_by_merchant_id(&merchant_account.merchant_id) + .await + .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)? + }; - let mut active_algorithms = Vec::new(); + let mut active_algorithms = Vec::new(); - for business_profile in business_profiles { - let routing_ref: routing_types::RoutingAlgorithmRef = business_profile - .routing_algorithm - .clone() - .map(|val| val.parse_value("RoutingAlgorithmRef")) - .transpose() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable( - "unable to deserialize routing algorithm ref from merchant account", - )? - .unwrap_or_default(); + for business_profile in business_profiles { + let routing_ref: routing_types::RoutingAlgorithmRef = business_profile + .routing_algorithm + .clone() + .map(|val| val.parse_value("RoutingAlgorithmRef")) + .transpose() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("unable to deserialize routing algorithm ref from merchant account")? + .unwrap_or_default(); - if let Some(algorithm_id) = routing_ref.algorithm_id { - let record = db - .find_routing_algorithm_metadata_by_algorithm_id_profile_id( - &algorithm_id, - &business_profile.profile_id, - ) - .await - .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; + if let Some(algorithm_id) = routing_ref.algorithm_id { + let record = db + .find_routing_algorithm_metadata_by_algorithm_id_profile_id( + &algorithm_id, + &business_profile.profile_id, + ) + .await + .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; - active_algorithms.push(record.foreign_into()); - } + active_algorithms.push(record.foreign_into()); } - - metrics::ROUTING_RETRIEVE_LINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json( - routing_types::LinkedRoutingConfigRetrieveResponse::ProfileBased(active_algorithms), - )) } - #[cfg(not(feature = "business_profile_routing"))] - { - let merchant_dictionary = - helpers::get_merchant_routing_dictionary(db, &merchant_account.merchant_id).await?; - - let algorithm = if let Some(algorithm_id) = merchant_dictionary.active_id { - let record = merchant_dictionary - .records - .into_iter() - .find(|rec| rec.id == algorithm_id) - .ok_or(errors::ApiErrorResponse::ResourceIdNotFound) - .into_report() - .attach_printable("record for active algorithm not found in merchant dictionary")?; - - let config = db - .find_config_by_key(&algorithm_id) - .await - .to_not_found_response(errors::ApiErrorResponse::InternalServerError) - .attach_printable("error finding routing config in db")?; - let the_algorithm: routing_types::RoutingAlgorithm = config - .config - .parse_struct("RoutingAlgorithm") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("unable to parse routing algorithm")?; - - Some(routing_types::MerchantRoutingAlgorithm { - id: record.id, - name: record.name, - description: record.description, - algorithm: the_algorithm, - created_at: record.created_at, - modified_at: record.modified_at, - }) - } else { - None - }; - - let response = routing_types::LinkedRoutingConfigRetrieveResponse::MerchantAccountBased( - routing_types::RoutingRetrieveResponse { algorithm }, - ); - - metrics::ROUTING_RETRIEVE_LINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); - Ok(service_api::ApplicationResponse::Json(response)) - } + metrics::ROUTING_RETRIEVE_LINK_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); + Ok(service_api::ApplicationResponse::Json( + routing_types::LinkedRoutingConfigRetrieveResponse::ProfileBased(active_algorithms), + )) } pub async fn retrieve_default_routing_config_for_profiles( diff --git a/crates/router/src/core/routing/transformers.rs b/crates/router/src/core/routing/transformers.rs index e5f1f1e1d5f0..91cd6285ac1b 100644 --- a/crates/router/src/core/routing/transformers.rs +++ b/crates/router/src/core/routing/transformers.rs @@ -17,7 +17,7 @@ impl ForeignFrom for RoutingDictionaryRecord { fn foreign_from(value: RoutingProfileMetadata) -> Self { Self { id: value.algorithm_id, - #[cfg(feature = "business_profile_routing")] + profile_id: value.profile_id, name: value.name, @@ -33,7 +33,7 @@ impl ForeignFrom for RoutingDictionaryRecord { fn foreign_from(value: RoutingAlgorithm) -> Self { Self { id: value.algorithm_id, - #[cfg(feature = "business_profile_routing")] + profile_id: value.profile_id, name: value.name, kind: value.kind.foreign_into(), @@ -51,7 +51,7 @@ impl ForeignTryFrom for MerchantRoutingAlgorithm { Ok(Self { id: value.algorithm_id, name: value.name, - #[cfg(feature = "business_profile_routing")] + profile_id: value.profile_id, description: value.description.unwrap_or_default(), algorithm: value diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs index e7e31cb36aeb..fac614748065 100644 --- a/crates/router/src/routes/routing.rs +++ b/crates/router/src/routes/routing.rs @@ -4,8 +4,7 @@ //! of Routing configs. use actix_web::{web, HttpRequest, Responder}; use api_models::routing as routing_types; -#[cfg(feature = "business_profile_routing")] -use api_models::routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery}; + use router_env::{ tracing::{self, instrument}, Flow, @@ -60,13 +59,7 @@ pub async fn routing_link_config( &req, path.into_inner(), |state, auth: auth::AuthenticationData, algorithm_id| { - routing::link_routing_config( - state, - auth.merchant_account, - #[cfg(not(feature = "business_profile_routing"))] - auth.key_store, - algorithm_id.0, - ) + routing::link_routing_config(state, auth.merchant_account, algorithm_id.0) }, #[cfg(not(feature = "release"))] auth::auth_type( @@ -116,59 +109,32 @@ pub async fn routing_retrieve_config( pub async fn routing_retrieve_dictionary( state: web::Data, req: HttpRequest, - #[cfg(feature = "business_profile_routing")] query: web::Query, + query: web::Query, ) -> impl Responder { - #[cfg(feature = "business_profile_routing")] - { - let flow = Flow::RoutingRetrieveDictionary; - Box::pin(oss_api::server_wrap( - flow, - state, - &req, - query.into_inner(), - |state, auth: auth::AuthenticationData, query_params| { - routing::retrieve_merchant_routing_dictionary( - state, - auth.merchant_account, - query_params, - ) - }, - #[cfg(not(feature = "release"))] - auth::auth_type( - &auth::ApiKeyAuth, - &auth::JWTAuth(Permission::RoutingRead), - req.headers(), - ), - #[cfg(feature = "release")] - &auth::JWTAuth(Permission::RoutingRead), - api_locking::LockAction::NotApplicable, - )) - .await - } - - #[cfg(not(feature = "business_profile_routing"))] - { - let flow = Flow::RoutingRetrieveDictionary; - Box::pin(oss_api::server_wrap( - flow, - state, - &req, - (), - |state, auth: auth::AuthenticationData, _| { - routing::retrieve_merchant_routing_dictionary(state, auth.merchant_account) - }, - #[cfg(not(feature = "release"))] - auth::auth_type( - &auth::ApiKeyAuth, - &auth::JWTAuth(Permission::RoutingRead), - req.headers(), - ), - #[cfg(feature = "release")] + let flow = Flow::RoutingRetrieveDictionary; + Box::pin(oss_api::server_wrap( + flow, + state, + &req, + query.into_inner(), + |state, auth: auth::AuthenticationData, query_params| { + routing::retrieve_merchant_routing_dictionary( + state, + auth.merchant_account, + query_params, + ) + }, + #[cfg(not(feature = "release"))] + auth::auth_type( + &auth::ApiKeyAuth, &auth::JWTAuth(Permission::RoutingRead), - api_locking::LockAction::NotApplicable, - )) - .await - } + req.headers(), + ), + #[cfg(feature = "release")] + &auth::JWTAuth(Permission::RoutingRead), + api_locking::LockAction::NotApplicable, + )) + .await } #[cfg(feature = "olap")] @@ -176,57 +142,28 @@ pub async fn routing_retrieve_dictionary( pub async fn routing_unlink_config( state: web::Data, req: HttpRequest, - #[cfg(feature = "business_profile_routing")] payload: web::Json< - routing_types::RoutingConfigRequest, - >, + payload: web::Json, ) -> impl Responder { - #[cfg(feature = "business_profile_routing")] - { - let flow = Flow::RoutingUnlinkConfig; - Box::pin(oss_api::server_wrap( - flow, - state, - &req, - payload.into_inner(), - |state, auth: auth::AuthenticationData, payload_req| { - routing::unlink_routing_config(state, auth.merchant_account, payload_req) - }, - #[cfg(not(feature = "release"))] - auth::auth_type( - &auth::ApiKeyAuth, - &auth::JWTAuth(Permission::RoutingWrite), - req.headers(), - ), - #[cfg(feature = "release")] - &auth::JWTAuth(Permission::RoutingWrite), - api_locking::LockAction::NotApplicable, - )) - .await - } - - #[cfg(not(feature = "business_profile_routing"))] - { - let flow = Flow::RoutingUnlinkConfig; - Box::pin(oss_api::server_wrap( - flow, - state, - &req, - (), - |state, auth: auth::AuthenticationData, _| { - routing::unlink_routing_config(state, auth.merchant_account, auth.key_store) - }, - #[cfg(not(feature = "release"))] - auth::auth_type( - &auth::ApiKeyAuth, - &auth::JWTAuth(Permission::RoutingWrite), - req.headers(), - ), - #[cfg(feature = "release")] + let flow = Flow::RoutingUnlinkConfig; + Box::pin(oss_api::server_wrap( + flow, + state, + &req, + payload.into_inner(), + |state, auth: auth::AuthenticationData, payload_req| { + routing::unlink_routing_config(state, auth.merchant_account, payload_req) + }, + #[cfg(not(feature = "release"))] + auth::auth_type( + &auth::ApiKeyAuth, &auth::JWTAuth(Permission::RoutingWrite), - api_locking::LockAction::NotApplicable, - )) - .await - } + req.headers(), + ), + #[cfg(feature = "release")] + &auth::JWTAuth(Permission::RoutingWrite), + api_locking::LockAction::NotApplicable, + )) + .await } #[cfg(feature = "olap")] @@ -479,56 +416,29 @@ pub async fn retrieve_decision_manager_config( pub async fn routing_retrieve_linked_config( state: web::Data, req: HttpRequest, - #[cfg(feature = "business_profile_routing")] query: web::Query, + query: web::Query, ) -> impl Responder { - #[cfg(feature = "business_profile_routing")] - { - use crate::services::authentication::AuthenticationData; - let flow = Flow::RoutingRetrieveActiveConfig; - Box::pin(oss_api::server_wrap( - flow, - state, - &req, - query.into_inner(), - |state, auth: AuthenticationData, query_params| { - routing::retrieve_linked_routing_config(state, auth.merchant_account, query_params) - }, - #[cfg(not(feature = "release"))] - auth::auth_type( - &auth::ApiKeyAuth, - &auth::JWTAuth(Permission::RoutingRead), - req.headers(), - ), - #[cfg(feature = "release")] - &auth::JWTAuth(Permission::RoutingRead), - api_locking::LockAction::NotApplicable, - )) - .await - } - - #[cfg(not(feature = "business_profile_routing"))] - { - let flow = Flow::RoutingRetrieveActiveConfig; - Box::pin(oss_api::server_wrap( - flow, - state, - &req, - (), - |state, auth: auth::AuthenticationData, _| { - routing::retrieve_linked_routing_config(state, auth.merchant_account) - }, - #[cfg(not(feature = "release"))] - auth::auth_type( - &auth::ApiKeyAuth, - &auth::JWTAuth(Permission::RoutingRead), - req.headers(), - ), - #[cfg(feature = "release")] + use crate::services::authentication::AuthenticationData; + let flow = Flow::RoutingRetrieveActiveConfig; + Box::pin(oss_api::server_wrap( + flow, + state, + &req, + query.into_inner(), + |state, auth: AuthenticationData, query_params| { + routing::retrieve_linked_routing_config(state, auth.merchant_account, query_params) + }, + #[cfg(not(feature = "release"))] + auth::auth_type( + &auth::ApiKeyAuth, &auth::JWTAuth(Permission::RoutingRead), - api_locking::LockAction::NotApplicable, - )) - .await - } + req.headers(), + ), + #[cfg(feature = "release")] + &auth::JWTAuth(Permission::RoutingRead), + api_locking::LockAction::NotApplicable, + )) + .await } #[cfg(feature = "olap")] From 2c5d45e0fccda50e38218a0b3dd7b1c2be6734b5 Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 29 Nov 2023 16:43:40 +0530 Subject: [PATCH 04/14] fix clippy lints --- crates/api_models/src/routing.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index 01928c44f848..6dde391b075c 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -180,9 +180,7 @@ pub struct RoutableConnectorChoice { impl ToString for RoutableConnectorChoice { fn to_string(&self) -> String { - let base = self.connector.to_string(); - - base + self.connector.to_string() } } From bd25fa2050da9a22342dce28f81552bbab7af2e9 Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 29 Nov 2023 18:29:03 +0530 Subject: [PATCH 05/14] removed the backwards compat for connector_choice_kind feature --- crates/api_models/Cargo.toml | 2 - crates/api_models/src/routing.rs | 76 +------------------ crates/euclid_wasm/Cargo.toml | 3 +- crates/router/Cargo.toml | 3 +- .../stripe/payment_intents/types.rs | 2 - .../stripe/setup_intents/types.rs | 2 - crates/router/src/core/admin.rs | 4 +- .../router/src/core/payment_methods/cards.rs | 2 - crates/router/src/types/api/routing.rs | 2 - 9 files changed, 5 insertions(+), 91 deletions(-) diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml index c6c23f78c7d2..680cfa89b7f9 100644 --- a/crates/api_models/Cargo.toml +++ b/crates/api_models/Cargo.toml @@ -9,9 +9,7 @@ license.workspace = true [features] default = ["payouts"] -connector_choice_bcompat = [] errors = ["dep:actix-web", "dep:reqwest"] -backwards_compatibility = ["connector_choice_bcompat"] dummy_connector = ["euclid/dummy_connector"] detailed_errors = [] payouts = [] diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index 6dde391b075c..01f00d3c41ca 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -146,34 +146,9 @@ pub struct ConnectorVolumeSplit { pub split: u8, } -#[cfg(feature = "connector_choice_bcompat")] -#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] -pub enum RoutableChoiceKind { - OnlyConnector, - FullStruct, -} +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)] -#[cfg(feature = "connector_choice_bcompat")] -#[derive(Debug, serde::Deserialize, serde::Serialize)] -#[serde(untagged)] -pub enum RoutableChoiceSerde { - OnlyConnector(Box), - FullStruct { - connector: RoutableConnectors, - merchant_connector_id: Option, - }, -} - -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -#[cfg_attr( - feature = "connector_choice_bcompat", - serde(from = "RoutableChoiceSerde"), - serde(into = "RoutableChoiceSerde") -)] -#[cfg_attr(not(feature = "connector_choice_bcompat"), derive(PartialEq, Eq))] pub struct RoutableConnectorChoice { - #[cfg(feature = "connector_choice_bcompat")] - pub choice_kind: RoutableChoiceKind, pub connector: RoutableConnectors, pub merchant_connector_id: Option, } @@ -184,55 +159,6 @@ impl ToString for RoutableConnectorChoice { } } -#[cfg(feature = "connector_choice_bcompat")] -impl PartialEq for RoutableConnectorChoice { - fn eq(&self, other: &Self) -> bool { - self.connector.eq(&other.connector) - && self.merchant_connector_id.eq(&other.merchant_connector_id) - } -} - -#[cfg(feature = "connector_choice_bcompat")] -impl Eq for RoutableConnectorChoice {} - -#[cfg(feature = "connector_choice_bcompat")] -impl From for RoutableConnectorChoice { - fn from(value: RoutableChoiceSerde) -> Self { - match value { - RoutableChoiceSerde::OnlyConnector(connector) => Self { - choice_kind: RoutableChoiceKind::OnlyConnector, - connector: *connector, - - merchant_connector_id: None, - }, - - RoutableChoiceSerde::FullStruct { - connector, - - merchant_connector_id, - } => Self { - choice_kind: RoutableChoiceKind::FullStruct, - connector, - - merchant_connector_id, - }, - } - } -} - -#[cfg(feature = "connector_choice_bcompat")] -impl From for RoutableChoiceSerde { - fn from(value: RoutableConnectorChoice) -> Self { - match value.choice_kind { - RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)), - RoutableChoiceKind::FullStruct => Self::FullStruct { - connector: value.connector, - merchant_connector_id: value.merchant_connector_id, - }, - } - } -} - impl From for ast::ConnectorChoice { fn from(value: RoutableConnectorChoice) -> Self { Self { diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index 2e86357a6af6..6caa1764eca5 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -10,8 +10,7 @@ rust-version.workspace = true crate-type = ["cdylib"] [features] -default = ["connector_choice_bcompat"] -connector_choice_bcompat = ["api_models/connector_choice_bcompat"] +default = [] dummy_connector = ["kgraph_utils/dummy_connector"] diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index afc00dd71d03..3fcfd47f9859 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" license.workspace = true [features] -default = ["kv_store", "stripe", "oltp", "olap","backwards_compatibility", "accounts_cache", "dummy_connector", "payouts", "retry"] +default = ["kv_store", "stripe", "oltp", "olap","accounts_cache", "dummy_connector", "payouts", "retry"] s3 = ["dep:aws-sdk-s3", "dep:aws-config"] kms = ["external_services/kms", "dep:aws-config"] email = ["external_services/email", "dep:aws-config"] @@ -22,7 +22,6 @@ kv_store = ["scheduler/kv_store"] accounts_cache = [] openapi = ["olap", "oltp", "payouts"] vergen = ["router_env/vergen"] -backwards_compatibility = ["api_models/backwards_compatibility"] dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector", "kgraph_utils/dummy_connector"] external_access_dc = ["dummy_connector"] detailed_errors = ["api_models/detailed_errors", "error-stack/serde"] diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index 7188a8153da2..c6ab9acb788f 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -284,8 +284,6 @@ impl TryFrom for payments::PaymentsRequest { .map(|connector| { api_models::routing::RoutingAlgorithm::Single(Box::new( api_models::routing::RoutableConnectorChoice { - #[cfg(feature = "backwards_compatibility")] - choice_kind: api_models::routing::RoutableChoiceKind::FullStruct, connector, merchant_connector_id: None, }, diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs index 3d8364ca62f6..bdc0ee09c892 100644 --- a/crates/router/src/compatibility/stripe/setup_intents/types.rs +++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs @@ -187,8 +187,6 @@ impl TryFrom for payments::PaymentsRequest { .map(|connector| { api_models::routing::RoutingAlgorithm::Single(Box::new( api_models::routing::RoutableConnectorChoice { - #[cfg(feature = "backwards_compatibility")] - choice_kind: api_models::routing::RoutableChoiceKind::FullStruct, connector, merchant_connector_id: None, diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index ab48f4665871..2f2779a5cc07 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -942,8 +942,8 @@ pub async fn create_payment_connector( if let Some(routable_connector_val) = routable_connector { let choice = routing_types::RoutableConnectorChoice { - #[cfg(feature = "backwards_compatibility")] - choice_kind: routing_types::RoutableChoiceKind::FullStruct, + + connector: routable_connector_val, merchant_connector_id: Some(mca.merchant_connector_id.clone()), diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index c20510b44233..3e3f9733e858 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -1119,8 +1119,6 @@ pub async fn list_payment_methods( for (pm_type, choice) in result { let routable_choice = routing_types::RoutableConnectorChoice { - #[cfg(feature = "backwards_compatibility")] - choice_kind: routing_types::RoutableChoiceKind::FullStruct, connector: choice .connector .connector_name diff --git a/crates/router/src/types/api/routing.rs b/crates/router/src/types/api/routing.rs index a0629c03e0f5..ceebc2f8314b 100644 --- a/crates/router/src/types/api/routing.rs +++ b/crates/router/src/types/api/routing.rs @@ -1,5 +1,3 @@ -#[cfg(feature = "backwards_compatibility")] -pub use api_models::routing::RoutableChoiceKind; pub use api_models::{ enums as api_enums, routing::{ From 3c02ce40bcc68d64858f2a77a3baeec22c576d74 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:13:45 +0000 Subject: [PATCH 06/14] chore: run formatter --- crates/router/src/core/admin.rs | 2 -- crates/router/src/core/routing.rs | 1 - crates/router/src/routes/routing.rs | 1 - 3 files changed, 4 deletions(-) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 2f2779a5cc07..70c40ab84876 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -942,8 +942,6 @@ pub async fn create_payment_connector( if let Some(routable_connector_val) = routable_connector { let choice = routing_types::RoutableConnectorChoice { - - connector: routable_connector_val, merchant_connector_id: Some(mca.merchant_connector_id.clone()), diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index 61aea9bf09c4..c2b461e86493 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -2,7 +2,6 @@ pub mod helpers; pub mod transformers; use api_models::routing::{self as routing_types, RoutingAlgorithmId}; - use diesel_models::routing_algorithm::RoutingAlgorithm; use error_stack::{IntoReport, ResultExt}; use rustc_hash::FxHashSet; diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs index fac614748065..2c21c44f6f7a 100644 --- a/crates/router/src/routes/routing.rs +++ b/crates/router/src/routes/routing.rs @@ -4,7 +4,6 @@ //! of Routing configs. use actix_web::{web, HttpRequest, Responder}; use api_models::routing as routing_types; - use router_env::{ tracing::{self, instrument}, Flow, From 1a7be728c2162ed88750e856b10545e539b78d4e Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Tue, 5 Dec 2023 15:30:15 +0530 Subject: [PATCH 07/14] resolve failing postman checks --- .../Payments - Create/request.json | 4 ---- .../Flow Testcases/QuickStart/Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Flow Testcases/QuickStart/Payments - Create/request.json | 4 ---- .../3DS Payment/Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Flow Testcases/QuickStart/Payments - Create/request.json | 4 ---- .../Scenario12-BNPL-klarna/Payments - Create/request.json | 4 ---- .../Flow Testcases/QuickStart/Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Scenario10-Partial refund/Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Recurring Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Recurring Payments - Create/request.json | 4 ---- .../Scenario12-BNPL-klarna/Payments - Create/request.json | 4 ---- .../Scenario13-BNPL-afterpay/Payments - Create/request.json | 4 ---- .../Scenario14-BNPL-affirm/Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Scenario19-Bank Debit-ach/Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Scenario23- Update Amount/Payments - Create/request.json | 4 ---- .../Scenario24-Add card flow/Payments - Create/request.json | 4 ---- .../Save card payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Save card payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Save card payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Flow Testcases/QuickStart/Payments - Create/request.json | 4 ---- .../Payments - Create(Invalid Exp Year)/request.json | 4 ---- .../Payments - Create(Invalid Exp month)/request.json | 4 ---- .../Payments - Create(Invalid card number)/request.json | 4 ---- .../Payments - Create(invalid CVV)/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Recurring Payments - Create/request.json | 4 ---- .../stripe/PaymentMethods/Payments - Create/request.json | 4 ---- .../stripe/Payments/Payments - Create Again/request.json | 4 ---- .../stripe/Payments/Payments - Create Yet Again/request.json | 4 ---- .../stripe/Payments/Payments - Create/request.json | 4 ---- .../stripe/QuickStart/Payments - Create-copy/request.json | 5 ++++- .../stripe/QuickStart/Payments - Create/request.json | 5 ++++- .../stripe/Refunds/Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Flow Testcases/QuickStart/Payments - Create/request.json | 4 ---- 82 files changed, 8 insertions(+), 322 deletions(-) diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/request.json index 0915e9894bb6..f8e5000d3144 100644 --- a/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/request.json +++ b/postman/collection-dir/adyen_uk/Flow Testcases/Happy Cases/Scenario22-Create Gift Card payment/Payments - Create/request.json @@ -42,10 +42,6 @@ } } }, - "routing": { - "type": "single", - "data": "adyen" - }, "billing": { "address": { "line1": "1467", diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json index ed9dbeaa9c49..8ac3ed14b0a7 100644 --- a/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/adyen_uk/Flow Testcases/QuickStart/Payments - Create/request.json @@ -43,10 +43,6 @@ "card_cvc": "7373" } }, - "routing": { - "type": "single", - "data": "adyen" - }, "billing": { "address": { "line1": "1467", diff --git a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json index 11437ff57659..923cb4aae78b 100644 --- a/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json +++ b/postman/collection-dir/adyen_uk/Flow Testcases/Variation Cases/Scenario10-Create Gift Card payment where it fails due to insufficient balance/Payments - Create/request.json @@ -42,10 +42,6 @@ } } }, - "routing": { - "type": "single", - "data": "adyen" - }, "billing": { "address": { "line1": "1467", diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json index b9bf4f2b66ea..f477cdecc3f8 100644 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Happy Cases/Scenario4-Create failed payment with confirm true copy/Payments - Create/request.json @@ -16,10 +16,6 @@ "amount": 7003, "currency": "USD", "confirm": true, - "routing": { - "data": "authorizedotnet", - "type": "single" - }, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "customer_id": "StripeCustomer", diff --git a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json index b9bf4f2b66ea..f477cdecc3f8 100644 --- a/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json +++ b/postman/collection-dir/authorizedotnet/Flow Testcases/Variation Cases/Scenario12-Failed case for wrong api keys/Payments - Create/request.json @@ -16,10 +16,6 @@ "amount": 7003, "currency": "USD", "confirm": true, - "routing": { - "data": "authorizedotnet", - "type": "single" - }, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "customer_id": "StripeCustomer", diff --git a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json index 21f054843897..e958012fc3be 100644 --- a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json +++ b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json @@ -78,10 +78,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json index b1d5ad5ebbf8..463f4b2f60e2 100644 --- a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json +++ b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json @@ -78,10 +78,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json index 71cc91069581..66f5c825b122 100644 --- a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json +++ b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json @@ -64,10 +64,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "bankofamerica" } } }, diff --git a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json index 5e3ff0e70ad2..5e200d2bf6f4 100644 --- a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json +++ b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json @@ -78,10 +78,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json index 5e3ff0e70ad2..5e200d2bf6f4 100644 --- a/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json +++ b/postman/collection-dir/bankofamerica/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json @@ -78,10 +78,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/bankofamerica/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/bankofamerica/Flow Testcases/QuickStart/Payments - Create/request.json index 6af4c897162c..45f95dba3983 100644 --- a/postman/collection-dir/bankofamerica/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/bankofamerica/Flow Testcases/QuickStart/Payments - Create/request.json @@ -83,10 +83,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "bankofamerica" } } }, diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/3DS Payment/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/3DS Payment/Payments - Create/request.json index f5f3112ab99b..6b628c2a8788 100644 --- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/3DS Payment/Payments - Create/request.json +++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/3DS Payment/Payments - Create/request.json @@ -71,10 +71,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "checkout" } } }, diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Create/request.json index 2c085d1319bd..cf1fb5cf8eb4 100644 --- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Create/request.json +++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Create/request.json @@ -71,10 +71,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "checkout" } } }, diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Refund After Partial Capture/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Refund After Partial Capture/Payments - Create/request.json index 2c085d1319bd..cf1fb5cf8eb4 100644 --- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Refund After Partial Capture/Payments - Create/request.json +++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Refund After Partial Capture/Payments - Create/request.json @@ -71,10 +71,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "checkout" } } }, diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Create/request.json index 2c085d1319bd..cf1fb5cf8eb4 100644 --- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Create/request.json +++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Create/request.json @@ -71,10 +71,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "checkout" } } }, diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Create/request.json b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Create/request.json index 2c085d1319bd..cf1fb5cf8eb4 100644 --- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Create/request.json +++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Create/request.json @@ -71,10 +71,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "checkout" } } }, diff --git a/postman/collection-dir/forte/Flow Testcases/Happy Cases/Scenario7-Create payment with Zero Amount/Payments - Create/request.json b/postman/collection-dir/forte/Flow Testcases/Happy Cases/Scenario7-Create payment with Zero Amount/Payments - Create/request.json index 0bf23604d848..624968c77cd9 100644 --- a/postman/collection-dir/forte/Flow Testcases/Happy Cases/Scenario7-Create payment with Zero Amount/Payments - Create/request.json +++ b/postman/collection-dir/forte/Flow Testcases/Happy Cases/Scenario7-Create payment with Zero Amount/Payments - Create/request.json @@ -30,10 +30,6 @@ "phone_country_code": "+65", "description": "Its my first payment request", "authentication_type": "no_three_ds", - "routing": { - "type": "single", - "data": "forte" - }, "return_url": "https://duck.com", "payment_method": "card", "payment_method_data": { diff --git a/postman/collection-dir/forte/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/forte/Flow Testcases/QuickStart/Payments - Create/request.json index 04be684704b6..05fde18c2d97 100644 --- a/postman/collection-dir/forte/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/forte/Flow Testcases/QuickStart/Payments - Create/request.json @@ -21,10 +21,6 @@ "amount": 6540, "currency": "USD", "confirm": true, - "routing": { - "type": "single", - "data": "forte" - }, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": 6540, diff --git a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json index 64df182d1e7b..d1361c52bc75 100644 --- a/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json +++ b/postman/collection-dir/hyperswitch/Hackathon/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json @@ -21,10 +21,6 @@ "amount": 8000, "currency": "USD", "confirm": false, - "routing": { - "type": "single", - "data": "stripe" - }, "capture_method": "automatic", "capture_on": "2022-09-10T10:11:12Z", "amount_to_capture": 6540, diff --git a/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json index a4e816ad17d2..289e780a72cb 100644 --- a/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/multisafepay/Flow Testcases/QuickStart/Payments - Create/request.json @@ -55,10 +55,6 @@ "last_name": "happy" } }, - "routing": { - "type": "single", - "data": "multisafepay" - }, "shipping": { "address": { "line1": "1467", diff --git a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/request.json b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/request.json index 525eaa739e83..289e780a72cb 100644 --- a/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/request.json +++ b/postman/collection-dir/multisafepay/Flow Testcases/Variation Cases/Scenario6- Create payment with Invalid Merchant ID/Payments - Create/request.json @@ -42,10 +42,6 @@ "card_cvc": "123" } }, - "routing": { - "type": "single", - "data": "multisafepay" - }, "billing": { "address": { "line1": "1467", diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/request.json index 9e084a35c8c9..691f63896f6a 100644 --- a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/request.json +++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/request.json @@ -65,10 +65,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "paypal" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json index 550880583066..f7cc66034d50 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json @@ -78,10 +78,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json index 2363c62ff27f..f58c425653ca 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario10-Partial refund/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json index a5c9391cf748..ed87e6ed3321 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Payments - Create/request.json @@ -89,10 +89,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/request.json index 01f47678beab..a791a4916fec 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Create a mandate and recurring payment/Recurring Payments - Create/request.json @@ -52,10 +52,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json index 599c708ba732..d5cb30f4c1b1 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Payments - Create/request.json @@ -77,10 +77,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json index 304d03350584..bb49666c4567 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario11-Refund recurring payment/Recurring Payments - Create/request.json @@ -52,10 +52,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json index f621bd52f00d..88e6597536af 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario12-BNPL-klarna/Payments - Create/request.json @@ -38,10 +38,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario13-BNPL-afterpay/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario13-BNPL-afterpay/Payments - Create/request.json index dcbeac44d9e0..5ecc4fd01c7e 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario13-BNPL-afterpay/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario13-BNPL-afterpay/Payments - Create/request.json @@ -77,10 +77,6 @@ "amount": 7000, "quantity": 1 } - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario14-BNPL-affirm/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario14-BNPL-affirm/Payments - Create/request.json index eedc71f3a1aa..3675475c0837 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario14-BNPL-affirm/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario14-BNPL-affirm/Payments - Create/request.json @@ -77,10 +77,6 @@ "amount": 7000, "quantity": 1 } - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Ideal/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Ideal/Payments - Create/request.json index 21e71ad037a9..0b0c56d26601 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Ideal/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario15-Bank Redirect-Ideal/Payments - Create/request.json @@ -76,10 +76,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-sofort/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-sofort/Payments - Create/request.json index 21e71ad037a9..0b0c56d26601 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-sofort/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario16-Bank Redirect-sofort/Payments - Create/request.json @@ -76,10 +76,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario17-Bank Redirect-eps/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario17-Bank Redirect-eps/Payments - Create/request.json index 21e71ad037a9..0b0c56d26601 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario17-Bank Redirect-eps/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario17-Bank Redirect-eps/Payments - Create/request.json @@ -76,10 +76,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-giropay/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-giropay/Payments - Create/request.json index 21e71ad037a9..0b0c56d26601 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-giropay/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario18-Bank Redirect-giropay/Payments - Create/request.json @@ -76,10 +76,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/request.json index 9612b4909870..e77acd7ae9d0 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Debit-ach/Payments - Create/request.json @@ -74,10 +74,6 @@ "amount": 1800, "account_name": "transaction_processing" } - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Transfer-ach/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Transfer-ach/Payments - Create/request.json index a96b695950af..7c134199443f 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Transfer-ach/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario19-Bank Transfer-ach/Payments - Create/request.json @@ -38,10 +38,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json index 4105bd1a869b..3e1f1231ff86 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json index 785122a83c50..b41aa02e5d0a 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22- Update address and List Payment method/Payments - Create/request.json @@ -62,10 +62,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/request.json index 731eeaf14001..700e13f25a41 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario22-Wallet-Wechatpay/Payments - Create/request.json @@ -40,10 +40,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/request.json index 785122a83c50..b41aa02e5d0a 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Create/request.json @@ -62,10 +62,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json index 2019bae87908..8b8c5041a079 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Payments - Create/request.json @@ -78,10 +78,6 @@ "country_code": "+91" } }, - "routing": { - "type": "single", - "data": "stripe" - }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Save card payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Save card payments - Create/request.json index 1f1ca9cbc54d..5890966b8b86 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Save card payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario24-Add card flow/Save card payments - Create/request.json @@ -66,10 +66,6 @@ "country_code": "+91" } }, - "routing": { - "type": "single", - "data": "stripe" - }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json index 4f02f7b68092..939fd15edd90 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Payments - Create/request.json @@ -84,10 +84,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/request.json index 55f84394c78b..5890966b8b86 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario25-Don't Pass CVV for save card flow and verifysuccess payment/Save card payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json index 988bc4b800b0..9260edb1a994 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Create/request.json @@ -84,10 +84,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Save card payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Save card payments - Create/request.json index b783ed8041e9..4c02f6d109f7 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Save card payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Save card payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/request.json index 6542d21542da..774a30a7a818 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create a failure card payment with confirm true/Payments - Create/request.json @@ -78,10 +78,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json index e37391b78b5c..cdec7110f27a 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json @@ -78,10 +78,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json index beeb5b3983f5..2f7bdae8a6af 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json @@ -62,10 +62,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json index 0619498e38c7..4deef11deb58 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json index 0619498e38c7..4deef11deb58 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json index 0619498e38c7..4deef11deb58 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario5-Void the payment/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json index d14ae6582c8a..c5743943cf09 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario6-Create 3DS payment/Payments - Create/request.json @@ -75,10 +75,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json index 14f3394596fd..72c0cf1fd9b2 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario7-Create 3DS payment with confrm false/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/request.json index 2363c62ff27f..f58c425653ca 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9-Refund full payment/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/QuickStart/Payments - Create/request.json index 0a7b19679aa6..2225c6096e37 100644 --- a/postman/collection-dir/stripe/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/QuickStart/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json index 0e1f282acdb9..02e431466aa2 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp Year)/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json index 92e81f4f53ae..52c73bea7433 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid Exp month)/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json index a8f4cf69a292..c7ad4cb2749f 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(Invalid card number)/request.json @@ -70,10 +70,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json index fdc09ce202f9..9fa8e3bbe129 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json index beeb5b3983f5..2f7bdae8a6af 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario2-Confirming the payment without PMD/Payments - Create/request.json @@ -62,10 +62,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json index 0619498e38c7..4deef11deb58 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario3-Capture greater amount/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json index 2363c62ff27f..f58c425653ca 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario4-Capture the succeeded payment/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json index 2363c62ff27f..f58c425653ca 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario5-Void the success_slash_failure payment/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario6-Create 3DS payment with greater capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario6-Create 3DS payment with greater capture/Payments - Create/request.json index c132368eb406..9c2ddbffb6d7 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario6-Create 3DS payment with greater capture/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario6-Create 3DS payment with greater capture/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json index 2363c62ff27f..f58c425653ca 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario7-Refund exceeds amount/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json index 4105bd1a869b..3e1f1231ff86 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario8-Refund for unsuccessful payment/Payments - Create/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json index a5c9391cf748..ed87e6ed3321 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Payments - Create/request.json @@ -89,10 +89,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json index 3ced4fa53275..299eb1685b71 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario9-Create a recurring payment with greater mandate amount/Recurring Payments - Create/request.json @@ -64,10 +64,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json b/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json index ac22dac750c8..4b129355b345 100644 --- a/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json +++ b/postman/collection-dir/stripe/PaymentMethods/Payments - Create/request.json @@ -84,10 +84,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Payments/Payments - Create Again/request.json b/postman/collection-dir/stripe/Payments/Payments - Create Again/request.json index 5185b04c18e2..67b3e6c95301 100644 --- a/postman/collection-dir/stripe/Payments/Payments - Create Again/request.json +++ b/postman/collection-dir/stripe/Payments/Payments - Create Again/request.json @@ -83,10 +83,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Payments/Payments - Create Yet Again/request.json b/postman/collection-dir/stripe/Payments/Payments - Create Yet Again/request.json index a7304c0a2fb5..37a587e6e3f2 100644 --- a/postman/collection-dir/stripe/Payments/Payments - Create Yet Again/request.json +++ b/postman/collection-dir/stripe/Payments/Payments - Create Yet Again/request.json @@ -83,10 +83,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Payments/Payments - Create/request.json b/postman/collection-dir/stripe/Payments/Payments - Create/request.json index 0b0e2569f1dd..f3299786f1f4 100644 --- a/postman/collection-dir/stripe/Payments/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Payments/Payments - Create/request.json @@ -83,10 +83,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/QuickStart/Payments - Create-copy/request.json b/postman/collection-dir/stripe/QuickStart/Payments - Create-copy/request.json index da1e0039c81f..5a9358e014f7 100644 --- a/postman/collection-dir/stripe/QuickStart/Payments - Create-copy/request.json +++ b/postman/collection-dir/stripe/QuickStart/Payments - Create-copy/request.json @@ -86,7 +86,10 @@ }, "routing": { "type": "single", - "data": "stripe" + "data": { + "connector":"stripe", + "merchant_connector_id":"{{merchant_connector_id}}" + } } } }, diff --git a/postman/collection-dir/stripe/QuickStart/Payments - Create/request.json b/postman/collection-dir/stripe/QuickStart/Payments - Create/request.json index e149698461ec..d07850a697f6 100644 --- a/postman/collection-dir/stripe/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/stripe/QuickStart/Payments - Create/request.json @@ -86,7 +86,10 @@ }, "routing": { "type": "single", - "data": "stripe" + "data": { + "connector":"stripe", + "merchant_connector_id":"{{merchant_connector_id}}" + } } } }, diff --git a/postman/collection-dir/stripe/Refunds/Payments - Create/request.json b/postman/collection-dir/stripe/Refunds/Payments - Create/request.json index 482cd7e25e45..20007308fe70 100644 --- a/postman/collection-dir/stripe/Refunds/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Refunds/Payments - Create/request.json @@ -84,10 +84,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json index 6bfc68500963..71163aa00927 100644 --- a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json +++ b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json @@ -82,10 +82,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "volt" } } }, diff --git a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json index a4192d96b4a7..1120353cd4fb 100644 --- a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json +++ b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json @@ -82,10 +82,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "volt" } } }, diff --git a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json index 7323f440e645..bde98e7ef082 100644 --- a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json +++ b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Create/request.json @@ -63,10 +63,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "volt" } } }, diff --git a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario4-Bank Redirect-open_banking_uk/Payments - Create/request.json b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario4-Bank Redirect-open_banking_uk/Payments - Create/request.json index 7323f440e645..bde98e7ef082 100644 --- a/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario4-Bank Redirect-open_banking_uk/Payments - Create/request.json +++ b/postman/collection-dir/volt/Flow Testcases/Happy Cases/Scenario4-Bank Redirect-open_banking_uk/Payments - Create/request.json @@ -63,10 +63,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "volt" } } }, diff --git a/postman/collection-dir/volt/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/volt/Flow Testcases/QuickStart/Payments - Create/request.json index 6bfc68500963..71163aa00927 100644 --- a/postman/collection-dir/volt/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/volt/Flow Testcases/QuickStart/Payments - Create/request.json @@ -82,10 +82,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "volt" } } }, From 4d9841b13cce2ce5fbf7a1dbcafa4d6717100de1 Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 6 Dec 2023 11:42:20 +0530 Subject: [PATCH 08/14] fmt re run --- crates/router/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 52b20b0020fc..0c1b8aee5a99 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" license.workspace = true [features] -default = ["kv_store", "stripe", "oltp", "olap","accounts_cache", "dummy_connector", "payouts", "retry" ,"frm"] +default = ["kv_store", "stripe", "oltp", "olap","accounts_cache", "dummy_connector", "payouts", "retry", "frm"] s3 = ["dep:aws-sdk-s3", "dep:aws-config"] kms = ["external_services/kms", "dep:aws-config"] email = ["external_services/email", "dep:aws-config", "olap"] From 142a487ee68d667dcca242733bf177a062ec64ef Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Thu, 14 Dec 2023 14:52:08 +0530 Subject: [PATCH 09/14] remove backwards compatibility --- crates/router/src/core/admin.rs | 6 +----- .../router/src/core/payment_methods/cards.rs | 18 ------------------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index fed1c825319a..e11c4e1fb811 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1017,13 +1017,9 @@ pub async fn create_payment_connector( if !is_unroutable_connector { if let Some(routable_connector_val) = routable_connector { let choice = routing_types::RoutableConnectorChoice { - #[cfg(feature = "backwards_compatibility")] - choice_kind: routing_types::RoutableChoiceKind::FullStruct, connector: routable_connector_val, - #[cfg(feature = "connector_choice_mca_id")] + merchant_connector_id: Some(mca.merchant_connector_id.clone()), - #[cfg(not(feature = "connector_choice_mca_id"))] - sub_label: req.business_sub_label.clone(), }; if !default_routing_config.contains(&choice) { diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 11bcd32efd17..d8d98b655819 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -30,8 +30,6 @@ use super::surcharge_decision_configs::{ perform_surcharge_decision_management_for_payment_method_list, perform_surcharge_decision_management_for_saved_cards, }; -#[cfg(not(feature = "connector_choice_mca_id"))] -use crate::core::utils::get_connector_label; use crate::{ configs::settings, core::{ @@ -1212,22 +1210,6 @@ pub async fn list_payment_methods( let mut val = Vec::new(); for (payment_method_type, routable_connector_choice) in &pre_routing_results { - #[cfg(not(feature = "connector_choice_mca_id"))] - let connector_label = get_connector_label( - payment_intent.business_country, - payment_intent.business_label.as_ref(), - #[cfg(not(feature = "connector_choice_mca_id"))] - routable_connector_choice.sub_label.as_ref(), - #[cfg(feature = "connector_choice_mca_id")] - None, - routable_connector_choice.connector.to_string().as_str(), - ); - #[cfg(not(feature = "connector_choice_mca_id"))] - let matched_mca = filtered_mcas - .iter() - .find(|m| connector_label == m.connector_label); - - #[cfg(feature = "connector_choice_mca_id")] let matched_mca = filtered_mcas.iter().find(|m| { routable_connector_choice.merchant_connector_id.as_ref() == Some(&m.merchant_connector_id) From 23252011397497c737a0634513a9ddb77eadf590 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 18:08:00 +0000 Subject: [PATCH 10/14] chore: run formatter --- .../router/src/core/payment_methods/cards.rs | 1 - crates/router/src/core/payments/routing.rs | 1 - crates/router/src/core/routing.rs | 25 +++++++++++-------- crates/router/src/routes/routing.rs | 6 +++-- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 0e0edbcd86c6..6273e1319c64 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -44,7 +44,6 @@ use super::surcharge_decision_configs::{ perform_surcharge_decision_management_for_payment_method_list, perform_surcharge_decision_management_for_saved_cards, }; - #[cfg(feature = "payouts")] use crate::types::domain::types::AsyncLift; use crate::{ diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index 13e5c5a2e2b0..f105950a786d 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -36,7 +36,6 @@ use storage_impl::redis::cache::{CacheKey, CGRAPH_CACHE, ROUTING_CACHE}; #[cfg(feature = "payouts")] use crate::core::payouts; - use crate::{ core::{ errors, errors as oss_errors, payments as payments_oss, diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index 30e1ced56552..5f10de56e471 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -1,10 +1,19 @@ pub mod helpers; pub mod transformers; +use api_models::{ + enums, + routing::{ + self as routing_types, RoutingAlgorithmId, RoutingRetrieveLinkQuery, RoutingRetrieveQuery, + }, +}; +use diesel_models::routing_algorithm::RoutingAlgorithm; +use error_stack::ResultExt; +use rustc_hash::FxHashSet; + use super::payments; #[cfg(feature = "payouts")] use super::payouts; -use crate::types::transformers::{ForeignInto, ForeignTryFrom}; use crate::{ consts, core::{ @@ -13,18 +22,12 @@ use crate::{ }, routes::SessionState, services::api as service_api, - types::domain, + types::{ + domain, + transformers::{ForeignInto, ForeignTryFrom}, + }, utils::{self, OptionExt, ValueExt}, }; -use api_models::routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery}; -use api_models::{ - enums, - routing::{self as routing_types, RoutingAlgorithmId}, -}; -use diesel_models::routing_algorithm::RoutingAlgorithm; - -use error_stack::ResultExt; -use rustc_hash::FxHashSet; pub enum TransactionData<'a, F> where diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs index a32d330e5ea3..788acd4ba2da 100644 --- a/crates/router/src/routes/routing.rs +++ b/crates/router/src/routes/routing.rs @@ -3,8 +3,10 @@ //! Functions that are used to perform the api level configuration, retrieval, updation //! of Routing configs. use actix_web::{web, HttpRequest, Responder}; -use api_models::routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery}; -use api_models::{enums, routing as routing_types}; +use api_models::{ + enums, routing as routing_types, + routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery}, +}; use router_env::{ tracing::{self, instrument}, Flow, From e15f4c87e31102709f498266f3d8044fd6262159 Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 17 Jul 2024 00:39:50 +0530 Subject: [PATCH 11/14] fix postman collection --- .../Payments - Create/request.json | 4 ---- .../Payments - Create(invalid CVV)/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 10 +++------- .../Payments - Create/request.json | 6 +----- .../QuickStart/Payments - Create/request.json | 10 +++------- .../Save card payments - Create/request.json | 12 ++---------- .../Payments - Create with confirm true/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 4 ---- .../Payments - Create/request.json | 12 ++---------- .../Payments - Create/request.json | 4 ---- 12 files changed, 11 insertions(+), 67 deletions(-) diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json index 050f353af538..e04dc7b4280f 100644 --- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json +++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario13-Create payment without customer_id and with billing address and shipping address/Payments - Create/request.json @@ -86,10 +86,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json index 07a9e0fc0b95..db81c387d5a7 100644 --- a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json +++ b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario1-Create payment with Invalid card details/Payments - Create(invalid CVV)/request.json @@ -72,10 +72,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/request.json b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/request.json index 2cbfe4a20f1e..314752373cc8 100644 --- a/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/request.json +++ b/postman/collection-dir/nmi/Flow Testcases/Variation Cases/Scenario9-Create a mandate payment/Payments - Create/request.json @@ -97,10 +97,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json index 2c8566c24282..58e786c79dbf 100644 --- a/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json +++ b/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json @@ -28,13 +28,9 @@ "payment_method": "card_redirect", "payment_method_type": "card_redirect", "payment_method_data": { - "card_redirect": { - "card_redirect": {} - } - }, - "routing": { - "type": "single", - "data": "prophetpay" + "card_redirect": { + "card_redirect": {} + } } } }, diff --git a/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json index 851a18115f97..514099b88a1a 100644 --- a/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json +++ b/postman/collection-dir/prophetpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json @@ -24,11 +24,7 @@ "amount_to_capture": 8000, "business_country": "US", "customer_id": "not_a_rick_roll", - "return_url": "https://www.google.com", - "routing": { - "type": "single", - "data": "prophetpay" - } + "return_url": "https://www.google.com" } }, "url": { diff --git a/postman/collection-dir/prophetpay/Flow Testcases/QuickStart/Payments - Create/request.json b/postman/collection-dir/prophetpay/Flow Testcases/QuickStart/Payments - Create/request.json index 11c9749e9589..5302bca0e280 100644 --- a/postman/collection-dir/prophetpay/Flow Testcases/QuickStart/Payments - Create/request.json +++ b/postman/collection-dir/prophetpay/Flow Testcases/QuickStart/Payments - Create/request.json @@ -28,13 +28,9 @@ "payment_method": "card_redirect", "payment_method_type": "card_redirect", "payment_method_data": { - "card_redirect": { - "card_redirect": {} - } - }, - "routing": { - "type": "single", - "data": "prophetpay" + "card_redirect": { + "card_redirect": {} + } } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23-Add card flow/Save card payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23-Add card flow/Save card payments - Create/request.json index 4afeccc8246d..3371960e6720 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23-Add card flow/Save card payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23-Add card flow/Save card payments - Create/request.json @@ -66,10 +66,6 @@ "country_code": "+91" } }, - "routing": { - "type": "single", - "data": "stripe" - }, "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "metadata": { @@ -81,12 +77,8 @@ }, "url": { "raw": "{{baseUrl}}/payments", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "payments" - ] + "host": ["{{baseUrl}}"], + "path": ["payments"] }, "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" } diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json index 7e28058ccf62..2fc1d3e06265 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario27-Confirm a payment with requires_customer_action status/Payments - Create with confirm true/request.json @@ -83,10 +83,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create payment with payment method billing/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create payment with payment method billing/Payments - Create/request.json index 83e3a58da2e0..578d3c472672 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create payment with payment method billing/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario28-Create payment with payment method billing/Payments - Create/request.json @@ -79,10 +79,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Update payment with payment method billing/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Update payment with payment method billing/Payments - Create/request.json index 95c2541e0bca..14381e2d55a9 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Update payment with payment method billing/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario29-Update payment with payment method billing/Payments - Create/request.json @@ -54,10 +54,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/request.json index b5f464abc14b..f58c425653ca 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario9a-Partial refund/Payments - Create/request.json @@ -72,21 +72,13 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, "url": { "raw": "{{baseUrl}}/payments", - "host": [ - "{{baseUrl}}" - ], - "path": [ - "payments" - ] + "host": ["{{baseUrl}}"], + "path": ["payments"] }, "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" } diff --git a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/request.json index 90b6e3bd0385..d6f53f92a041 100644 --- a/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/request.json +++ b/postman/collection-dir/stripe/Flow Testcases/Variation Cases/Scenario10-Refund exceeds amount captured/Payments - Create/request.json @@ -71,10 +71,6 @@ "udf1": "value1", "new_customer": "true", "login_date": "2019-09-10T10:11:12Z" - }, - "routing": { - "type": "single", - "data": "stripe" } } }, From 0e342c337d1fd911d6eb9fa8f969acaed6e72730 Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 17 Jul 2024 15:29:12 +0530 Subject: [PATCH 12/14] addressed comments --- crates/api_models/src/routing.rs | 63 ++++++++++++++++++- crates/euclid/src/frontend/ast.rs | 5 +- .../stripe/payment_intents/types.rs | 1 + .../stripe/setup_intents/types.rs | 2 +- crates/router/src/core/admin.rs | 1 + .../router/src/core/payment_methods/cards.rs | 1 + crates/router/src/types/api/routing.rs | 6 +- 7 files changed, 73 insertions(+), 6 deletions(-) diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs index dbe67f94add0..4e62a5f67d29 100644 --- a/crates/api_models/src/routing.rs +++ b/crates/api_models/src/routing.rs @@ -151,12 +151,31 @@ pub struct ConnectorVolumeSplit { } /// Routable Connector chosen for a payment -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq, ToSchema)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)] +#[serde(from = "RoutableChoiceSerde", into = "RoutableChoiceSerde")] pub struct RoutableConnectorChoice { + #[serde(skip)] + pub choice_kind: RoutableChoiceKind, pub connector: RoutableConnectors, pub merchant_connector_id: Option, } +#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)] +pub enum RoutableChoiceKind { + OnlyConnector, + FullStruct, +} + +#[derive(Debug, serde::Deserialize, serde::Serialize)] +#[serde(untagged)] +pub enum RoutableChoiceSerde { + OnlyConnector(Box), + FullStruct { + connector: RoutableConnectors, + merchant_connector_id: Option, + }, +} + impl std::fmt::Display for RoutableConnectorChoice { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let base = self.connector.to_string(); @@ -173,6 +192,48 @@ impl From for ast::ConnectorChoice { } } +impl PartialEq for RoutableConnectorChoice { + fn eq(&self, other: &Self) -> bool { + self.connector.eq(&other.connector) + && self.merchant_connector_id.eq(&other.merchant_connector_id) + } +} + +impl Eq for RoutableConnectorChoice {} + +impl From for RoutableConnectorChoice { + fn from(value: RoutableChoiceSerde) -> Self { + match value { + RoutableChoiceSerde::OnlyConnector(connector) => Self { + choice_kind: RoutableChoiceKind::OnlyConnector, + connector: *connector, + merchant_connector_id: None, + }, + + RoutableChoiceSerde::FullStruct { + connector, + merchant_connector_id, + } => Self { + choice_kind: RoutableChoiceKind::FullStruct, + connector, + merchant_connector_id, + }, + } + } +} + +impl From for RoutableChoiceSerde { + fn from(value: RoutableConnectorChoice) -> Self { + match value.choice_kind { + RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)), + RoutableChoiceKind::FullStruct => Self::FullStruct { + connector: value.connector, + merchant_connector_id: value.merchant_connector_id, + }, + } + } +} + #[derive(Debug, Copy, Clone, serde::Serialize, serde::Deserialize, strum::Display, ToSchema)] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] diff --git a/crates/euclid/src/frontend/ast.rs b/crates/euclid/src/frontend/ast.rs index 1c0d02fbdb1b..c77736effa9b 100644 --- a/crates/euclid/src/frontend/ast.rs +++ b/crates/euclid/src/frontend/ast.rs @@ -161,13 +161,16 @@ pub struct Program { #[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] pub struct RoutableConnectorChoice { + #[serde(skip)] + pub choice_kind: RoutableChoiceKind, pub connector: RoutableConnectors, pub merchant_connector_id: Option, } -#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)] +#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)] pub enum RoutableChoiceKind { OnlyConnector, + #[default] FullStruct, } diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs index 709109fd7d4f..fa1949da2c8b 100644 --- a/crates/router/src/compatibility/stripe/payment_intents/types.rs +++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs @@ -293,6 +293,7 @@ impl TryFrom for payments::PaymentsRequest { .map(|connector| { api_models::routing::RoutingAlgorithm::Single(Box::new( api_models::routing::RoutableConnectorChoice { + choice_kind: api_models::routing::RoutableChoiceKind::FullStruct, connector, merchant_connector_id: None, }, diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs index b105b811fadf..b1df95116be7 100644 --- a/crates/router/src/compatibility/stripe/setup_intents/types.rs +++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs @@ -189,8 +189,8 @@ impl TryFrom for payments::PaymentsRequest { .map(|connector| { api_models::routing::RoutingAlgorithm::Single(Box::new( api_models::routing::RoutableConnectorChoice { + choice_kind: api_models::routing::RoutableChoiceKind::FullStruct, connector, - merchant_connector_id: None, }, )) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 9fa8b275e962..85ce16d7ebb9 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1340,6 +1340,7 @@ pub async fn create_payment_connector( if let Some(routable_connector_val) = routable_connector { let choice = routing_types::RoutableConnectorChoice { + choice_kind: routing_types::RoutableChoiceKind::FullStruct, connector: routable_connector_val, merchant_connector_id: Some(mca.merchant_connector_id.clone()), }; diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index dabd24e5b2aa..5a4d40ef85ee 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -2575,6 +2575,7 @@ pub async fn list_payment_methods( let mut routable_choice_list = vec![]; for choice in routing_choice { let routable_choice = routing_types::RoutableConnectorChoice { + choice_kind: routing_types::RoutableChoiceKind::FullStruct, connector: choice .connector .connector_name diff --git a/crates/router/src/types/api/routing.rs b/crates/router/src/types/api/routing.rs index c2648fa5cee3..d201f57eb924 100644 --- a/crates/router/src/types/api/routing.rs +++ b/crates/router/src/types/api/routing.rs @@ -1,9 +1,9 @@ pub use api_models::{ enums as api_enums, routing::{ - ConnectorVolumeSplit, RoutableConnectorChoice, RoutingAlgorithm, RoutingAlgorithmKind, - RoutingAlgorithmRef, RoutingConfigRequest, RoutingDictionary, RoutingDictionaryRecord, - StraightThroughAlgorithm, + ConnectorVolumeSplit, RoutableChoiceKind, RoutableConnectorChoice, RoutingAlgorithm, + RoutingAlgorithmKind, RoutingAlgorithmRef, RoutingConfigRequest, RoutingDictionary, + RoutingDictionaryRecord, StraightThroughAlgorithm, }, }; From f5cb11aa5b1a920f08c23db72e33f7cae59264ce Mon Sep 17 00:00:00 2001 From: Aprabhat19 Date: Wed, 17 Jul 2024 18:40:39 +0530 Subject: [PATCH 13/14] remove unnecessary comma --- crates/euclid_wasm/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index 933a7a7ef30f..be8f61240d66 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -11,7 +11,7 @@ license.workspace = true crate-type = ["cdylib"] [features] -default = ["payouts", ] +default = ["payouts"] release = ["payouts"] dummy_connector = ["kgraph_utils/dummy_connector", "connector_configs/dummy_connector"] production = ["connector_configs/production"] From 56a40b5b1d9911cc4d87a45370da0778824d88f2 Mon Sep 17 00:00:00 2001 From: Amisha Prabhat <55580080+Aprabhat19@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:21:08 +0530 Subject: [PATCH 14/14] Update crates/router/src/core/payments.rs Co-authored-by: Shanks --- crates/router/src/core/payments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 6681560feee6..5a9b43e165a9 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -3192,7 +3192,7 @@ where .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received in 'routed_through'")?; - routing_data.routed_through = Some(connector_name.clone().to_owned()); + routing_data.routed_through = Some(connector_name.clone()); return Ok(ConnectorCallType::PreDetermined(connector_data)); }