-
Notifications
You must be signed in to change notification settings - Fork 647
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
Preserve payment selection for guests #5480
Preserve payment selection for guests #5480
Conversation
private fun createWithoutCustomer( | ||
clientSecret: ClientSecret, | ||
stripeIntent: StripeIntent, | ||
config: PaymentSheet.Configuration?, | ||
isGooglePayReady: Boolean, | ||
isLinkReady: Boolean | ||
): FlowControllerInitializer.InitResult { | ||
val savedSelection = if (isLinkReady) { | ||
SavedSelection.Link | ||
} else if (isGooglePayReady) { | ||
SavedSelection.GooglePay | ||
} else { | ||
SavedSelection.None | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this logic for guests, because we can just use setLastSavedPaymentMethod()
for this.
@@ -239,7 +239,7 @@ class LinkPaymentLauncher @AssistedInject internal constructor( | |||
|
|||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | |||
companion object { | |||
val LINK_ENABLED = BuildConfig.DEBUG | |||
val LINK_ENABLED = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to revert my earlier change because this breaks the PaymentOptionsActivityTest
.
e62b83e
to
483614f
Compare
483614f
to
2cdcc4a
Compare
@@ -242,7 +242,7 @@ class LinkPaymentLauncher @AssistedInject internal constructor( | |||
|
|||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | |||
companion object { | |||
val LINK_ENABLED = BuildConfig.DEBUG | |||
val LINK_ENABLED = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, unfortunately had to do this to stop PaymentOptionsActivityTest
from failing.
Summary
This pull request fixes a bug where the
FlowController
would show an incorrect payment method selection for guests that don’t have any saved payment methods.Previously, we would use
PrefsRepository.NoOp
when no customer ID was provided to our SDK. Now, we useDefaultPrefsRepository
and store a guest’s last saved payment method under a generic"guest"
key. This is similar to iOS, which uses an empty string.Motivation
Bugfix.
Testing
Screen recordings
Before
The payment options sheet would default to Google Pay, even if Link was available and had been previously selected.
old-behavior.mp4
After
The payment options sheet now correctly shows link as the current payment selection when opening the sheet.
new-behavior.mp4
Changelog
[Fixed]
FlowController
now correctly preserves the previously selected payment method for guests.