You are working on the hyperswitch repository (Rust payment processing system).…
- User
You are working on the hyperswitch repository (Rust payment processing system).
REPOSITORY SETUP:
- Repository: juspay/hyperswitch
- Working directory: ./repos/hyperswitch_pool_6 (already cloned)
- Base commit: 713c85d25d29259672da6efbfed0862e843ec542
- Task ID: juspay__hyperswitch-8295
- Version: v1.114.0
TASK DESCRIPTION: Bug: add
merchant_category_codein business profileAdd support to accept
merchant_category_codeas input in the business profile. This is the four-digit code assigned based on business type to determine processing fees and risk level. This code can be used to make various decision during a payment flow. One such use case is network interchange fee calculation in debit routing.DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
This pull request introduces
merchant_category_codefield in the business profile. This is the four-digit code assigned based on business type to determine processing fees and risk level. This code can be used to make various decision during a payment flow. One such use case is network interchange fee calculation in debit routing.- Enum Enhancements: Introduced two new enums,
MerchantCategoryandMerchantCategoryCode, to represent MCCs and their corresponding human-readable names. Implemented a mapping functionto_merchant_category_nameto convert MCCs to their names.
WASM Functionality
- Frontend Integration: Added a new WASM function
getMerchantCategoryCodeWithNameto retrieve all MCCs along with their names for frontend use. This function iterates over theMerchantCategoryCodeenum and constructs a list of MCCs and their human-readable names.
Code Refactoring
- Enum Renaming: Renamed
MerchantCategoryCodeto in specific contexts to clarify usage in decision engine logic. This is struct will be removed once the new struct is introduced in decision engine.
Assistant
I'll help you implement the merchant_category_code feature in the business profile. Let me start by creating a plan and exploring the relevant files.
Assistant
Let me first explore the business profile structure to understand where to add the merchant_category_code field.
Assistant
(no content)
Assistant
Let me examine the business profile structures to understand the current implementation:
Assistant
Let me look at the diesel models and storage models to understand the structure better:
Assistant
Now let me check the router storage models:
Assistant
Let me check for any existing merchant category code related code or enums:
Assistant
Let me check the common enums to see if there are any existing merchant category related enums:
Assistant
(no content)
Assistant
Let me search for any reference to the specific merchant category codes mentioned in the task:
Assistant
Let me check the API models to understand how business profiles are handled in the API layer:
Assistant
(no content)
Assistant
Let me search for API models that relate to business profiles more broadly:
Assistant
Let me look for account-related API models since the curl example shows
/account/merchant_1749476401/business_profile/endpoint:Assistant
Let me look at admin.rs since it might contain business profile definitions:
Assistant
Let me check if there are any tests that show how business profiles are defined or used:
Assistant
Let me check the database schema to understand how to add the field:
Assistant
Let me look at the schema files to understand the structure:
Assistant
Now let me check how the API models are structured for business profiles. First, I'll update my todo list to reflect the work I'm starting:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.