feat(payments): implement routing in payments v2#7709
Merged
likhinbopanna merged 27 commits intomainfrom Jun 3, 2025
Merged
Conversation
jarnura
previously approved these changes
May 21, 2025
jagan-jaya
requested changes
May 28, 2025
Comment on lines
+6688
to
+6690
| payment_data.set_connector_in_payment_attempt(routing_data.routed_through); | ||
|
|
||
| payment_data.set_merchant_connector_id_in_attempt(routing_data.merchant_connector_id); |
Contributor
There was a problem hiding this comment.
let fallback_config = admin::ProfileWrapper::new(business_profile.clone())
.get_default_fallback_list_of_connector_under_profile()
.change_context(errors::RoutingError::FallbackConfigFetchFailed)
.change_context(errors::ApiErrorResponse::InternalServerError)?;
let first_chosen_connector = fallback_config
.first()
.ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?;
let connector_name = first_chosen_connector.connector.to_string();
let merchant_connector_id = first_chosen_connector
.merchant_connector_id
.clone()
.get_required_value("merchant_connector_id")?;
in older implementation for set_connector_in_payment_attempt we were using the first_chosen_connector.connector and for set_merchant_connector_id_in_attempt we were using first_chosen_connector.merchant_connector_id. now the implementation is different it intended?
Contributor
There was a problem hiding this comment.
yeah, initially there was no routing in v2, so we have fetched default fallback from profile, picked the first connector.
this code is no more needed, as we are using routing core to decide connector
jagan-jaya
previously approved these changes
May 29, 2025
…nto payments-routing-v2
jagan-jaya
previously approved these changes
May 30, 2025
…nto payments-routing-v2
jagan-jaya
approved these changes
Jun 1, 2025
jarnura
approved these changes
Jun 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Implemented rule based routing in payments v2.
Straight through routing in v2 will be achieved by first configuring a straight through algorithm using
routingendpoint and then passing therouting_algorithm_idfield in payment create intent request.routing_algorithm_idin payment_inten_create and payment_intent_update.Three diff types of routing
Additional Changes
Motivation and Context
How did you test it?
Please use this log for checking the final list of connectors decided by routing module -
final_selected_connectors_for_routingCreate a routing algo entry, with rule and use that routing id in payment intent create
create routing algorithm -
Response -
Payment intent create -
Confirm intent -
final list of connectors decided by routing module

payment happened with Bluesnap
Rule based routing activation at profile level -

Creating new routing algo , with adyen as priority.
Activate the routing algorithm id
req -
response -
verify from profile entry, the routing algo id will be populated

Create intent without passing routing id at all in the request
Final list of connectors -

Confirm intent

Default Fallback -


Verify in profile
Payment Intent create -
use the client secret to confirm the intent
Confirm request -
Confirm Intent Response -
here the payment went through stripe -
Checklist
cargo +nightly fmt --allcargo clippy