Enhance JsonSerializer to prevent escaping forward slashes in Google Pay signedMessage#303
Merged
armando-rodriguez-cko merged 1 commit intoMar 4, 2026
Conversation
…Pay signedMessage. Add test to verify correct serialization behavior. Update assertions in PaymentSetupsIntegrationTest to handle lowercase payment_type response from API.
7e43c89 to
dea1838
Compare
|
david-ruiz-cko
approved these changes
Mar 4, 2026
david-ruiz-cko
approved these changes
Mar 4, 2026
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.



This pull request introduces several improvements across serialization logic and test coverage, particularly focusing on ensuring correct JSON output for Google Pay token data, improving test robustness, and handling API response inconsistencies. The most notable changes are grouped below:
Serialization improvements:
JsonSerializerto use theJSON_UNESCAPED_SLASHESflag, ensuring that forward slashes in JSON output (such as in Google Pay signed messages) are not escaped, which is required by the API.Test enhancements and coverage:
testSerializeGooglePayTokenDataDoesNotEscapeSlashesInSignedMessageto verify that forward slashes in thesignedMessagefield ofGooglePayTokenDataare not escaped during serialization, preventing potential API errors. [1] [2]Test robustness and API compatibility:
total_refundedbalance matches the expected amount, making tests more reliable against eventual consistency in the API.payment_typein payment setup tests to compare values in a case-insensitive manner, accommodating inconsistencies between API responses (lowercase) and specification (PascalCase). [1] [2]assertResponsehelper to explicitly check that array keys exist before asserting their values, and to allow0as a valid value for numeric fields, improving test accuracy and clarity.