-
Notifications
You must be signed in to change notification settings - Fork 4k
refactor: Add routing_approach other variant to handle unknown data #8754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
2 tasks
jagan-jaya
previously approved these changes
Jul 25, 2025
tsdk02
previously approved these changes
Jul 25, 2025
tsdk02
approved these changes
Jul 25, 2025
ShankarSinghC
approved these changes
Jul 25, 2025
pixincreate
added a commit
that referenced
this pull request
Jul 28, 2025
…rver * 'main' of github.com:juspay/hyperswitch: (24 commits) chore(version): 2025.07.28.1 feat(core): Hyperswitch <|> UCS Mandate flow integration (#8738) feat(themes): Create user APIs for managing themes (#8387) chore: update devDependencies for cypress (#8735) refactor: Add routing_approach other variant to handle unknown data (#8754) chore(version): 2025.07.28.0 refactor(connector): [facilitapay] move destination bank account number to connector metadata (#8704) feat(recovery-events): add revenue recovery topic and vector config to push these events to s3 (#8285) ci(cypress): add authorizedotnet connector (#8688) refactor(schema): add a new column for storing large customer user agents in mandate table (#8616) feat(authentication): add authentication api for modular authentication (#8459) feat(connector): [MPGS] template code (#8544) fix(chat): append request id to headers for chat request (#8680) feat(connector): [Flexiti]template code for flexiti connector (#8714) chore(version): 2025.07.25.0 feat(core): Consuming locale in PaymentsAuthorizeData from SessionState (#8731) fix(payment-methods): fetch payment method details in payouts flow (#8729) refactor(core): remove hardcoded timeout limit of 5s for outgoing webhook requests (#8725) feat(connector): [Breadpay]Add support for Breadpay connector (#8676) fix(feature_matrix): refunds are supported by jpmorgan (#8699) ...
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 pull request focuses on ensuring consistency and correctness when handling the
routing_approach
field across various modules in the codebase. The most significant changes involve adding.clone()
to prevent ownership issues, updating theRoutingApproach
enum to support additional serialization formats, and improving hashing logic.Consistency and correctness improvements:
Cloning
routing_approach
values: Updated multiple files to ensurerouting_approach
values are cloned before being processed. This change avoids ownership issues and ensures data integrity. Affected files include:crates/analytics/src/payments/distribution/payment_error_message.rs
crates/analytics/src/payments/metrics/*.rs
(e.g., [1] [2] [3] etc.)crates/analytics/src/payments/metrics/sessionized_metrics/*.rs
(e.g., [1] [2] [3] etc.)crates/router/src/services/kafka/payment_attempt.rs
Hashing logic update: Modified the
impl Hash for PaymentMetricsBucketIdentifier
to clone therouting_approach
field before hashing, ensuring no ownership issues arise during the hashing process. (crates/api_models/src/analytics/payments.rs
, crates/api_models/src/analytics/payments.rsL277-R280)Enum enhancements:
RoutingApproach
enum update: Added support for untagged serialization and a default fallback for unknown values using#[serde(untagged)]
and#[strum(default)]
. This ensures better compatibility with external data formats. (crates/common_enums/src/enums.rs
, crates/common_enums/src/enums.rsR8562-R8564)Minor changes:
Copy
trait fromTokenDataType
: This change likely reflects that the enum now includes non-Copy
types or is being prepared for future modifications. (crates/common_enums/src/enums.rs
, crates/common_enums/src/enums.rsL8536)Additional Changes
Motivation and Context
How did you test it?
DB -

Clickhouse -

Stagger case -
DB -

Clickhouse -
When adding new variants in the enum (example use case)-
composite_routing
) -Checklist
cargo +nightly fmt --all
cargo clippy