Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/diesel_models/src/business_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub struct Profile {
pub id: Option<common_utils::id_type::ProfileId>,
pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -181,6 +182,7 @@ pub struct ProfileUpdateInternal {
pub merchant_business_country: Option<common_enums::CountryAlpha2>,
pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -231,6 +233,7 @@ impl ProfileUpdateInternal {
merchant_business_country,
is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled,
three_ds_decision_rule_algorithm,
} = self;
Profile {
profile_id: source.profile_id,
Expand Down Expand Up @@ -310,6 +313,8 @@ impl ProfileUpdateInternal {
.or(source.is_iframe_redirection_enabled),
is_pre_network_tokenization_enabled: 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),
}
}
}
Expand Down Expand Up @@ -369,6 +374,7 @@ pub struct Profile {
pub merchant_business_country: Option<common_enums::CountryAlpha2>,
pub id: common_utils::id_type::ProfileId,
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 order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
Expand Down Expand Up @@ -656,6 +662,7 @@ impl ProfileUpdateInternal {
.or(source.is_external_vault_enabled),
external_vault_connector_details: external_vault_connector_details
.or(source.external_vault_connector_details),
three_ds_decision_rule_algorithm: None,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/diesel_models/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ diesel::table! {
id -> Nullable<Varchar>,
is_iframe_redirection_enabled -> Nullable<Bool>,
is_pre_network_tokenization_enabled -> Nullable<Bool>,
three_ds_decision_rule_algorithm -> Nullable<Jsonb>,
}
}

Expand Down
1 change: 1 addition & 0 deletions crates/diesel_models/src/schema_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ diesel::table! {
#[max_length = 64]
id -> Varchar,
is_iframe_redirection_enabled -> Nullable<Bool>,
three_ds_decision_rule_algorithm -> Nullable<Jsonb>,
#[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time -> Nullable<Int8>,
Expand Down
14 changes: 14 additions & 0 deletions crates/hyperswitch_domain_models/src/business_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub struct Profile {
pub merchant_business_country: Option<common_enums::CountryAlpha2>,
pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: bool,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
}

#[cfg(feature = "v1")]
Expand Down Expand Up @@ -186,6 +187,7 @@ impl From<ProfileSetter> for Profile {
merchant_business_country: value.merchant_business_country,
is_iframe_redirection_enabled: value.is_iframe_redirection_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
}
}
}
Expand Down Expand Up @@ -255,6 +257,7 @@ pub enum ProfileUpdate {
RoutingAlgorithmUpdate {
routing_algorithm: Option<serde_json::Value>,
payout_routing_algorithm: Option<serde_json::Value>,
three_ds_decision_rule_algorithm: Option<serde_json::Value>,
},
DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm: Option<serde_json::Value>,
Expand Down Expand Up @@ -369,11 +372,13 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country,
is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled,
three_ds_decision_rule_algorithm: None,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
routing_algorithm,
payout_routing_algorithm,
three_ds_decision_rule_algorithm,
} => Self {
profile_name: None,
modified_at: now,
Expand Down Expand Up @@ -419,6 +424,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm,
},
ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm,
Expand Down Expand Up @@ -467,6 +473,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
Expand Down Expand Up @@ -515,6 +522,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
Expand Down Expand Up @@ -563,6 +571,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
Expand Down Expand Up @@ -611,6 +620,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
Expand Down Expand Up @@ -659,6 +669,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country: None,
is_iframe_redirection_enabled: None,
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
},
}
}
Expand Down Expand Up @@ -727,6 +738,7 @@ impl super::behaviour::Conversion for Profile {
merchant_business_country: self.merchant_business_country,
is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled),
three_ds_decision_rule_algorithm: self.three_ds_decision_rule_algorithm,
})
}

Expand Down Expand Up @@ -821,6 +833,7 @@ impl super::behaviour::Conversion for Profile {
is_pre_network_tokenization_enabled: item
.is_pre_network_tokenization_enabled
.unwrap_or(false),
three_ds_decision_rule_algorithm: item.three_ds_decision_rule_algorithm,
})
}
.await
Expand Down Expand Up @@ -1806,6 +1819,7 @@ impl super::behaviour::Conversion for Profile {
is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,
is_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self.external_vault_connector_details,
three_ds_decision_rule_algorithm: None,
})
}

Expand Down
1 change: 1 addition & 0 deletions crates/router/src/core/routing/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ pub async fn update_profile_active_algorithm_ref(
let business_profile_update = domain::ProfileUpdate::RoutingAlgorithmUpdate {
routing_algorithm,
payout_routing_algorithm,
three_ds_decision_rule_algorithm: None,
};

db.update_profile_by_profile_id(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This file should undo anything in `up.sql`
ALTER TABLE business_profile
DROP COLUMN three_ds_decision_rule_algorithm;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Your SQL goes here
ALTER TABLE business_profile
ADD COLUMN three_ds_decision_rule_algorithm JSONB;
Loading