feat(core): Introduce new decide flow mechanism for payment authorization #9808
+982
−189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This PR introduces a new "decide flow" mechanism for payment authorization that enhances the flexibility and intelligence of connector routing. The key improvements include:
Core Changes:
pre_decide_flows
method that allows connectors to determine the optimal flow path before making authorization callsConnectorSpecifications
trait with methods likeshould_call_connector_service_with_pre_decide_flow()
,get_preprocessing_flow_if_needed()
, andget_alternate_flow_if_needed()
ConnectorIntegrationInterface
to support both old and new connector architectures seamlesslyAdditional Changes
Key files modified:
crates/hyperswitch_interfaces/src/connector_integration_interface.rs
- New integration interfacecrates/hyperswitch_interfaces/src/api.rs
- Enhanced connector specificationscrates/router/src/core/payments/flows/authorize_flow.rs
- Pre-decide flow implementationcrates/router/src/core/payments.rs
- Core payment flow updatesMotivation and Context
This change addresses the need for more intelligent and flexible payment flow routing in Hyperswitch. Previously, the payment authorization flow was rigid and couldn't adapt to different connector requirements or preprocessing needs. The new decide flow mechanism:
How did you test it?
The changes have been tested through:
pre_decide_flows
methodChecklist
cargo +nightly fmt --all
cargo clippy