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_1 (already cloned)
- Base commit: 33cd60e64288b2a6bb24cc27b9d319fdbeab46ef
- Task ID: juspay__hyperswitch-8190
- Version: v1.114.0
TASK DESCRIPTION: Bug: refactor(dynamic_routing): add logic for creating merchant account in decision engine
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
Merchant account creation on decision-engine is pre-requisite for making success based routing calls to it. Since toggle SR endpoint on Hyperswitch is the place where rule creation API of DE is being called, we can check whether merchant_account exists in DE, if exists, toggle endpoint will go ahead with creating the rule. If not, it will first call DE to create a merchant_account and then create the rule. I have created the
is_merchant_created_in_decision_engineflag inside thedynamic_routing_algorithmcolumn which is of type JSON in profile table. I have added a#[serde(default)]attribute on top ofis_merchant_created_in_decision_engine. Hence it shouldn't break for older profiles which doesn't have this field itself.Additional Changes
- This PR modifies the API contract
- This PR modifies the database schema
- This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
- Create merchant_account and API key in Hyperswitch.
- Toggle SR for the default profile created above.
curl --location --request POST 'http://localhost:8080/account/merchant_1748681084/business_profile/pro_3gHXWoq1Xh3AKi6tNZV1/dynamic_routing/success_based/toggle?enable=dynamic_connector_selection' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: xyz' Assistant
I'll help you implement the dynamic routing refactor to add logic for creating merchant accounts in the decision engine. Let me start by understanding the current codebase structure and locating the relevant files.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.