feat(router): add merchant_category_code in business profile (#8296)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Shankar Singh C
2025-06-12 15:35:50 +05:30
committed by GitHub
parent 5a37c283d6
commit 0f14279866
17 changed files with 254 additions and 4 deletions

View File

@ -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.