Merged
Conversation
Changed Files
|
Chethan-rao
suggested changes
May 22, 2025
…/hyperswitch into feat_dynamic_routing_requirements
Chethan-rao
reviewed
May 23, 2025
Comment on lines
+1203
to
+1231
| let dynamic_routing_ref: routing_types::DynamicRoutingAlgorithmRef = business_profile | ||
| .dynamic_routing_algorithm | ||
| .clone() | ||
| .map(|val| val.parse_value("DynamicRoutingAlgorithmRef")) | ||
| .transpose() | ||
| .change_context(errors::ApiErrorResponse::InternalServerError) | ||
| .attach_printable( | ||
| "unable to deserialize dynamic routing algorithm ref from business profile", | ||
| )? | ||
| .unwrap_or_default(); | ||
|
|
||
| // Collect all dynamic algorithm IDs | ||
| let mut dynamic_algorithm_ids = Vec::new(); | ||
|
|
||
| if let Some(sba) = &dynamic_routing_ref.success_based_algorithm { | ||
| if let Some(id) = &sba.algorithm_id_with_timestamp.algorithm_id { | ||
| dynamic_algorithm_ids.push(id.clone()); | ||
| } | ||
| } | ||
| if let Some(era) = &dynamic_routing_ref.elimination_routing_algorithm { | ||
| if let Some(id) = &era.algorithm_id_with_timestamp.algorithm_id { | ||
| dynamic_algorithm_ids.push(id.clone()); | ||
| } | ||
| } | ||
| if let Some(cbr) = &dynamic_routing_ref.contract_based_routing { | ||
| if let Some(id) = &cbr.algorithm_id_with_timestamp.algorithm_id { | ||
| dynamic_algorithm_ids.push(id.clone()); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
could be made parallel
Member
Author
There was a problem hiding this comment.
Sure this can be taken up in another PR.
cc: @GauravRawat369
Chethan-rao
previously approved these changes
May 23, 2025
…/hyperswitch into feat_dynamic_routing_requirements
Chethan-rao
previously approved these changes
May 23, 2025
Chethan-rao
approved these changes
May 24, 2025
sahkal
approved these changes
May 24, 2025
tsdk02
approved these changes
May 24, 2025
pixincreate
added a commit
that referenced
this pull request
May 30, 2025
…ordea-sepa * 'main' of github.com:juspay/hyperswitch: (30 commits) chore(version): 2025.05.30.0 chore(ci): update postman ci credentials (#8172) chore(docs): remove old add_connector.md file (#8143) refactor: Payment Attempt as mandatory field in PaymentStatusData (#8126) fix(payment_link): sanitize embedded payment link data (#7736) chore(version): 2025.05.29.0 feat(analytics): Add ckh columns for 3ds intelligence analytics (#8136) refactor(debit_routing): Handle missing merchant_business_country by defaulting to US (#8141) chore(version): 2025.05.28.0 refactor(success_based): add support for exploration (#8158) feat(dynamic_routing): add get api for dynamic routing volume split (#8114) fix: incorrect payout_method_id in payouts table (#8107) feat(router): Enable client_secret auth for payments_get_intent [v2] (#8119) chore: address Rust 1.87.0 clippy lints (#8130) feat: list for dynamic routing (#8111) ci(cypress): fix mandates unsupported connectors (#8086) feat(connector): [Barclaycard] Implement Cards - Non 3DS flow (#8068) fix(authentication): add Organization context validation in `Merchant Create` and `Merchant List` APIs (#8103) feat(connector): [Worldpayxml] add card payment (#8076) feat(connector): Stripe revolut pay wallet integration (#8066) ...
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
This PR introduces support for listing both static and dynamic routing algorithms under a unified API interface. To accomplish this, it refactors how routing algorithms are represented and parsed, introducing clear separation between
StaticRoutingAlgorithmandDynamicRoutingAlgorithm. The new enumRoutingAlgorithmWrapperis used to encapsulate both types.Dynamic routing strategies like
EliminationBasedAlgorithm,SuccessBasedAlgorithm, andContractBasedAlgorithmare now modeled and tracked similarly to static rules, allowing for consistent listing and configuration.Outcomes
Diff Hunk Explanation
api_models/src/routing.rsStaticRoutingAlgorithm,DynamicRoutingAlgorithm, andRoutingAlgorithmWrapperenums to distinguish algorithm types.StaticRoutingAlgorithminstead of the genericRoutingAlgorithm.#[serde(untagged)]for backward-compatible JSON parsing.api_models/src/events/routing.rsRoutingVolumeSplitfor event logging viaApiEventMetric.router/src/core/routing.rsretrieve_linked_routing_config, extended logic to resolve dynamic routing references and list their metadata.router/src/core/routing/helpers.rsStaticRoutingAlgorithm.router/src/core/payments/routing.rsStaticRoutingAlgorithm.transformers.rs,admin.rs,payments.rs, andstripe/types.rsStaticRoutingAlgorithm.Additional Changes
Motivation and Context
How did you test it?
Curls for testing the flows:
Response
Response:
Response:
Response:
Response
toggle SR, toggle ER
create a static rule and activate it
Response
3 values should come
Checklist
cargo +nightly fmt --allcargo clippy