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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(wasm): add MCC list in wasm (#10780)
Nithin N7f5979c6a9c2
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex a702feb777..bfa810db0b 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -3233,7 +3233,6 @@ impl MerchantCategoryCode {pub fn get_category_name(&self) -> Result<&str, InvalidMccError> {let code = self.get_code()?;match code {- // specific mapping needs to be depricated5411 => Ok("Grocery Stores, Supermarkets (5411)"),7011 => Ok("Lodging-Hotels, Motels, Resorts-not elsewhere classified (7011)"),763 => Ok("Agricultural Cooperatives (0763)"),@@ -3241,6 +3240,47 @@ impl MerchantCategoryCode {5021 => Ok("Office and Commercial Furniture (5021)"),4816 => Ok("Computer Network/Information Services (4816)"),5661 => Ok("Shoe Stores (5661)"),+ 743 => Ok("Wine producers"),+ 744 => Ok("Champagne producers"),+ 4011 => Ok("Railroads"),+ 4511 => Ok("Airlines and air carriers"),+ 4733 => Ok("Ticket Sales for Large Scenic Spots"),+ 4813 => Ok("Key-entry Telecom Merchant providing single local and long-distance phone calls using a central access number in a non-face-to-face environment using key entry"),+ 4815 => Ok("Monthly summary telephone charges"),+ 4829 => Ok("Wire transfers and money orders"),+ 5262 => Ok("Marketplaces"),+ 5552 => Ok("Electric Vehicle Charging"),+ 5715 => Ok("Alcoholic beverage wholesalers"),+ 6050 => Ok("Quasi Cash: Customer Financial Institution"),+ 6532 => Ok("Payment Transaction: Customer Financial Institution"),+ 6533 => Ok("Payment Transaction: Merchant"),+ 6536 => Ok("MoneySend Intracountry"),+ 6537 => Ok("MoneySend Intercountry"),+ 6538 => Ok("Funding Transactions for MoneySend"),+ 6540 => Ok("Non-Financial Institutions - Stored Value Card Purchase/Load"),+ 7013 => Ok("Real Estate Agent - Brokers"),+ 7280 => Ok("Private Hospital"),+ 7295 => Ok("Housekeeping Service (China)"),+ 7322 => Ok("Debt collection agencies"),+ 7512 => Ok("Automobile rentals"),+ 7523 => Ok("Parking lots and garages"),+ 7800 => Ok("Government-Owned Lotteries (US Region only)"),+ 7801 => Ok("Government Licensed On-Line Casinos (On-Line Gambling) (US Region only)"),+ 7802 => Ok("Government-Licensed Horse/Dog Racing (US Region only)"),+ 8912 => Ok("Fitments, Ornaments and Gardening"),+ 9211 => Ok("Court costs, including alimony and child support"),+ 9222 => Ok("Fines"),+ 9223 => Ok("Bail and bond payments"),+ 9311 => Ok("Tax payments"),+ 9399 => Ok("Government services -- not elsewhere classified"),+ 9400 => Ok("Embassy Fee Payments"),+ 9402 => Ok("Postal services -- government only"),+ 9405 => Ok("U.S. Federal Government Agencies or Departments"),+ 9406 => Ok("Government-Owned Lotteries (Non-U.S. region)"),+ 9700 => Ok("Automated Referral Service ( For Visa Only)"),+ 9701 => Ok("Visa Credential Service ( For Visa Only)"),+ 9702 => Ok("Emergency Services (GCAS) (Visa use only)"),+ 9950 => Ok("Intra-Company Purchases"),_ => Err(InvalidMccError {message: format!("Category name not found for {}", code),diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rsindex 3e3d468a58..84a4634f79 100644--- a/crates/euclid_wasm/src/lib.rs+++ b/crates/euclid_wasm/src/lib.rs@@ -50,6 +50,12 @@ struct SeedData {static SEED_DATA: OnceLock<SeedData> = OnceLock::new();static SEED_FOREX: OnceLock<currency_conversion_types::ExchangeRates> = OnceLock::new();+const MERCHANT_CATEGORY_CODES: &[u16] = &[+ 743, 744, 763, 4011, 4511, 4733, 4813, 4815, 4816, 4829, 5021, 5262, 5411, 5552, 5661, 5715,+ 6050, 6532, 6533, 6536, 6537, 6538, 6540, 7011, 7013, 7280, 7295, 7322, 7512, 7523, 7800, 7801,+ 7802, 8111, 8912, 9211, 9222, 9223, 9311, 9399, 9400, 9402, 9405, 9406, 9700, 9701, 9702, 9950,+];+#[wasm_bindgen]extern "C" {#[wasm_bindgen(js_namespace = console, js_name = log)]@@ -109,9 +115,9 @@ pub fn get_two_letter_country_code() -> JsResult {/// along with their names.#[wasm_bindgen(js_name=getMerchantCategoryCodeWithName)]pub fn get_merchant_category_code_with_name() -> JsResult {- let merchant_category_codes_with_name = vec![5411, 7011, 763, 8111, 5021, 4816, 5661]- .into_iter()- .filter_map(|mcc_value| match MerchantCategoryCode::new(mcc_value) {+ let merchant_category_codes_with_name = MERCHANT_CATEGORY_CODES+ .iter()+ .filter_map(|&mcc_value| match MerchantCategoryCode::new(mcc_value) {Ok(mcc) => match mcc.get_category_name() {Ok(mcc_name) => Some(MerchantCategoryCodeWithName {code: mcc.clone(),