Skip to content

Skip existingPaymentMethodRequired in Google Pay test mode#13309

Open
seanzhang-stripe wants to merge 1 commit into
masterfrom
seanzhang/gpay-test-mode-no-existing-pm
Open

Skip existingPaymentMethodRequired in Google Pay test mode#13309
seanzhang-stripe wants to merge 1 commit into
masterfrom
seanzhang/gpay-test-mode-no-existing-pm

Conversation

@seanzhang-stripe

Copy link
Copy Markdown
Contributor

Committed-By-Agent: claude

Summary

This change skips the existingPaymentMethodRequired constraint and the loadPaymentData readiness check when the environment is Test, allowing developers to test Google Pay flows without a real card in their wallet.

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

In test mode, Google's isReadyToPay API can return false even when the
user has joined the googlepay-test-mode-stub-data group, because the
check requires an existing payment method in the wallet. This makes
local testing impossible without adding a real card.

This change skips the existingPaymentMethodRequired constraint and the
loadPaymentData readiness check when the environment is Test, allowing
developers to test Google Pay flows without a real card in their wallet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude

suspend fun loadPaymentData(): Task<PaymentData> {
check(isReadyToPay()) {
check(args.config.environment == GooglePayEnvironment.Test || isReadyToPay()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't love this. The behaviour is now different from GooglePayLauncherViewModel. I also don't see any tests for this

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.

3 participants