Add missing enum values for afterpaytouch_US and DEFFERED_DEBIT - #2057
Open
piyush15102003 wants to merge 1 commit into
Open
Add missing enum values for afterpaytouch_US and DEFFERED_DEBIT#2057piyush15102003 wants to merge 1 commit into
piyush15102003 wants to merge 1 commit into
Conversation
The Checkout API can return payment method type afterpaytouch_US (Afterpay/Cash App Afterpay in the US) and additionalData.fundingSource DEFFERED_DEBIT from POS terminals, but neither value was present in the corresponding generated enums, causing deserialization/mapping issues. - CheckoutPaymentMethod: add afterpaytouch_US to the discriminator mapping - AfterpayDetails.TypeEnum: add AFTERPAYTOUCH_US - CardDetails.FundingSourceEnum: add DEFFERED_DEBIT Fixes Adyen#1953 Fixes Adyen#1878
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for the afterpaytouch_US payment method type in AfterpayDetails and CheckoutPaymentMethod, and introduces the DEFFERED_DEBIT funding source to CardDetails. Corresponding unit tests have been added to verify these changes. There are no review comments, so no additional feedback is provided.
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.
Fixes #1953, fixes #1878.
Both issues have the same root cause: the live API can return values that are missing from the generated enums. Because of that, the values get deserialized as
nulland the actual API value is lost.The missing values are:
/paymentMethodscan returnafterpaytouch_USfor Afterpay/Cash App Afterpay in the US. This is missing from theCheckoutPaymentMethoddiscriminator mapping andAfterpayDetails.TypeEnum.additionalData.fundingSource = DEFFERED_DEBIT, which is missing fromCardDetails.FundingSourceEnum.As discussed in #1514, unknown enum values are handled by returning
nullwith a warning instead of throwing an exception. So these values don't cause a failure, but we still lose useful data when they are returned by the API.This change adds the missing values so they are correctly deserialized.
Changes
afterpaytouch_USto theCheckoutPaymentMethoddiscriminator mapping.AFTERPAYTOUCH_UStoAfterpayDetails.TypeEnum.DEFFERED_DEBITtoCardDetails.FundingSourceEnum.fromValue()resolution and polymorphic deserialization of aCheckoutPaymentMethodpayload.The casing is kept exactly as returned by the API (
afterpaytouch_USandDEFFERED_DEBIT). This follows the decision in #1514 to keep enum matching case-sensitive, as defined by OpenAPI.Verification
mvn -Dtest=com.adyen.serializer.ModelTest test -Dcheckstyle.skip=true— 19 tests, 0 failures.mvn test -Dcheckstyle.skip=true -DskipITs— 634 tests, 0 failures, 0 errors, 4 skips.mvn checkstyle:check— no new violations.