Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(core): add profile level config for debit routing feature (#7470)

Prasunna Soppa8e854657c962
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index bf26710b42..a9de9611e5 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -19196,6 +19196,19 @@
"type": "boolean",
"description": "Indicates if clear pan retries is enabled or not.",
"nullable": true
+ },
+ "is_debit_routing_enabled": {
+ "type": "boolean",
+ "description": "Indicates if debit routing is enabled or not",
+ "nullable": true
+ },
+ "merchant_business_country": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -19433,6 +19446,19 @@
"is_clear_pan_retries_enabled": {
"type": "boolean",
"description": "Indicates if clear pan retries is enabled or not."
+ },
+ "is_debit_routing_enabled": {
+ "type": "boolean",
+ "description": "Indicates if debit routing is enabled or not",
+ "nullable": true
+ },
+ "merchant_business_country": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index 67f26c307b..da14c85cf6 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -23657,6 +23657,19 @@
"type": "boolean",
"description": "Indicates if 3ds challenge is forced",
"nullable": true
+ },
+ "is_debit_routing_enabled": {
+ "type": "boolean",
+ "description": "Indicates if debit routing is enabled or not",
+ "nullable": true
+ },
+ "merchant_business_country": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -23921,6 +23934,19 @@
"force_3ds_challenge": {
"type": "boolean",
"description": "Indicates if 3ds challenge is forced"
+ },
+ "is_debit_routing_enabled": {
+ "type": "boolean",
+ "description": "Indicates if debit routing is enabled or not",
+ "nullable": true
+ },
+ "merchant_business_country": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 34ca629725..df648f5013 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -1985,6 +1985,14 @@ pub struct ProfileCreate {
/// Indicates if 3ds challenge is forced
pub force_3ds_challenge: Option<bool>,
+
+ /// Indicates if debit routing is enabled or not
+ #[schema(value_type = Option<bool>)]
+ pub is_debit_routing_enabled: Option<bool>,
+
+ //Merchant country for the profile
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[nutype::nutype(
@@ -2109,6 +2117,14 @@ pub struct ProfileCreate {
///Indicates if clear pan retries is enabled or not.
pub is_clear_pan_retries_enabled: Option<bool>,
+
+ /// Indicates if debit routing is enabled or not
+ #[schema(value_type = Option<bool>)]
+ pub is_debit_routing_enabled: Option<bool>,
+
+ //Merchant country for the profile
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -2259,6 +2275,14 @@ pub struct ProfileResponse {
/// Indicates if 3ds challenge is forced
pub force_3ds_challenge: bool,
+
+ /// Indicates if debit routing is enabled or not
+ #[schema(value_type = Option<bool>)]
+ pub is_debit_routing_enabled: Option<bool>,
+
+ //Merchant country for the profile
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v2")]
@@ -2389,6 +2413,14 @@ pub struct ProfileResponse {
///Indicates if clear pan retries is enabled or not.
pub is_clear_pan_retries_enabled: bool,
+
+ /// Indicates if debit routing is enabled or not
+ #[schema(value_type = Option<bool>)]
+ pub is_debit_routing_enabled: Option<bool>,
+
+ //Merchant country for the profile
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -2529,6 +2561,14 @@ pub struct ProfileUpdate {
/// Indicates if 3ds challenge is forced
pub force_3ds_challenge: Option<bool>,
+
+ /// Indicates if debit routing is enabled or not
+ #[schema(value_type = Option<bool>)]
+ pub is_debit_routing_enabled: Option<bool>,
+
+ //Merchant country for the profile
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v2")]
@@ -2647,6 +2687,14 @@ pub struct ProfileUpdate {
///Indicates if clear pan retries is enabled or not.
pub is_clear_pan_retries_enabled: Option<bool>,
+
+ /// Indicates if debit routing is enabled or not
+ #[schema(value_type = Option<bool>)]
+ pub is_debit_routing_enabled: Option<bool>,
+
+ //Merchant country for the profile
+ #[schema(value_type = Option<CountryAlpha2>, example = "US")]
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index a5beb6d4d7..ca1fe56a77 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -66,6 +66,8 @@ pub struct Profile {
pub card_testing_secret_key: Option<Encryption>,
pub is_clear_pan_retries_enabled: bool,
pub force_3ds_challenge: Option<bool>,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<common_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -116,6 +118,8 @@ pub struct ProfileNew {
pub card_testing_secret_key: Option<Encryption>,
pub is_clear_pan_retries_enabled: bool,
pub force_3ds_challenge: Option<bool>,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<common_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -164,6 +168,8 @@ pub struct ProfileUpdateInternal {
pub card_testing_secret_key: Option<Encryption>,
pub is_clear_pan_retries_enabled: Option<bool>,
pub force_3ds_challenge: Option<bool>,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<common_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -210,6 +216,8 @@ impl ProfileUpdateInternal {
card_testing_secret_key,
is_clear_pan_retries_enabled,
force_3ds_challenge,
+ is_debit_routing_enabled,
+ merchant_business_country,
} = self;
Profile {
profile_id: source.profile_id,
@@ -281,6 +289,9 @@ impl ProfileUpdateInternal {
is_clear_pan_retries_enabled: is_clear_pan_retries_enabled
.unwrap_or(source.is_clear_pan_retries_enabled),
force_3ds_challenge,
+ is_debit_routing_enabled,
+ merchant_business_country: merchant_business_country
+ .or(source.merchant_business_country),
}
}
}
@@ -335,6 +346,8 @@ pub struct Profile {
pub card_testing_secret_key: Option<Encryption>,
pub is_clear_pan_retries_enabled: bool,
pub force_3ds_challenge: Option<bool>,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<common_enums::CountryAlpha2>,
pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@@ -390,14 +403,6 @@ pub struct ProfileNew {
pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
pub tax_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub is_tax_connector_enabled: Option<bool>,
- pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
- pub order_fulfillment_time: Option<i64>,
- pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
- pub frm_routing_algorithm_id: Option<String>,
- pub payout_routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
- pub default_fallback_routing: Option<pii::SecretSerdeValue>,
- pub should_collect_cvv_during_payment: bool,
- pub id: common_utils::id_type::ProfileId,
pub version: common_enums::ApiVersion,
pub is_network_tokenization_enabled: bool,
pub is_auto_retries_enabled: Option<bool>,
@@ -405,10 +410,20 @@ pub struct ProfileNew {
pub is_click_to_pay_enabled: bool,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
- pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
pub card_testing_secret_key: Option<Encryption>,
pub is_clear_pan_retries_enabled: Option<bool>,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<common_enums::CountryAlpha2>,
+ pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
+ pub order_fulfillment_time: Option<i64>,
+ pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
+ pub frm_routing_algorithm_id: Option<String>,
+ pub payout_routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
+ pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub should_collect_cvv_during_payment: bool,
+ pub id: common_utils::id_type::ProfileId,
}
#[cfg(feature = "v2")]
@@ -441,23 +456,25 @@ pub struct ProfileUpdateInternal {
pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
pub tax_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub is_tax_connector_enabled: Option<bool>,
- pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
- pub order_fulfillment_time: Option<i64>,
- pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
- pub frm_routing_algorithm_id: Option<String>,
- pub payout_routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
- pub default_fallback_routing: Option<pii::SecretSerdeValue>,
- pub should_collect_cvv_during_payment: Option<bool>,
pub is_network_tokenization_enabled: Option<bool>,
pub is_auto_retries_enabled: Option<bool>,
pub max_auto_retries_enabled: Option<i16>,
pub is_click_to_pay_enabled: Option<bool>,
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
- pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
pub card_testing_secret_key: Option<Encryption>,
pub is_clear_pan_retries_enabled: Option<bool>,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<common_enums::CountryAlpha2>,
+ pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
+ pub order_fulfillment_time: Option<i64>,
+ pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
+ pub frm_routing_algorithm_id: Option<String>,
+ pub payout_routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
+ pub default_fallback_routing: Option<pii::SecretSerdeValue>,
+ pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
+ pub should_collect_cvv_during_payment: Option<bool>,
}
#[cfg(feature = "v2")]
@@ -505,6 +522,8 @@ impl ProfileUpdateInternal {
card_testing_guard_config,
card_testing_secret_key,
is_clear_pan_retries_enabled,
+ is_debit_routing_enabled,
+ merchant_business_country,
} = self;
Profile {
id: source.id,
@@ -582,6 +601,9 @@ impl ProfileUpdateInternal {
is_clear_pan_retries_enabled: is_clear_pan_retries_enabled
.unwrap_or(source.is_clear_pan_retries_enabled),
force_3ds_challenge: None,
+ is_debit_routing_enabled,
+ merchant_business_country: merchant_business_country
+ .or(source.merchant_business_country),
}
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 4e2ba4811b..96f734da10 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -221,6 +221,8 @@ diesel::table! {
card_testing_secret_key -> Nullable<Bytea>,
is_clear_pan_retries_enabled -> Bool,
force_3ds_challenge -> Nullable<Bool>,
+ is_debit_routing_enabled -> Bool,
+ merchant_business_country -> Nullable<CountryAlpha2>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 587ef72fbe..dea417f36d 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -217,6 +217,8 @@ diesel::table! {
card_testing_secret_key -> Nullable<Bytea>,
is_clear_pan_retries_enabled -> Bool,
force_3ds_challenge -> Nullable<Bool>,
+ is_debit_routing_enabled -> Bool,
+ merchant_business_country -> Nullable<CountryAlpha2>,
#[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time -> Nullable<Int8>,
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 810ff1bb9c..5170bd3ce2 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -1,3 +1,4 @@
+use common_enums::enums as api_enums;
use common_types::primitive_wrappers::AlwaysRequestExtendedAuthorization;
use common_utils::{
crypto::{OptionalEncryptableName, OptionalEncryptableValue},
@@ -67,6 +68,8 @@ pub struct Profile {
pub card_testing_secret_key: OptionalEncryptableName,
pub is_clear_pan_retries_enabled: bool,
pub force_3ds_challenge: bool,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<common_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -115,6 +118,8 @@ pub struct ProfileSetter {
pub card_testing_secret_key: OptionalEncryptableName,
pub is_clear_pan_retries_enabled: bool,
pub force_3ds_challenge: bool,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -169,6 +174,8 @@ impl From<ProfileSetter> for Profile {
card_testing_secret_key: value.card_testing_secret_key,
is_clear_pan_retries_enabled: value.is_clear_pan_retries_enabled,
force_3ds_challenge: value.force_3ds_challenge,
+ is_debit_routing_enabled: value.is_debit_routing_enabled,
+ merchant_business_country: value.merchant_business_country,
}
}
}
@@ -225,6 +232,8 @@ pub struct ProfileGeneralUpdate {
pub card_testing_secret_key: OptionalEncryptableName,
pub is_clear_pan_retries_enabled: Option<bool>,
pub force_3ds_challenge: Option<bool>,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v1")]
@@ -296,6 +305,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key,
is_clear_pan_retries_enabled,
force_3ds_challenge,
+ is_debit_routing_enabled,
+ merchant_business_country,
} = *update;
Self {
@@ -340,6 +351,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled,
force_3ds_challenge,
+ is_debit_routing_enabled,
+ merchant_business_country,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -386,6 +399,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
force_3ds_challenge: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm,
@@ -430,6 +445,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
force_3ds_challenge: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -474,6 +491,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
force_3ds_challenge: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -518,6 +537,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
force_3ds_challenge: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -562,6 +583,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
force_3ds_challenge: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -606,6 +629,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled: None,
force_3ds_challenge: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
}
}
@@ -669,6 +694,8 @@ impl super::behaviour::Conversion for Profile {
card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),
is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,
force_3ds_challenge: Some(self.force_3ds_challenge),
+ is_debit_routing_enabled: self.is_debit_routing_enabled,
+ merchant_business_country: self.merchant_business_country,
})
}
@@ -757,6 +784,8 @@ impl super::behaviour::Conversion for Profile {
.await?,
is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,
force_3ds_challenge: item.force_3ds_challenge.unwrap_or_default(),
+ is_debit_routing_enabled: item.is_debit_routing_enabled,
+ merchant_business_country: item.merchant_business_country,
})
}
.await
@@ -815,6 +844,8 @@ impl super::behaviour::Conversion for Profile {
card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,
force_3ds_challenge: Some(self.force_3ds_challenge),
+ is_debit_routing_enabled: self.is_debit_routing_enabled,
+ merchant_business_country: self.merchant_business_country,
})
}
}
@@ -866,6 +897,8 @@ pub struct Profile {
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
pub card_testing_secret_key: OptionalEncryptableName,
pub is_clear_pan_retries_enabled: bool,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v2")]
@@ -913,6 +946,8 @@ pub struct ProfileSetter {
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
pub card_testing_secret_key: OptionalEncryptableName,
pub is_clear_pan_retries_enabled: bool,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v2")]
@@ -966,6 +1001,8 @@ impl From<ProfileSetter> for Profile {
card_testing_guard_config: value.card_testing_guard_config,
card_testing_secret_key: value.card_testing_secret_key,
is_clear_pan_retries_enabled: value.is_clear_pan_retries_enabled,
+ is_debit_routing_enabled: value.is_debit_routing_enabled,
+ merchant_business_country: value.merchant_business_country,
}
}
}
@@ -1022,6 +1059,8 @@ pub struct ProfileGeneralUpdate {
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
pub card_testing_secret_key: OptionalEncryptableName,
+ pub is_debit_routing_enabled: bool,
+ pub merchant_business_country: Option<api_enums::CountryAlpha2>,
}
#[cfg(feature = "v2")]
@@ -1091,6 +1130,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
three_ds_decision_manager_config,
card_testing_guard_config,
card_testing_secret_key,
+ is_debit_routing_enabled,
+ merchant_business_country,
} = *update;
Self {
profile_name,
@@ -1135,6 +1176,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config,
card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled,
+ merchant_business_country,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -1182,6 +1225,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -1227,6 +1272,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -1272,6 +1319,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
@@ -1317,6 +1366,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -1362,6 +1413,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
@@ -1407,6 +1460,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::DecisionManagerRecordUpdate {
three_ds_decision_manager_config,
@@ -1452,6 +1507,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -1497,6 +1554,8 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
card_testing_guard_config: None,
card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled: None,
+ is_debit_routing_enabled: false,
+ merchant_business_country: None,
},
}
}
@@ -1564,6 +1623,8 @@ impl super::behaviour::Conversion for Profile {
card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),
is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,
force_3ds_challenge: None,
+ is_debit_routing_enabled: self.is_debit_routing_enabled,
+ merchant_business_country: self.merchant_business_country,
})
}
@@ -1651,6 +1712,8 @@ impl super::behaviour::Conversion for Profile {
})
.await?,
is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,
+ is_debit_routing_enabled: item.is_debit_routing_enabled,
+ merchant_business_country: item.merchant_business_country,
})
}
.await
@@ -1712,6 +1775,8 @@ impl super::behaviour::Conversion for Profile {
card_testing_guard_config: self.card_testing_guard_config,
card_testing_secret_key: self.card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled: Some(self.is_clear_pan_retries_enabled),
+ is_debit_routing_enabled: self.is_debit_routing_enabled,
+ merchant_business_country: self.merchant_business_country,
})
}
}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 5056660b6b..27b46c4cd3 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3808,6 +3808,8 @@ impl ProfileCreateBridge for api::ProfileCreate {
.attach_printable("error while generating card testing secret key")?,
is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled.unwrap_or_default(),
force_3ds_challenge: self.force_3ds_challenge.unwrap_or_default(),
+ is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),
+ merchant_business_country: self.merchant_business_country,
}))
}
@@ -3963,6 +3965,8 @@ impl ProfileCreateBridge for api::ProfileCreate {
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("error while generating card testing secret key")?,
is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled.unwrap_or_default(),
+ is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),
+ merchant_business_country: self.merchant_business_country,
}))
}
}
@@ -4249,7 +4253,9 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
.map(ForeignInto::foreign_into),
card_testing_secret_key,
is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,
- force_3ds_challenge: self.force_3ds_challenge,
+ force_3ds_challenge: self.force_3ds_challenge, //
+ is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),
+ merchant_business_country: self.merchant_business_country,
},
)))
}
@@ -4382,6 +4388,8 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
.card_testing_guard_config
.map(ForeignInto::foreign_into),
card_testing_secret_key,
+ is_debit_routing_enabled: self.is_debit_routing_enabled.unwrap_or_default(),
+ merchant_business_country: self.merchant_business_country,
},
)))
}
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 27136cc3ea..b72b47be16 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -191,6 +191,8 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
.map(ForeignInto::foreign_into),
is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,
force_3ds_challenge: item.force_3ds_challenge,
+ is_debit_routing_enabled: Some(item.is_debit_routing_enabled),
+ merchant_business_country: item.merchant_business_country,
})
}
}
@@ -266,6 +268,8 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
.card_testing_guard_config
.map(ForeignInto::foreign_into),
is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,
+ is_debit_routing_enabled: Some(item.is_debit_routing_enabled),
+ merchant_business_country: item.merchant_business_country,
})
}
}
@@ -442,5 +446,7 @@ pub async fn create_profile_from_merchant_account(
.attach_printable("error while generating card testing secret key")?,
is_clear_pan_retries_enabled: request.is_clear_pan_retries_enabled.unwrap_or_default(),
force_3ds_challenge: request.force_3ds_challenge.unwrap_or_default(),
+ is_debit_routing_enabled: request.is_debit_routing_enabled.unwrap_or_default(),
+ merchant_business_country: request.merchant_business_country,
}))
}
diff --git a/migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/down.sql b/migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/down.sql
new file mode 100644
index 0000000000..eb45201e0e
--- /dev/null
+++ b/migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile
+DROP COLUMN is_debit_routing_enabled;
\ No newline at end of file
diff --git a/migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/up.sql b/migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/up.sql
new file mode 100644
index 0000000000..b6dead1450
--- /dev/null
+++ b/migrations/2025-03-10-103959_add_is_debit_routing_enabled_to_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS is_debit_routing_enabled BOOLEAN NOT NULL DEFAULT FALSE;
\ No newline at end of file
diff --git a/migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/down.sql b/migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/down.sql
new file mode 100644
index 0000000000..e7f46ddf1c
--- /dev/null
+++ b/migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile
+DROP COLUMN IF EXISTS merchant_business_country;
\ No newline at end of file
diff --git a/migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/up.sql b/migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/up.sql
new file mode 100644
index 0000000000..e3a386e889
--- /dev/null
+++ b/migrations/2025-03-21-134323_add_merchant_business_country_in_business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS merchant_business_country "CountryAlpha2" DEFAULT NULL;
\ No newline at end of file