Skip to content
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

[fix] Address verification details lost during deserialization #289

Merged
merged 2 commits into from
Nov 16, 2023

Conversation

nwithan8
Copy link
Member

Description

Our current setup reuses the Error class to represent address verification errors. However, the Error class has a custom deserializer that is being called during typical JSON deserialization in our library. Hard-coded logic inside that deserializer was effectively causing deserialization of the hints for address verification to fail.

This PR introduces another custom deserializer, specifically for the AddressVerification class that handles deserializing address verification JSON without the Error deserializer getting in the way.

Closes #288

Testing

  • Improved existing unit test to verify that deserialization worked properly (that address verification details were not lost during deserialization)

Pull Request Type

Please select the option(s) that are relevant to this PR.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement (fixing a typo, updating readme, renaming a variable name, etc)

- Add unit test to verify AddressVerification deserialization works properly
Justintime50
Justintime50 previously approved these changes Nov 13, 2023
Copy link
Member

@Justintime50 Justintime50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good!

assertNotNull(address.getVerifications().getZip4().getErrors()); // Should have a error due to second line
assertNotNull(address.getVerifications().getDelivery().getErrors());

assertFalse(address.getVerifications().getDelivery().getErrors().isEmpty()); // should have at least one error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: the double negative is hard to read. We should probably be asserting that it is present instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDE didn't like that we weren't using this "simplified" way.

@nwithan8 nwithan8 merged commit 710381d into master Nov 16, 2023
16 checks passed
@nwithan8 nwithan8 deleted the verifications branch November 16, 2023 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Address verification errors are being incorrectly parsed by the library
3 participants