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

Clear error message when new payment method is selected #3978

Merged
merged 10 commits into from
Jul 16, 2021

Conversation

brnunes-stripe
Copy link
Contributor

@brnunes-stripe brnunes-stripe commented Jul 12, 2021

Summary

  • Clear error message when new payment method is selected.
  • Fix Google Pay checkout after it's been cancelled (MOBILESDK-299).
  • Revert to last selected payment method when Google Pay cancelled or failed.

Motivation

Previously the error message was shown even after the user selects a different payment method.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Copy link
Contributor

@michelleb-stripe michelleb-stripe left a comment

Choose a reason for hiding this comment

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

Does this also make sense if there is a network and other forms of error?

@brnunes-stripe
Copy link
Contributor Author

Does this also make sense if there is a network and other forms of error?

I think so, as long as it stays on screen until the user takes an action, which is the case with this change. What do you think?

ccen-stripe
ccen-stripe previously approved these changes Jul 13, 2021
@@ -177,12 +177,12 @@ internal class PaymentSheetActivity : BaseSheetActivity<PaymentSheetResult>() {

override fun onBackPressed() {
if (supportFragmentManager.backStackEntryCount > 0) {
updateErrorMessage(null)
updateErrorMessage()
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a stylistic thing here, I realize you can use default arguments, but without the null parameter passed in here, it is hard to realize that the side-effect of this function is that the error message will be cleared.

}

Copy link
Contributor

Choose a reason for hiding this comment

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

If order is important here, a comment would be helpful.

_viewState.value = PaymentSheetViewState.Reset(null)
if (this.checkoutIdentifier != checkoutIdentifier) {
// Clear out any previous errors before setting the new button to get updates.
_viewState.value = PaymentSheetViewState.Reset()
Copy link
Contributor

Choose a reason for hiding this comment

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

This comments says it clears previous errors, but it seems like ti doesn't because in the activities we are also clearing the error message?

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.

None yet

4 participants