Skip to content

Feature/saved payment method client - #1719

Draft
balamaninayard wants to merge 3 commits into
braintree:view-edit-fi-beta-featurefrom
balamaninayard:feature/saved-payment-method-client
Draft

balamaninayard wants to merge 3 commits into
braintree:view-edit-fi-beta-featurefrom
balamaninayard:feature/saved-payment-method-client

Conversation

@balamaninayard

Copy link
Copy Markdown

Summary of changes

  • Adds the internal PayPalSavedPaymentMethodClient, which fetches what to display for a buyer's vaulted PayPal payment method: the saved funding instrument and the accompanying Pay Later message.
  • Adds PayPalFundingInstrumentDetailsGraphQLBody and PayPalFundingInstrumentFetchType to build the PaypalFundingInstrumentDetails GraphQL query, supporting both the buyer's default billing agreement (resolved via the client token's payment method ID JWT) and a buyer-updated billing agreement (resolved via an approved checkout's order ID).
  • Adds PayPalSavedPaymentMethodException, a sealed exception type covering invalid authorization, missing identity fields (payment method ID JWT / order ID), empty responses, failed parsing, and a missing Pay Later message.
  • fetchPaymentMethod requires a client token (a tokenization key has no paymentMethodIdJwt) and surfaces GraphQL errors returned in a 200 response.
  • fetchCreditPresentmentMessages calls the credit presentment messages REST endpoint (production/sandbox based on configuration) and is treated as additive — callers should hide the message row on failure rather than fail checkout.
  • Analytics events for both flows are deferred (TODOs in code) pending catalog approval.

AI Usage

Which AI Agent Was Used?

  • Claude

How was AI used?
Code generation and unit test authoring for the new GraphQL body, fetch type enum, exception hierarchy, and client class, following the module's existing conventions (constructor DI, sealed exceptions, suspend-based client).

Estimated AI Code Contribution

  • less than 30%
  • 30 - 60%
  • 60 - 100%

Checklist

  • Added a changelog entry
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

List GitHub usernames for everyone who contributed to this pull request.


Inner Source Process

Internal to PayPal contributors should fill out this section. All others can delete.
...

Inner Source Checklist

  • Added all labels to the PR
  • Provide steps to test the flows changed, if applicable in the summary
  • Demo video of the functionality, if applicable
  • All upstream dependencies are merged in and this PR can be released at any time; PRs should not be opened until this is true
  • Unit tests and builds have been run locally and pass/compile as expected

balamaninayard and others added 3 commits October 7, 2026 15:44
…L body and fetch type

- PayPalFundingInstrumentFetchType maps BUYER_DEFAULT_BILLING_AGREEMENT / BUYER_UPDATED_BILLING_AGREEMENT
  to the STICKY_FI / FI_FROM_APPROVED_CHECKOUT GraphQL enum values
- PayPalFundingInstrumentDetailsGraphQLBody builds the PaypalFundingInstrumentDetails query, sending only
  the identity field for the fetch type and omitting null values

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- PayPalSavedPaymentMethodException covers invalid authorization, missing payment method ID JWT,
  missing order ID, empty body, unparseable summary and missing preferred message

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- fetchPaymentMethod resolves the buyer's funding instrument over GraphQL; GraphQL errors surface as
  BraintreeException
- fetchCreditPresentmentMessages fetches the Pay Later message from v2/credit/fetch-presentment-messages
- both require a client token and validate it before sending a request

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@balamaninayard
balamaninayard requested a review from a team as a code owner October 7, 2026 10:20
@balamaninayard
balamaninayard marked this pull request as draft October 7, 2026 10:20

This branch has not been deployed

No deployments
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.

1 participant