feat(core): [Card Testing Guard] Implement Card Testing Guard (#7108)

Co-authored-by: Debarshi Gupta <debarshi.gupta@Debarshi-Gupta-CM92YWDXFD.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Debarshi Gupta
2025-02-25 05:18:57 +05:30
committed by GitHub
parent 7eccebc664
commit 2451e9b771
41 changed files with 1159 additions and 8 deletions

View File

@ -238,6 +238,31 @@ impl MerchantAccountCreate {
}
}
#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct CardTestingGuardConfig {
/// Determines if Card IP Blocking is enabled for profile
pub card_ip_blocking_status: CardTestingGuardStatus,
/// Determines the unsuccessful payment threshold for Card IP Blocking for profile
pub card_ip_blocking_threshold: i32,
/// Determines if Guest User Card Blocking is enabled for profile
pub guest_user_card_blocking_status: CardTestingGuardStatus,
/// Determines the unsuccessful payment threshold for Guest User Card Blocking for profile
pub guest_user_card_blocking_threshold: i32,
/// Determines if Customer Id Blocking is enabled for profile
pub customer_id_blocking_status: CardTestingGuardStatus,
/// Determines the unsuccessful payment threshold for Customer Id Blocking for profile
pub customer_id_blocking_threshold: i32,
/// Determines Redis Expiry for Card Testing Guard for profile
pub card_testing_guard_expiry: i32,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum CardTestingGuardStatus {
Enabled,
Disabled,
}
#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
pub struct AuthenticationConnectorDetails {
/// List of authentication connectors
@ -1912,6 +1937,9 @@ pub struct ProfileCreate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[nutype::nutype(
@ -2030,6 +2058,9 @@ pub struct ProfileCreate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v1")]
@ -2171,6 +2202,9 @@ pub struct ProfileResponse {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v2")]
@ -2295,6 +2329,9 @@ pub struct ProfileResponse {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v1")]
@ -2426,6 +2463,9 @@ pub struct ProfileUpdate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[cfg(feature = "v2")]
@ -2538,6 +2578,9 @@ pub struct ProfileUpdate {
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]