Skip to content
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

Fix issue of removed PM sticking around #6386

Merged
merged 2 commits into from
Mar 20, 2023

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Mar 17, 2023

Summary

This pull request fixes an issue in FlowController where an outdated payment method would stick around and would potentially be used for payment confirmation.

The issue occurred when removing the currently selected payment method and then closing PaymentSheet without explicitly selecting a new one. We’re addressing this issue by including the current payment method selection in PaymentOptionResult.Canceled and updating FlowControllerViewModel.paymentSelection.

Motivation

Resolves #6385

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

[FIXED] Fixed an issue where FlowController.getPaymentOption() and PaymentOptionCallback might return an outdated payment option in some cases.

@tillh-stripe tillh-stripe force-pushed the tillh/6385-paymentoptioncallback-with-removed-pm branch 4 times, most recently from ba37291 to 47fc168 Compare March 17, 2023 18:19
@tillh-stripe
Copy link
Collaborator Author

tillh-stripe commented Mar 17, 2023

I’ve been having issues getting this tested in PaymentOptionsViewModelTest, as I couldn’t get the PaymentOptionsStateMapper to emit a new state even when one of its inputs changed. I plan on getting rid of some of the PaymentOptionsState logic though (with this), so any test I’d write would become obsolete anyway. If anyone is feeling strongly about adding a test, I can continue to try, but I lean towards merging in the current state.

@tillh-stripe tillh-stripe marked this pull request as ready for review March 17, 2023 18:22
@tillh-stripe tillh-stripe requested review from a team as code owners March 17, 2023 18:22
@tillh-stripe tillh-stripe force-pushed the tillh/6385-paymentoptioncallback-with-removed-pm branch from 47fc168 to 20f3dc9 Compare March 17, 2023 19:12
@tillh-stripe tillh-stripe force-pushed the tillh/6385-paymentoptioncallback-with-removed-pm branch from 20f3dc9 to c613a71 Compare March 17, 2023 19:32
@tillh-stripe
Copy link
Collaborator Author

Added a note to the changelog.

@tillh-stripe tillh-stripe merged commit d7f5e6a into master Mar 20, 2023
@tillh-stripe tillh-stripe deleted the tillh/6385-paymentoptioncallback-with-removed-pm branch March 20, 2023 16:15
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.

onPaymentOption returns the last payment option even though it's deleted.
2 participants