DEV-135811: Support digital wallets in the SDK#216
Open
tomas-amaro wants to merge 1 commit into
Open
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
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.
Summary
Adds a digital-wallets payment-details model to the Java SDK, enabling merchants (driver: lastminute.com) to submit Apple Pay / Google Pay / Samsung Pay / WeChat Pay / Amazon Pay / Alipay payments. Implements the
digital_wallets_payment_detailsschema from the API reference.Jira: DEV-135811
Changes
WalletPaymentDetails(com.riskified.models) implementingIPaymentDetails. Contains all 21 fields from the spec (payment_type,avs_result_code,credit_card_company,credit_card_country,credit_card_token,cardholder_name,authorization_id,mid,id,stored_payment_created_at,stored_payment_updated_at,installments,acquirer_bin,acquirer_region,authorization_type,expiry_month,expiry_year,initial_payment_amount,payment_frequency,billing_address_id,authentication_result).JSONFormater.paymentDetailsSerializer()(discriminatordigital_wallet) so a wallet detail can be serialized inside an order'spaymentDetailslist. Reuses the existingAuthenticationResultandAuthorizationTypemodels.PaymentDetailsTestcovering payment-type serialization, the net-new field keys, validation (happy path + rejections), and end-to-end polymorphic serialization.6.3.1→6.4.0inpom.xmlandREADME.md.Design decisions
payment_typeis a required, settable field (unlike other payment models which hardcode their type) since it varies across the six wallet types. It's a constructor argument and validated to be one of the six wallet values.PaymentTypeenum — all six wallet values already existed.initial_payment_amount,payment_frequency,billing_address_idare net-new to the codebase; optional numerics use boxed/nullable types so they only serialize when set.payment_type,authorization_id,avs_result_code) match the spec.methoddiscriminator is a legacy SDK-internal field (not part of the API spec, which distinguishes purely bypayment_type); registration is required by the polymorphic serializer, sodigital_walletwas used for consistency with the other payment types.Testing
PaymentDetailsTest— all 15 tests pass (8 pre-existing + 7 new wallet tests), including verification that a wallet inside anIPaymentDetailslist serializes with"method":"digital_wallet"and the correctpayment_type.