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(business-profile): add payment_method_blocking configuration (#11526)

Ayush Anand7833f9904568
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 2639a6ac29..89264104af 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -13961,6 +13961,50 @@
}
}
},
+ "CardBlockingConfig": {
+ "type": "object",
+ "description": "Card-specific blocking configuration",
+ "properties": {
+ "issuing_country": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ },
+ "description": "Set of issuing countries to block using ISO 3166-1 alpha-2 codes (e.g., [\"IN\", \"US\"])",
+ "nullable": true
+ },
+ "card_types": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CardType"
+ },
+ "description": "Set of card types to block (e.g., [\"Credit\", \"Debit\"])",
+ "nullable": true
+ },
+ "card_subtypes": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/CardSubtype"
+ },
+ "description": "Set of card subtypes to block",
+ "nullable": true
+ },
+ "issuers": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "Set of card issuers to block (e.g., [\"HDFC Bank\", \"ICICI Bank\"])",
+ "uniqueItems": true,
+ "nullable": true
+ },
+ "block_if_bin_info_unavailable": {
+ "type": "boolean",
+ "description": "Whether to block if BIN is provided but no matching record found in cards_info table.\nDefaults to false (allow payment if BIN not found in database).",
+ "nullable": true
+ }
+ }
+ },
"CardDetail": {
"type": "object",
"required": [
@@ -14497,6 +14541,12 @@
}
}
},
+ "CardSubtype": {
+ "type": "string",
+ "enum": [
+ "platinum"
+ ]
+ },
"CardTestingGuardConfig": {
"type": "object",
"required": [
@@ -26632,6 +26682,20 @@
"network_token"
]
},
+ "PaymentMethodBlockingConfig": {
+ "type": "object",
+ "description": "Configuration for payment method blocking based on card attributes",
+ "properties": {
+ "card": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CardBlockingConfig"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
"PaymentMethodCollectLinkRequest": {
"allOf": [
{
@@ -35348,6 +35412,14 @@
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
"nullable": true
+ },
+ "payment_method_blocking": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethodBlockingConfig"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -35714,6 +35786,14 @@
"type": "boolean",
"description": "Flag to enable Level 2 and Level 3 processing data for card transactions",
"nullable": true
+ },
+ "payment_method_blocking": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethodBlockingConfig"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 465e40f7e5..e98d131aa9 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -269,6 +269,32 @@ pub struct CardTestingGuardConfig {
pub card_testing_guard_expiry: i32,
}
+/// Configuration for payment method blocking based on card attributes
+#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
+pub struct PaymentMethodBlockingConfig {
+ /// Card-specific blocking configuration
+ pub card: Option<CardBlockingConfig>,
+}
+
+/// Card-specific blocking configuration
+#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)]
+pub struct CardBlockingConfig {
+ /// Set of issuing countries to block using ISO 3166-1 alpha-2 codes (e.g., ["IN", "US"])
+ #[schema(value_type = Option<Vec<CountryAlpha2>>)]
+ pub issuing_country: Option<HashSet<common_enums::CountryAlpha2>>,
+ /// Set of card types to block (e.g., ["Credit", "Debit"])
+ #[schema(value_type = Option<Vec<CardType>>)]
+ pub card_types: Option<HashSet<common_enums::CardType>>,
+ /// Set of card subtypes to block
+ #[schema(value_type = Option<Vec<CardSubtype>>)]
+ pub card_subtypes: Option<HashSet<common_enums::CardSubtype>>,
+ /// Set of card issuers to block (e.g., ["HDFC Bank", "ICICI Bank"])
+ pub issuers: Option<HashSet<String>>,
+ /// Whether to block if BIN is provided but no matching record found in cards_info table.
+ /// Defaults to false (allow payment if BIN not found in database).
+ pub block_if_bin_info_unavailable: Option<bool>,
+}
+
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum CardTestingGuardStatus {
@@ -2276,6 +2302,10 @@ pub struct ProfileCreate {
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
+
+ /// Payment method blocking configuration for the profile
+ #[schema(value_type = Option<PaymentMethodBlockingConfig>)]
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[nutype::nutype(
@@ -2649,6 +2679,10 @@ pub struct ProfileResponse {
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
+
+ /// Payment method blocking configuration for the profile
+ #[schema(value_type = Option<PaymentMethodBlockingConfig>)]
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v2")]
@@ -3025,6 +3059,10 @@ pub struct ProfileUpdate {
/// Flag to enable Level 2 and Level 3 processing data for card transactions
#[schema(value_type = Option<bool>)]
pub is_l2_l3_enabled: Option<bool>,
+
+ /// Payment method blocking configuration for the profile
+ #[schema(value_type = Option<PaymentMethodBlockingConfig>)]
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v2")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index af04ea7341..12b157f879 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -3185,6 +3185,26 @@ pub enum CardType {
Debit,
}
+// TODO: This enum will be updated with all card subtype values
+#[derive(
+ Clone,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumIter,
+ strum::EnumString,
+ utoipa::ToSchema,
+ Copy,
+)]
+#[serde(rename_all = "snake_case")]
+pub enum CardSubtype {
+ Platinum,
+}
+
#[derive(Debug, Clone, Serialize, Deserialize, strum::EnumString, strum::Display)]
#[serde(rename_all = "snake_case")]
pub enum DecisionEngineMerchantCategoryCode {
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index b02314bce7..05ce732dce 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -84,6 +84,7 @@ pub struct Profile {
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub is_l2_l3_enabled: Option<bool>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v1")]
@@ -147,6 +148,7 @@ pub struct ProfileNew {
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub is_l2_l3_enabled: Option<bool>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v1")]
@@ -211,6 +213,7 @@ pub struct ProfileUpdateInternal {
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v1")]
@@ -272,6 +275,7 @@ impl ProfileUpdateInternal {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id,
+ payment_method_blocking,
} = self;
Profile {
profile_id: source.profile_id,
@@ -367,6 +371,7 @@ impl ProfileUpdateInternal {
external_vault_connector_details: external_vault_connector_details
.or(source.external_vault_connector_details),
billing_processor_id: billing_processor_id.or(source.billing_processor_id),
+ payment_method_blocking: payment_method_blocking.or(source.payment_method_blocking),
}
}
}
@@ -437,6 +442,7 @@ pub struct Profile {
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub is_l2_l3_enabled: Option<bool>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
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>,
@@ -527,6 +533,7 @@ pub struct ProfileNew {
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub is_l2_l3_enabled: Option<bool>,
pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v2")]
@@ -749,6 +756,7 @@ impl ProfileUpdateInternal {
always_enable_overcapture: None,
is_l2_l3_enabled: None,
billing_processor_id: billing_processor_id.or(source.billing_processor_id),
+ payment_method_blocking: None,
}
}
}
@@ -922,3 +930,28 @@ impl RevenueRecoveryAlgorithmData {
}
common_utils::impl_to_sql_from_sql_json!(RevenueRecoveryAlgorithmData);
+
+/// Configuration for payment method blocking based on card attributes
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)]
+#[diesel(sql_type = diesel::sql_types::Jsonb)]
+pub struct PaymentMethodBlockingConfig {
+ pub card: Option<CardBlockingConfig>,
+}
+
+/// Card-specific blocking configuration
+#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
+pub struct CardBlockingConfig {
+ /// Set of issuing countries to block using ISO 3166-1 alpha-2 codes (e.g., ["IN", "US"])
+ pub issuing_country: Option<HashSet<common_enums::CountryAlpha2>>,
+ /// Set of card types to block (e.g., ["Credit", "Debit"])
+ pub card_types: Option<HashSet<common_enums::CardType>>,
+ /// Set of card subtypes to block
+ pub card_subtypes: Option<HashSet<common_enums::CardSubtype>>,
+ /// Set of card issuers to block (e.g., ["HDFC Bank", "ICICI Bank"])
+ pub issuers: Option<HashSet<String>>,
+ /// Whether to block if BIN is provided but no matching record found in cards_info table.
+ /// Defaults to false (allow payment if BIN not found in database).
+ pub block_if_bin_info_unavailable: Option<bool>,
+}
+
+common_utils::impl_to_sql_from_sql_json!(PaymentMethodBlockingConfig);
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index db69423716..44357afe0d 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -299,6 +299,7 @@ diesel::table! {
is_external_vault_enabled -> Nullable<Bool>,
external_vault_connector_details -> Nullable<Jsonb>,
is_l2_l3_enabled -> Nullable<Bool>,
+ payment_method_blocking -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index e69fce241d..6b59b5f654 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -294,6 +294,7 @@ diesel::table! {
is_external_vault_enabled -> Nullable<Bool>,
external_vault_connector_details -> Nullable<Jsonb>,
is_l2_l3_enabled -> Nullable<Bool>,
+ payment_method_blocking -> Nullable<Jsonb>,
#[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 79e8fc5103..f894ce7f3f 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -16,7 +16,7 @@ use diesel_models::business_profile::RevenueRecoveryAlgorithmData;
use diesel_models::business_profile::{
self as storage_types, AuthenticationConnectorDetails, BusinessPaymentLinkConfig,
BusinessPayoutLinkConfig, CardTestingGuardConfig, ExternalVaultConnectorDetails,
- ProfileUpdateInternal, WebhookDetails,
+ PaymentMethodBlockingConfig, ProfileUpdateInternal, WebhookDetails,
};
use error_stack::ResultExt;
use hyperswitch_masking::{ExposeInterface, PeekInterface, Secret};
@@ -91,6 +91,7 @@ pub struct Profile {
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub external_vault_details: ExternalVaultDetails,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v1")]
@@ -249,6 +250,7 @@ pub struct ProfileSetter {
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
pub external_vault_details: ExternalVaultDetails,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v1")]
@@ -317,6 +319,7 @@ impl From<ProfileSetter> for Profile {
always_enable_overcapture: value.always_enable_overcapture,
external_vault_details: value.external_vault_details,
billing_processor_id: value.billing_processor_id,
+ payment_method_blocking: value.payment_method_blocking,
}
}
}
@@ -388,6 +391,7 @@ pub struct ProfileGeneralUpdate {
pub is_external_vault_enabled: Option<common_enums::ExternalVaultEnabled>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
+ pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,
}
#[cfg(feature = "v1")]
@@ -477,6 +481,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id,
+ payment_method_blocking,
} = *update;
let is_external_vault_enabled = match is_external_vault_enabled {
@@ -544,6 +549,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id,
+ payment_method_blocking,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -606,6 +612,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details: None,
billing_processor_id: None,
is_l2_l3_enabled: None,
+ payment_method_blocking: None,
},
ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm,
@@ -665,6 +672,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details: None,
billing_processor_id: None,
is_l2_l3_enabled: None,
+ payment_method_blocking: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -724,6 +732,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details: None,
billing_processor_id: None,
is_l2_l3_enabled: None,
+ payment_method_blocking: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -783,6 +792,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details: None,
billing_processor_id: None,
is_l2_l3_enabled: None,
+ payment_method_blocking: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -842,6 +852,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details: None,
billing_processor_id: None,
is_l2_l3_enabled: None,
+ payment_method_blocking: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -901,6 +912,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details: None,
billing_processor_id: None,
is_l2_l3_enabled: None,
+ payment_method_blocking: None,
},
ProfileUpdate::AcquirerConfigMapUpdate {
acquirer_config_map,
@@ -960,6 +972,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
external_vault_connector_details: None,
billing_processor_id: None,
is_l2_l3_enabled: None,
+ payment_method_blocking: None,
},
}
}
@@ -1042,6 +1055,7 @@ impl Conversion for Profile {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id: self.billing_processor_id,
+ payment_method_blocking: self.payment_method_blocking,
})
}
@@ -1167,6 +1181,7 @@ impl Conversion for Profile {
always_enable_overcapture: item.always_enable_overcapture,
external_vault_details,
billing_processor_id: item.billing_processor_id,
+ payment_method_blocking: item.payment_method_blocking,
})
}
@@ -1236,6 +1251,7 @@ impl Conversion for Profile {
is_external_vault_enabled,
external_vault_connector_details,
billing_processor_id: self.billing_processor_id,
+ payment_method_blocking: self.payment_method_blocking,
})
}
}
@@ -2412,6 +2428,7 @@ impl Conversion for Profile {
is_l2_l3_enabled: None,
always_enable_overcapture: None,
billing_processor_id: self.billing_processor_id,
+ payment_method_blocking: None,
})
}
@@ -2582,6 +2599,7 @@ impl Conversion for Profile {
merchant_country_code: self.merchant_country_code,
split_txns_enabled: Some(self.split_txns_enabled),
billing_processor_id: self.billing_processor_id,
+ payment_method_blocking: None,
})
}
}
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 8ec68ed9a2..f92375c126 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -349,6 +349,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::BusinessPayoutLinkConfig,
api_models::admin::CardTestingGuardConfig,
api_models::admin::CardTestingGuardStatus,
+ api_models::admin::PaymentMethodBlockingConfig,
+ api_models::admin::CardBlockingConfig,
api_models::merchant_connector_webhook_management::ConnectorWebhookRegisterRequest,
api_models::merchant_connector_webhook_management::RegisterConnectorWebhookResponse,
api_models::merchant_connector_webhook_management::ConnectorWebhookResponse,
@@ -477,6 +479,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::MerchantConnectorWebhookDetails,
api_models::admin::ProfileCreate,
api_models::admin::ProfileResponse,
+ api_models::enums::CardSubtype,
api_models::admin::BusinessPaymentLinkConfig,
api_models::admin::PaymentLinkBackgroundImageConfig,
api_models::admin::PaymentLinkConfigRequest,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index b88cc5e26b..25325b517b 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3543,6 +3543,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
.attach_printable("error while generating external vault details")?,
billing_processor_id: self.billing_processor_id,
is_l2_l3_enabled: self.is_l2_l3_enabled.unwrap_or(false),
+ payment_method_blocking: self.payment_method_blocking.map(ForeignInto::foreign_into),
}))
}
@@ -4046,6 +4047,9 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
.map(ForeignInto::foreign_into),
billing_processor_id: self.billing_processor_id,
is_l2_l3_enabled: self.is_l2_l3_enabled,
+ payment_method_blocking: self
+ .payment_method_blocking
+ .map(ForeignInto::foreign_into),
},
)))
}
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e7d0c0cd4b..5653550800 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4866,7 +4866,14 @@ where
routing_decision.map(|decision| decision.apply_routing_decision(payment_data));
// Validating the blocklist guard and generate the fingerprint
- blocklist_guard(state, platform.get_processor(), operation, payment_data).await?;
+ blocklist_guard(
+ state,
+ platform.get_processor(),
+ operation,
+ payment_data,
+ business_profile,
+ )
+ .await?;
let merchant_recipient_data = payment_data
.get_merchant_recipient_data(
@@ -6657,6 +6664,7 @@ async fn blocklist_guard<F, ApiRequest, D>(
processor: &domain::Processor,
operation: &BoxedOperation<'_, F, ApiRequest, D>,
payment_data: &mut D,
+ business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse>
where
F: Send + Clone + Sync,
@@ -6684,7 +6692,7 @@ where
if blocklist_guard_enabled {
Ok(operation
.to_domain()?
- .guard_payment_against_blocklist(state, processor, payment_data)
+ .guard_payment_against_blocklist(state, processor, payment_data, business_profile)
.await?)
} else {
Ok(false)
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index 148fbf111e..46e03d8454 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -446,6 +446,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut D,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
@@ -715,6 +716,7 @@ where
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut D,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
@@ -803,6 +805,7 @@ where
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut D,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
@@ -892,6 +895,7 @@ where
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut D,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
@@ -975,6 +979,7 @@ where
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut D,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_attempt_list.rs b/crates/router/src/core/payments/operations/payment_attempt_list.rs
index e1844b5cb6..c45ecf6209 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_list.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_list.rs
@@ -212,6 +212,7 @@ impl<F: Clone + Send + Sync>
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut payments::PaymentAttemptListData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
index b9a7b909f4..aa78fadec6 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
@@ -291,6 +291,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsCancelPostCaptureRequest, Pa
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index cbd914b1b8..fbe92648cc 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -498,6 +498,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index a7156deccd..ff7a74e3cb 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -2116,6 +2116,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
state: &SessionState,
processor: &domain::Processor,
payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
blocklist_utils::validate_data_for_blocklist(state, processor, payment_data).await
}
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index bc64898f28..ed9bb975dd 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -958,6 +958,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rs
index aaa6557022..607fe7e156 100644
--- a/crates/router/src/core/payments/operations/payment_create_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs
@@ -293,6 +293,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsCreateIntentRequest, payments::Pa
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index bacc38fdd8..2b74473d7d 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -214,6 +214,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsGetIntentRequest, payments::Payme
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
index 9688f437a8..782c2c0c4f 100644
--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
@@ -251,6 +251,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsPostSessionTokensRequest, Pa
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 0b1f04e299..d638e7ba80 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -523,6 +523,7 @@ where
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index bbcbd0c208..2c1854729d 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -370,6 +370,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsSessionRequest, payments::Payment
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 213b557587..fde642ffcc 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -366,6 +366,7 @@ where
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index e9e334b588..0e53b9359c 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -153,6 +153,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index c1aed28fcc..ce9ad5a5e2 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -786,6 +786,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index f98e935fb5..7c7906e7dc 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -486,6 +486,7 @@ impl<F: Clone + Send> Domain<F, PaymentsUpdateIntentRequest, payments::PaymentIn
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut payments::PaymentIntentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rs
index ec090a4b7a..fc2b127ab7 100644
--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs
+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs
@@ -257,6 +257,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsUpdateMetadataRequest, Payme
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payments_extend_authorization.rs b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
index 4cf5532e94..39872df320 100644
--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
@@ -273,6 +273,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsExtendAuthorizationRequest,
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index cfdd127cf9..58fbc65290 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -387,6 +387,7 @@ impl<F: Clone + Send + Sync>
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut payments::PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 47919661ae..0bba449a7a 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -370,6 +370,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsDynamicTaxCalculationRequest
_state: &SessionState,
_processor: &domain::Processor,
_payment_data: &mut PaymentData<F>,
+ _business_profile: &domain::Profile,
) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
Ok(false)
}
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index b6c3e0e81f..00d611a8e3 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -1403,6 +1403,7 @@ mod tests {
external_vault_details: domain::ExternalVaultDetails::Skip,
billing_processor_id: None,
is_l2_l3_enabled: false,
+ payment_method_blocking: None,
});
let business_profile = state
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 9a9864e912..44d370089c 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -243,6 +243,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
.map(ForeignFrom::foreign_from),
billing_processor_id: item.billing_processor_id,
is_l2_l3_enabled: Some(item.is_l2_l3_enabled),
+ payment_method_blocking: item.payment_method_blocking.map(ForeignInto::foreign_into),
})
}
}
@@ -515,5 +516,6 @@ pub async fn create_profile_from_merchant_account(
.attach_printable("error while generating external_vault_details")?,
billing_processor_id: request.billing_processor_id,
is_l2_l3_enabled: request.is_l2_l3_enabled.unwrap_or(false),
+ payment_method_blocking: None,
}))
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 9e5a3f2cf8..86eed8b41f 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -2225,6 +2225,54 @@ impl ForeignFrom<diesel_models::business_profile::CardTestingGuardConfig>
}
}
+impl ForeignFrom<api_models::admin::PaymentMethodBlockingConfig>
+ for diesel_models::business_profile::PaymentMethodBlockingConfig
+{
+ fn foreign_from(item: api_models::admin::PaymentMethodBlockingConfig) -> Self {
+ Self {
+ card: item.card.map(|c| c.foreign_into()),
+ }
+ }
+}
+
+impl ForeignFrom<api_models::admin::CardBlockingConfig>
+ for diesel_models::business_profile::CardBlockingConfig
+{
+ fn foreign_from(item: api_models::admin::CardBlockingConfig) -> Self {
+ Self {
+ issuing_country: item.issuing_country,
+ card_types: item.card_types,
+ card_subtypes: item.card_subtypes,
+ issuers: item.issuers,
+ block_if_bin_info_unavailable: item.block_if_bin_info_unavailable,
+ }
+ }
+}
+
+impl ForeignFrom<diesel_models::business_profile::PaymentMethodBlockingConfig>
+ for api_models::admin::PaymentMethodBlockingConfig
+{
+ fn foreign_from(item: diesel_models::business_profile::PaymentMethodBlockingConfig) -> Self {
+ Self {
+ card: item.card.map(|c| c.foreign_into()),
+ }
+ }
+}
+
+impl ForeignFrom<diesel_models::business_profile::CardBlockingConfig>
+ for api_models::admin::CardBlockingConfig
+{
+ fn foreign_from(item: diesel_models::business_profile::CardBlockingConfig) -> Self {
+ Self {
+ issuing_country: item.issuing_country,
+ card_types: item.card_types,
+ card_subtypes: item.card_subtypes,
+ issuers: item.issuers,
+ block_if_bin_info_unavailable: item.block_if_bin_info_unavailable,
+ }
+ }
+}
+
impl ForeignFrom<api_models::admin::WebhookDetails>
for diesel_models::business_profile::WebhookDetails
{
diff --git a/migrations/2026-03-15-091519_add_payment_method_blocking_to_business_profile/down.sql b/migrations/2026-03-15-091519_add_payment_method_blocking_to_business_profile/down.sql
new file mode 100644
index 0000000000..d75d630899
--- /dev/null
+++ b/migrations/2026-03-15-091519_add_payment_method_blocking_to_business_profile/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile
+DROP COLUMN IF EXISTS payment_method_blocking;
diff --git a/migrations/2026-03-15-091519_add_payment_method_blocking_to_business_profile/up.sql b/migrations/2026-03-15-091519_add_payment_method_blocking_to_business_profile/up.sql
new file mode 100644
index 0000000000..365f1a65ea
--- /dev/null
+++ b/migrations/2026-03-15-091519_add_payment_method_blocking_to_business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS payment_method_blocking JSONB;