feat(router): add three_ds_decision_rule_algorithm to the domain and diesel models of business_profile (#8106)

This commit is contained in:
Sai Harsha Vardhan
2025-05-23 12:43:45 +05:30
committed by GitHub
parent 3a451907a4
commit c0cda41bd0
7 changed files with 30 additions and 0 deletions

View File

@ -73,6 +73,7 @@ pub struct Profile {
pub id: Option<common_utils::id_type::ProfileId>, pub id: Option<common_utils::id_type::ProfileId>,
pub is_iframe_redirection_enabled: Option<bool>, pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: Option<bool>, pub is_pre_network_tokenization_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
} }
#[cfg(feature = "v1")] #[cfg(feature = "v1")]
@ -181,6 +182,7 @@ pub struct ProfileUpdateInternal {
pub merchant_business_country: Option<common_enums::CountryAlpha2>, pub merchant_business_country: Option<common_enums::CountryAlpha2>,
pub is_iframe_redirection_enabled: Option<bool>, pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: Option<bool>, pub is_pre_network_tokenization_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
} }
#[cfg(feature = "v1")] #[cfg(feature = "v1")]
@ -231,6 +233,7 @@ impl ProfileUpdateInternal {
merchant_business_country, merchant_business_country,
is_iframe_redirection_enabled, is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled, is_pre_network_tokenization_enabled,
three_ds_decision_rule_algorithm,
} = self; } = self;
Profile { Profile {
profile_id: source.profile_id, profile_id: source.profile_id,
@ -310,6 +313,8 @@ impl ProfileUpdateInternal {
.or(source.is_iframe_redirection_enabled), .or(source.is_iframe_redirection_enabled),
is_pre_network_tokenization_enabled: is_pre_network_tokenization_enabled is_pre_network_tokenization_enabled: is_pre_network_tokenization_enabled
.or(source.is_pre_network_tokenization_enabled), .or(source.is_pre_network_tokenization_enabled),
three_ds_decision_rule_algorithm: three_ds_decision_rule_algorithm
.or(source.three_ds_decision_rule_algorithm),
} }
} }
} }
@ -369,6 +374,7 @@ pub struct Profile {
pub merchant_business_country: Option<common_enums::CountryAlpha2>, pub merchant_business_country: Option<common_enums::CountryAlpha2>,
pub id: common_utils::id_type::ProfileId, pub id: common_utils::id_type::ProfileId,
pub is_iframe_redirection_enabled: Option<bool>, pub is_iframe_redirection_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>, pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,
pub order_fulfillment_time: Option<i64>, pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>, pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@ -656,6 +662,7 @@ impl ProfileUpdateInternal {
.or(source.is_external_vault_enabled), .or(source.is_external_vault_enabled),
external_vault_connector_details: external_vault_connector_details external_vault_connector_details: external_vault_connector_details
.or(source.external_vault_connector_details), .or(source.external_vault_connector_details),
three_ds_decision_rule_algorithm: None,
} }
} }
} }

View File

@ -227,6 +227,7 @@ diesel::table! {
id -> Nullable<Varchar>, id -> Nullable<Varchar>,
is_iframe_redirection_enabled -> Nullable<Bool>, is_iframe_redirection_enabled -> Nullable<Bool>,
is_pre_network_tokenization_enabled -> Nullable<Bool>, is_pre_network_tokenization_enabled -> Nullable<Bool>,
three_ds_decision_rule_algorithm -> Nullable<Jsonb>,
} }
} }

View File

@ -222,6 +222,7 @@ diesel::table! {
#[max_length = 64] #[max_length = 64]
id -> Varchar, id -> Varchar,
is_iframe_redirection_enabled -> Nullable<Bool>, is_iframe_redirection_enabled -> Nullable<Bool>,
three_ds_decision_rule_algorithm -> Nullable<Jsonb>,
#[max_length = 64] #[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>, routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time -> Nullable<Int8>, order_fulfillment_time -> Nullable<Int8>,

View File

@ -75,6 +75,7 @@ pub struct Profile {
pub merchant_business_country: Option<common_enums::CountryAlpha2>, pub merchant_business_country: Option<common_enums::CountryAlpha2>,
pub is_iframe_redirection_enabled: Option<bool>, pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: bool, pub is_pre_network_tokenization_enabled: bool,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
} }
#[cfg(feature = "v1")] #[cfg(feature = "v1")]
@ -186,6 +187,7 @@ impl From<ProfileSetter> for Profile {
merchant_business_country: value.merchant_business_country, merchant_business_country: value.merchant_business_country,
is_iframe_redirection_enabled: value.is_iframe_redirection_enabled, is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled: value.is_pre_network_tokenization_enabled, is_pre_network_tokenization_enabled: value.is_pre_network_tokenization_enabled,
three_ds_decision_rule_algorithm: None, // three_ds_decision_rule_algorithm is not yet created during profile creation
} }
} }
} }
@ -255,6 +257,7 @@ pub enum ProfileUpdate {
RoutingAlgorithmUpdate { RoutingAlgorithmUpdate {
routing_algorithm: Option<serde_json::Value>, routing_algorithm: Option<serde_json::Value>,
payout_routing_algorithm: Option<serde_json::Value>, payout_routing_algorithm: Option<serde_json::Value>,
three_ds_decision_rule_algorithm: Option<serde_json::Value>,
}, },
DynamicRoutingAlgorithmUpdate { DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm: Option<serde_json::Value>, dynamic_routing_algorithm: Option<serde_json::Value>,
@ -369,11 +372,13 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country, merchant_business_country,
is_iframe_redirection_enabled, is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled, is_pre_network_tokenization_enabled,
three_ds_decision_rule_algorithm: None,
} }
} }
ProfileUpdate::RoutingAlgorithmUpdate { ProfileUpdate::RoutingAlgorithmUpdate {
routing_algorithm, routing_algorithm,
payout_routing_algorithm, payout_routing_algorithm,
three_ds_decision_rule_algorithm,
} => Self { } => Self {
profile_name: None, profile_name: None,
modified_at: now, modified_at: now,
@ -419,6 +424,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None, merchant_business_country: None,
is_iframe_redirection_enabled: None, is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None, is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm,
}, },
ProfileUpdate::DynamicRoutingAlgorithmUpdate { ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm, dynamic_routing_algorithm,
@ -467,6 +473,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None, merchant_business_country: None,
is_iframe_redirection_enabled: None, is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None, is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
}, },
ProfileUpdate::ExtendedCardInfoUpdate { ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled, is_extended_card_info_enabled,
@ -515,6 +522,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None, merchant_business_country: None,
is_iframe_redirection_enabled: None, is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None, is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
}, },
ProfileUpdate::ConnectorAgnosticMitUpdate { ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled, is_connector_agnostic_mit_enabled,
@ -563,6 +571,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None, merchant_business_country: None,
is_iframe_redirection_enabled: None, is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None, is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
}, },
ProfileUpdate::NetworkTokenizationUpdate { ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled, is_network_tokenization_enabled,
@ -611,6 +620,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None, merchant_business_country: None,
is_iframe_redirection_enabled: None, is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None, is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
}, },
ProfileUpdate::CardTestingSecretKeyUpdate { ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key, card_testing_secret_key,
@ -659,6 +669,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None, merchant_business_country: None,
is_iframe_redirection_enabled: None, is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None, is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
}, },
} }
} }
@ -727,6 +738,7 @@ impl super::behaviour::Conversion for Profile {
merchant_business_country: self.merchant_business_country, merchant_business_country: self.merchant_business_country,
is_iframe_redirection_enabled: self.is_iframe_redirection_enabled, is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled), is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled),
three_ds_decision_rule_algorithm: self.three_ds_decision_rule_algorithm,
}) })
} }
@ -821,6 +833,7 @@ impl super::behaviour::Conversion for Profile {
is_pre_network_tokenization_enabled: item is_pre_network_tokenization_enabled: item
.is_pre_network_tokenization_enabled .is_pre_network_tokenization_enabled
.unwrap_or(false), .unwrap_or(false),
three_ds_decision_rule_algorithm: item.three_ds_decision_rule_algorithm,
}) })
} }
.await .await
@ -1806,6 +1819,7 @@ impl super::behaviour::Conversion for Profile {
is_iframe_redirection_enabled: self.is_iframe_redirection_enabled, is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,
is_external_vault_enabled: self.is_external_vault_enabled, is_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self.external_vault_connector_details, external_vault_connector_details: self.external_vault_connector_details,
three_ds_decision_rule_algorithm: None,
}) })
} }

View File

@ -260,6 +260,7 @@ pub async fn update_profile_active_algorithm_ref(
let business_profile_update = domain::ProfileUpdate::RoutingAlgorithmUpdate { let business_profile_update = domain::ProfileUpdate::RoutingAlgorithmUpdate {
routing_algorithm, routing_algorithm,
payout_routing_algorithm, payout_routing_algorithm,
three_ds_decision_rule_algorithm: None,
}; };
db.update_profile_by_profile_id( db.update_profile_by_profile_id(

View File

@ -0,0 +1,3 @@
-- This file should undo anything in `up.sql`
ALTER TABLE business_profile
DROP COLUMN three_ds_decision_rule_algorithm;

View File

@ -0,0 +1,3 @@
-- Your SQL goes here
ALTER TABLE business_profile
ADD COLUMN three_ds_decision_rule_algorithm JSONB;