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_3 (already cloned)
- Base commit: 0e957854372f1e6a81ce72234b8a4fda16cb4b8d
- Task ID: juspay__hyperswitch-8910
- Version: v1.116.0
TASK DESCRIPTION: Bug: refactor(euclid): transform enum types to include sub-variants of payment method types
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
This PR refactors the Euclid routing parameter transformation logic to include sub-variants of payment method types in the Decision Engine evaluation request.
Key updates:
- Added logic to convert
(payment_method_type, payment_method)pairs into aDirValuerepresentation. - Introduced
insert_dirvalue_param()to map eachDirValuevariant into a corresponding routing parameter key. - Enhanced
convert_backend_input_to_routing_evalto insert these sub-variant parameters alongside existing routing parameters. - This ensures richer context is sent to Euclid for more granular routing decisions.
Outcomes
- Enables finer-grained routing rules based on payment method sub-types (e.g.,
WalletType,CryptoType,GiftCardType). - Improves compatibility with dashboard-configured payment method rules in Euclid.
- Makes routing evaluation requests more descriptive and precise, improving match accuracy.
Diff Hunk Explanation
crates/router/src/core/payments/routing/utils.rs- Modified
convert_backend_input_to_routing_eval:
Assistant
I'll work on this refactoring task to transform enum types to include sub-variants of payment method types in the Euclid routing parameter transformation logic. Let me start by examining the relevant files to understand the current implementation.
First, let me look at the specific file mentioned in the task description -
crates/router/src/core/payments/routing/utils.rs:Assistant
Let me search for files related to payment method types and DirValue to understand the current implementation better:
Assistant
Now let me look at the enum types and DirValue to understand how payment methods are structured:
Assistant
Let me search for DirValue more broadly in the codebase to understand how it's defined:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.