-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Description
Description
This PR integrates the Euclid-based decision engine with Hyperswitch’s dynamic routing infrastructure. It enables dual routing logic: legacy DSL-based evaluation and decision-engine-backed configurations. The integration ensures routing algorithms can be authored, activated, and evaluated via Euclid and linked seamlessly to merchant profiles.
Outcomes
- Adds support for storing and linking decision-engine routing IDs (
decision_engine_routing_id) in the existingrouting_algorithmtable. - Enables creation and linking of Euclid routing configurations during algorithm creation and configuration linking flows.
- Enhances observability with logging and tracing of decision engine interactions.
- Preserves backward compatibility with existing static/dynamic routing mechanisms.
Diff Hunk Explanation
crates/api_models/src/routing.rs
- Added
decision_engine_routing_idtoRoutingDictionaryRecordto expose the DE mapping in API responses. - Updated
RoutingAlgorithmKindwithPartialEqto aid in logic branching.
crates/diesel_models/src/routing_algorithm.rs
- Included new optional field
decision_engine_routing_idto map to Euclid's algorithm record.
crates/diesel_models/src/schema.rs
- Altered
routing_algorithmschema to includedecision_engine_routing_id VARCHAR(64).
crates/router/src/core/payments/routing.rs
- Imported
perform_decision_euclid_routinginto static routing flow for test execution and future use.
crates/router/src/core/routing.rs
- On routing creation, checks if the algorithm is a Euclid (Advanced) type, then creates it in the decision engine and stores the returned ID.
- On routing configuration linking, activates the respective routing config in the decision engine using
ActivateRoutingConfigRequest. - Enhances
retrieve_merchant_routing_dictionaryto fetch and append decision engine routing configs by profile ID.
crates/router/src/core/routing/transformers.rs
- Ensures
decision_engine_routing_idis preserved and transformed when converting between internal and API models.
migrations/2025-05-08-102850_add_de_euclid_id_in_routing_algorithm_table/*.sql
- Adds and removes the
decision_engine_routing_idcolumn in therouting_algorithmtable via Diesel migrations.
How did you test it?
Here is the complete testing guidelines.
Metadata
Metadata
Assignees
Labels
No labels