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(router): add `merchant_category_code` in business profile (#8296)

Shankar Singh C0f1427986635
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 2e337c1f56..f126039079 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -13195,6 +13195,18 @@
},
"additionalProperties": false
},
+ "MerchantCategoryCode": {
+ "type": "string",
+ "enum": [
+ "5411",
+ "7011",
+ "0763",
+ "8111",
+ "5021",
+ "4816",
+ "5661"
+ ]
+ },
"MerchantConnectorAccountFeatureMetadata": {
"type": "object",
"description": "Feature metadata for merchant connector account",
@@ -20977,6 +20989,14 @@
}
],
"nullable": true
+ },
+ "merchant_category_code": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MerchantCategoryCode"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -21246,6 +21266,14 @@
}
],
"nullable": true
+ },
+ "merchant_category_code": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MerchantCategoryCode"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index c63c5485c5..c80a698d62 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -16133,6 +16133,18 @@
},
"additionalProperties": false
},
+ "MerchantCategoryCode": {
+ "type": "string",
+ "enum": [
+ "5411",
+ "7011",
+ "0763",
+ "8111",
+ "5021",
+ "4816",
+ "5661"
+ ]
+ },
"MerchantConnectorCreate": {
"type": "object",
"description": "Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc.\"",
@@ -25777,6 +25789,14 @@
"type": "boolean",
"description": "Indicates if pre network tokenization is enabled or not",
"nullable": true
+ },
+ "merchant_category_code": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MerchantCategoryCode"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -26075,6 +26095,14 @@
"description": "Indicates if the redirection has to open in the iframe",
"example": false,
"nullable": true
+ },
+ "merchant_category_code": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MerchantCategoryCode"
+ }
+ ],
+ "nullable": true
}
}
},
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 07f3e2431f..d30abfe813 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -2121,6 +2121,10 @@ pub struct ProfileCreate {
/// Indicates if pre network tokenization is enabled or not
pub is_pre_network_tokenization_enabled: Option<bool>,
+
+ /// Four-digit code assigned based on business type to determine processing fees and risk level
+ #[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[nutype::nutype(
@@ -2263,6 +2267,10 @@ pub struct ProfileCreate {
/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+
+ /// Four-digit code assigned based on business type to determine processing fees and risk level
+ #[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -2434,6 +2442,10 @@ pub struct ProfileResponse {
/// Indicates if the redirection has to open in the iframe
#[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
+
+ /// Four-digit code assigned based on business type to determine processing fees and risk level
+ #[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v2")]
@@ -2584,6 +2596,10 @@ pub struct ProfileResponse {
/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+
+ /// Four-digit code assigned based on business type to determine processing fees and risk level
+ #[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -2740,6 +2756,10 @@ pub struct ProfileUpdate {
/// Indicates if pre network tokenization is enabled or not
#[schema(default = false, example = false)]
pub is_pre_network_tokenization_enabled: Option<bool>,
+
+ /// Four-digit code assigned based on business type to determine processing fees and risk level
+ #[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v2")]
@@ -2872,6 +2892,10 @@ pub struct ProfileUpdate {
/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+
+ /// Four-digit code assigned based on business type to determine processing fees and risk level
+ #[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
diff --git a/crates/api_models/src/open_router.rs b/crates/api_models/src/open_router.rs
index 08607e1469..33719e8a41 100644
--- a/crates/api_models/src/open_router.rs
+++ b/crates/api_models/src/open_router.rs
@@ -107,7 +107,7 @@ impl TryFrom<(payment_methods::CoBadgedCardData, String)> for DebitRoutingReques
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CoBadgedCardRequest {
- pub merchant_category_code: common_enums::MerchantCategoryCode,
+ pub merchant_category_code: common_enums::DecisionEngineMerchantCategoryCode,
pub acquirer_country: common_enums::CountryAlpha2,
pub co_badged_card_data: Option<DebitRoutingRequestData>,
}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 893a3b7daf..5daabd0bc7 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2412,7 +2412,7 @@ pub enum CardType {
#[derive(Debug, Clone, Serialize, Deserialize, strum::EnumString, strum::Display)]
#[serde(rename_all = "snake_case")]
-pub enum MerchantCategoryCode {
+pub enum DecisionEngineMerchantCategoryCode {
#[serde(rename = "merchant_category_code_0001")]
Mcc0001,
}
@@ -2515,6 +2515,98 @@ pub enum DisputeStatus {
DisputeLost,
}
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ strum::EnumIter,
+ strum::VariantNames,
+ ToSchema,
+)]
+pub enum MerchantCategory {
+ #[serde(rename = "Grocery Stores, Supermarkets (5411)")]
+ GroceryStoresSupermarkets,
+ #[serde(rename = "Lodging-Hotels, Motels, Resorts-not elsewhere classified (7011)")]
+ LodgingHotelsMotelsResorts,
+ #[serde(rename = "Agricultural Cooperatives (0763)")]
+ AgriculturalCooperatives,
+ #[serde(rename = "Attorneys, Legal Services (8111)")]
+ AttorneysLegalServices,
+ #[serde(rename = "Office and Commercial Furniture (5021)")]
+ OfficeAndCommercialFurniture,
+ #[serde(rename = "Computer Network/Information Services (4816)")]
+ ComputerNetworkInformationServices,
+ #[serde(rename = "Shoe Stores (5661)")]
+ ShoeStores,
+}
+
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ strum::EnumIter,
+ strum::VariantNames,
+ ToSchema,
+)]
+#[router_derive::diesel_enum(storage_type = "text")]
+pub enum MerchantCategoryCode {
+ #[serde(rename = "5411")]
+ #[strum(serialize = "5411")]
+ Mcc5411,
+ #[serde(rename = "7011")]
+ #[strum(serialize = "7011")]
+ Mcc7011,
+ #[serde(rename = "0763")]
+ #[strum(serialize = "0763")]
+ Mcc0763,
+ #[serde(rename = "8111")]
+ #[strum(serialize = "8111")]
+ Mcc8111,
+ #[serde(rename = "5021")]
+ #[strum(serialize = "5021")]
+ Mcc5021,
+ #[serde(rename = "4816")]
+ #[strum(serialize = "4816")]
+ Mcc4816,
+ #[serde(rename = "5661")]
+ #[strum(serialize = "5661")]
+ Mcc5661,
+}
+
+impl MerchantCategoryCode {
+ pub fn to_merchant_category_name(&self) -> MerchantCategory {
+ match self {
+ Self::Mcc5411 => MerchantCategory::GroceryStoresSupermarkets,
+ Self::Mcc7011 => MerchantCategory::LodgingHotelsMotelsResorts,
+ Self::Mcc0763 => MerchantCategory::AgriculturalCooperatives,
+ Self::Mcc8111 => MerchantCategory::AttorneysLegalServices,
+ Self::Mcc5021 => MerchantCategory::OfficeAndCommercialFurniture,
+ Self::Mcc4816 => MerchantCategory::ComputerNetworkInformationServices,
+ Self::Mcc5661 => MerchantCategory::ShoeStores,
+ }
+ }
+}
+
+#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq)]
+pub struct MerchantCategoryCodeWithName {
+ pub code: MerchantCategoryCode,
+ pub name: MerchantCategory,
+}
+
#[derive(
Clone,
Debug,
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index a93bab30a4..e2543e3b43 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -75,6 +75,7 @@ pub struct Profile {
pub is_pre_network_tokenization_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
pub acquirer_config_map: Option<common_types::domain::AcquirerConfigMap>,
+ pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -130,6 +131,7 @@ pub struct ProfileNew {
pub id: Option<common_utils::id_type::ProfileId>,
pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: Option<bool>,
+ pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -185,6 +187,7 @@ pub struct ProfileUpdateInternal {
pub is_pre_network_tokenization_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
pub acquirer_config_map: Option<common_types::domain::AcquirerConfigMap>,
+ pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -237,6 +240,7 @@ impl ProfileUpdateInternal {
is_pre_network_tokenization_enabled,
three_ds_decision_rule_algorithm,
acquirer_config_map,
+ merchant_category_code,
} = self;
Profile {
profile_id: source.profile_id,
@@ -320,6 +324,7 @@ impl ProfileUpdateInternal {
three_ds_decision_rule_algorithm: three_ds_decision_rule_algorithm
.or(source.three_ds_decision_rule_algorithm),
acquirer_config_map: acquirer_config_map.or(source.acquirer_config_map),
+ merchant_category_code: merchant_category_code.or(source.merchant_category_code),
}
}
}
@@ -381,6 +386,7 @@ pub struct Profile {
pub is_iframe_redirection_enabled: Option<bool>,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
pub acquirer_config_map: Option<common_types::domain::AcquirerConfigMap>,
+ pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
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>,
@@ -452,6 +458,7 @@ pub struct ProfileNew {
pub is_clear_pan_retries_enabled: Option<bool>,
pub is_debit_routing_enabled: bool,
pub merchant_business_country: Option<common_enums::CountryAlpha2>,
+ pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
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>,
@@ -510,6 +517,7 @@ pub struct ProfileUpdateInternal {
pub is_clear_pan_retries_enabled: Option<bool>,
pub is_debit_routing_enabled: Option<bool>,
pub merchant_business_country: Option<common_enums::CountryAlpha2>,
+ pub merchant_category_code: Option<common_enums::MerchantCategoryCode>,
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>,
@@ -578,6 +586,7 @@ impl ProfileUpdateInternal {
is_iframe_redirection_enabled,
is_external_vault_enabled,
external_vault_connector_details,
+ merchant_category_code,
} = self;
Profile {
id: source.id,
@@ -671,6 +680,7 @@ impl ProfileUpdateInternal {
.or(source.external_vault_connector_details),
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code: merchant_category_code.or(source.merchant_category_code),
}
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 4e93ecab94..522ad271be 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -229,6 +229,8 @@ diesel::table! {
is_pre_network_tokenization_enabled -> Nullable<Bool>,
three_ds_decision_rule_algorithm -> Nullable<Jsonb>,
acquirer_config_map -> Nullable<Jsonb>,
+ #[max_length = 16]
+ merchant_category_code -> Nullable<Varchar>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 882c620d9f..6ea3b49bb0 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -224,6 +224,8 @@ diesel::table! {
is_iframe_redirection_enabled -> Nullable<Bool>,
three_ds_decision_rule_algorithm -> Nullable<Jsonb>,
acquirer_config_map -> Nullable<Jsonb>,
+ #[max_length = 16]
+ merchant_category_code -> Nullable<Varchar>,
#[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time -> Nullable<Int8>,
diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs
index 6e8c327b7e..25d1da385a 100644
--- a/crates/euclid_wasm/src/lib.rs
+++ b/crates/euclid_wasm/src/lib.rs
@@ -34,7 +34,7 @@ use wasm_bindgen::prelude::*;
use crate::utils::JsResultExt;
type JsResult = Result<JsValue, JsValue>;
use api_models::payment_methods::CountryCodeWithName;
-use common_enums::CountryAlpha2;
+use common_enums::{CountryAlpha2, MerchantCategoryCode, MerchantCategoryCodeWithName};
use strum::IntoEnumIterator;
struct SeedData {
@@ -91,6 +91,22 @@ pub fn get_two_letter_country_code() -> JsResult {
Ok(serde_wasm_bindgen::to_value(&country_code_with_name)?)
}
+/// This function can be used by the frontend to get all the merchant category codes
+/// along with their names.
+#[wasm_bindgen(js_name=getMerchantCategoryCodeWithName)]
+pub fn get_merchant_category_code_with_name() -> JsResult {
+ let merchant_category_codes_with_name = MerchantCategoryCode::iter()
+ .map(|mcc_value| MerchantCategoryCodeWithName {
+ code: mcc_value,
+ name: mcc_value.to_merchant_category_name(),
+ })
+ .collect::<Vec<_>>();
+
+ Ok(serde_wasm_bindgen::to_value(
+ &merchant_category_codes_with_name,
+ )?)
+}
+
/// This function can be used by the frontend to provide the WASM with information about
/// all the merchant's connector accounts. The input argument is a vector of all the merchant's
/// connector accounts from the API.
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 6c95af4f14..93ed2af494 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -77,6 +77,7 @@ pub struct Profile {
pub is_pre_network_tokenization_enabled: bool,
pub three_ds_decision_rule_algorithm: Option<serde_json::Value>,
pub acquirer_config_map: Option<common_types::domain::AcquirerConfigMap>,
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -130,6 +131,7 @@ pub struct ProfileSetter {
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: bool,
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -190,6 +192,7 @@ impl From<ProfileSetter> for Profile {
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
acquirer_config_map: None,
+ merchant_category_code: value.merchant_category_code,
}
}
}
@@ -250,6 +253,7 @@ pub struct ProfileGeneralUpdate {
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
pub is_iframe_redirection_enabled: Option<bool>,
pub is_pre_network_tokenization_enabled: Option<bool>,
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v1")]
@@ -329,6 +333,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
merchant_business_country,
is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled,
+ merchant_category_code,
} = *update;
Self {
@@ -379,6 +384,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -432,6 +438,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm,
acquirer_config_map: None,
+ merchant_category_code: None,
},
ProfileUpdate::DynamicRoutingAlgorithmUpdate {
dynamic_routing_algorithm,
@@ -482,6 +489,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -532,6 +540,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -582,6 +591,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -632,6 +642,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -682,6 +693,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code: None,
},
ProfileUpdate::AcquirerConfigMapUpdate {
acquirer_config_map,
@@ -732,6 +744,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_pre_network_tokenization_enabled: None,
three_ds_decision_rule_algorithm: None,
acquirer_config_map,
+ merchant_category_code: None,
},
}
}
@@ -802,6 +815,7 @@ impl super::behaviour::Conversion for Profile {
is_pre_network_tokenization_enabled: Some(self.is_pre_network_tokenization_enabled),
three_ds_decision_rule_algorithm: self.three_ds_decision_rule_algorithm,
acquirer_config_map: self.acquirer_config_map,
+ merchant_category_code: self.merchant_category_code,
})
}
@@ -898,6 +912,7 @@ impl super::behaviour::Conversion for Profile {
.unwrap_or(false),
three_ds_decision_rule_algorithm: item.three_ds_decision_rule_algorithm,
acquirer_config_map: item.acquirer_config_map,
+ merchant_category_code: item.merchant_category_code,
})
}
.await
@@ -961,6 +976,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),
+ merchant_category_code: self.merchant_category_code,
})
}
}
@@ -1020,6 +1036,7 @@ pub struct Profile {
pub is_iframe_redirection_enabled: Option<bool>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v2")]
@@ -1075,6 +1092,7 @@ pub struct ProfileSetter {
pub is_iframe_redirection_enabled: Option<bool>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v2")]
@@ -1135,6 +1153,7 @@ impl From<ProfileSetter> for Profile {
is_iframe_redirection_enabled: value.is_iframe_redirection_enabled,
is_external_vault_enabled: value.is_external_vault_enabled,
external_vault_connector_details: value.external_vault_connector_details,
+ merchant_category_code: value.merchant_category_code,
}
}
}
@@ -1214,6 +1233,7 @@ pub struct ProfileGeneralUpdate {
pub is_iframe_redirection_enabled: Option<bool>,
pub is_external_vault_enabled: Option<bool>,
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
+ pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
}
#[cfg(feature = "v2")]
@@ -1292,6 +1312,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled,
is_external_vault_enabled,
external_vault_connector_details,
+ merchant_category_code,
} = *update;
Self {
profile_name,
@@ -1343,6 +1364,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled,
external_vault_connector_details,
+ merchant_category_code,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
@@ -1397,6 +1419,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -1449,6 +1472,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -1501,6 +1525,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
@@ -1553,6 +1578,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
@@ -1605,6 +1631,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
@@ -1657,6 +1684,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::DecisionManagerRecordUpdate {
three_ds_decision_manager_config,
@@ -1709,6 +1737,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
@@ -1761,6 +1790,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
ProfileUpdate::RevenueRecoveryAlgorithmUpdate {
revenue_recovery_retry_algorithm_type,
@@ -1814,6 +1844,7 @@ impl From<ProfileUpdate> for ProfileUpdateInternal {
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
+ merchant_category_code: None,
},
}
}
@@ -1890,6 +1921,7 @@ impl super::behaviour::Conversion for Profile {
external_vault_connector_details: self.external_vault_connector_details,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
+ merchant_category_code: self.merchant_category_code,
})
}
@@ -1983,6 +2015,7 @@ impl super::behaviour::Conversion for Profile {
is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,
is_external_vault_enabled: item.is_external_vault_enabled,
external_vault_connector_details: item.external_vault_connector_details,
+ merchant_category_code: item.merchant_category_code,
})
}
.await
@@ -2051,6 +2084,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,
+ merchant_category_code: self.merchant_category_code,
})
}
}
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 171f37cca1..6738824b05 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -324,6 +324,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::BankType,
api_models::enums::BankHolderType,
api_models::enums::CardNetwork,
+ api_models::enums::MerchantCategoryCode,
api_models::enums::DisputeStage,
api_models::enums::DisputeStatus,
api_models::enums::CountryAlpha2,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 9a624c12a9..5b5ed7a83e 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -285,6 +285,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::BankType,
api_models::enums::BankHolderType,
api_models::enums::CardNetwork,
+ api_models::enums::MerchantCategoryCode,
api_models::enums::TokenDataType,
api_models::enums::DisputeStage,
api_models::enums::DisputeStatus,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index b8d24573c3..be009c127d 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -4052,6 +4052,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
is_pre_network_tokenization_enabled: self
.is_pre_network_tokenization_enabled
.unwrap_or_default(),
+ merchant_category_code: self.merchant_category_code,
}))
}
@@ -4200,6 +4201,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
external_vault_connector_details: self
.external_vault_connector_details
.map(ForeignInto::foreign_into),
+ merchant_category_code: self.merchant_category_code,
}))
}
}
@@ -4533,6 +4535,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
merchant_business_country: self.merchant_business_country,
is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,
is_pre_network_tokenization_enabled: self.is_pre_network_tokenization_enabled,
+ merchant_category_code: self.merchant_category_code,
},
)))
}
@@ -4672,6 +4675,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
external_vault_connector_details: self
.external_vault_connector_details
.map(ForeignInto::foreign_into),
+ merchant_category_code: self.merchant_category_code,
},
)))
}
diff --git a/crates/router/src/core/debit_routing.rs b/crates/router/src/core/debit_routing.rs
index adbd663c5c..26505171fc 100644
--- a/crates/router/src/core/debit_routing.rs
+++ b/crates/router/src/core/debit_routing.rs
@@ -315,7 +315,7 @@ pub async fn get_debit_routing_output<
}
let co_badged_card_request = open_router::CoBadgedCardRequest {
- merchant_category_code: enums::MerchantCategoryCode::Mcc0001,
+ merchant_category_code: enums::DecisionEngineMerchantCategoryCode::Mcc0001,
acquirer_country,
co_badged_card_data,
};
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 41069a784b..ac46c1dde0 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -199,6 +199,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
is_pre_network_tokenization_enabled: item.is_pre_network_tokenization_enabled,
acquirer_configs: item.acquirer_config_map,
is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,
+ merchant_category_code: item.merchant_category_code,
})
}
}
@@ -283,6 +284,7 @@ impl ForeignTryFrom<domain::Profile> for ProfileResponse {
external_vault_connector_details: item
.external_vault_connector_details
.map(ForeignInto::foreign_into),
+ merchant_category_code: item.merchant_category_code,
})
}
}
@@ -450,5 +452,6 @@ pub async fn create_profile_from_merchant_account(
is_pre_network_tokenization_enabled: request
.is_pre_network_tokenization_enabled
.unwrap_or_default(),
+ merchant_category_code: request.merchant_category_code,
}))
}
diff --git a/migrations/2025-06-09-080126_add_merchant_category_code_in_business_profile/down.sql b/migrations/2025-06-09-080126_add_merchant_category_code_in_business_profile/down.sql
new file mode 100644
index 0000000000..532bb667ff
--- /dev/null
+++ b/migrations/2025-06-09-080126_add_merchant_category_code_in_business_profile/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile DROP COLUMN IF EXISTS merchant_category_code;
\ No newline at end of file
diff --git a/migrations/2025-06-09-080126_add_merchant_category_code_in_business_profile/up.sql b/migrations/2025-06-09-080126_add_merchant_category_code_in_business_profile/up.sql
new file mode 100644
index 0000000000..125634a30e
--- /dev/null
+++ b/migrations/2025-06-09-080126_add_merchant_category_code_in_business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN merchant_category_code VARCHAR(16) DEFAULT NULL;
\ No newline at end of file