PaymentContext left in bad state after cancel #1284
Merged
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
PaymentOptionsViewController doesn't send a cancellation message if it's in the middle of loading, which can get STPPaymentContext into a bad state. We'll fix this by overriding handleCancelTapped as we do in other controllers.
Motivation
Once broken, STPPaymentContext will refuse to pushPaymentOptionsViewController or pushShippingViewController. You can repro this in the Standard Integration example app by tapping "Pay from", "Cancel", then tapping "Pay from" again: It won't push any view controllers for the lifetime of the STPPaymentContext.
Testing
I repro'd and tapped the cells, it worked before and after load.