mirror of
https://github.com/juspay/hyperswitch.git
synced 2026-03-13 09:02:06 +08:00
feat(core): add profile level config for debit routing feature (#7470)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Sayak Bhattacharya <sayak.b@Sayak-Bhattacharya-G092THXJ34.local> Co-authored-by: Sayak Bhattacharya <sayakofficial21@gmail.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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>,
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE business_profile
|
||||
DROP COLUMN is_debit_routing_enabled;
|
||||
@@ -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;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE business_profile
|
||||
DROP COLUMN IF EXISTS merchant_business_country;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Your SQL goes here
|
||||
ALTER TABLE business_profile
|
||||
ADD COLUMN IF NOT EXISTS merchant_business_country "CountryAlpha2" DEFAULT NULL;
|
||||
Reference in New Issue
Block a user