fix(router): correct payment_method_data parsing in list-payments response#13135
Open
ayush22667 wants to merge 2 commits into
Open
fix(router): correct payment_method_data parsing in list-payments response#13135ayush22667 wants to merge 2 commits into
ayush22667 wants to merge 2 commits into
Conversation
Sakilmostak
reviewed
Jul 2, 2026
| ); | ||
| None | ||
| } | ||
| _ => match data.parse_value::<api_models::payments::AdditionalPaymentData>( |
Contributor
There was a problem hiding this comment.
instead of wild card, parse only in case of json
|
The Add |
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
The
ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)>conversion forapi::PaymentsResponse(used to build the list-payments response) parsedpayment_method_datadirectly from the raw stored column as
PaymentMethodDataResponseWithBilling. This isinconsistent with how the field is derived elsewhere in this file, where the stored value is read
via the encryption-strategy-aware accessor and parsed as
AdditionalPaymentDatabefore beingconverted to
PaymentMethodDataResponse. Depending on the merchant's payment method dataencryption strategy, the raw-column parse could silently fail or return incorrect data, so
payment_method_datacame backNone/incorrect for affected payments in list responses.This PR rebuilds
payment_method_datausingcheck_and_get_payment_method_data_based_on_encryption_strategy()+AdditionalPaymentData→PaymentMethodDataResponse::from, matching the pattern already used bythe other response conversions in this file.
Additional Changes
Motivation and Context
payment_method_datain the list-payments response was being parsed inconsistently with the restof the codebase, leading to it being dropped/incorrect for some payments depending on encryption
strategy.
How did you test it?
1. Create + Confirm Google Pay
Request
Response
2. Payments List - Wallet card_network
Request
Response
3. Payments Retrieve
Request
Response
Checklist
cargo +nightly fmt --allcargo clippy