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 payment cancellation on back press during processing #5848

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## XX.XX.XX - 2022-XX-XX

### PaymentSheet
* [CHANGED][5848](https://github.com/stripe/stripe-android/pull/5848) We now disable the back button while processing intents in `PaymentSheet` to prevent them from incorrectly being displayed as canceled.

### CardScan
* [SECURITY][5798](https://github.com/stripe/stripe-android/pull/5798) URL-encode IDs used in URLs to prevent injection attacks.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,15 @@ internal abstract class BaseSheetActivity<ResultType> : AppCompatActivity() {
overridePendingTransition(AnimationConstants.FADE_IN, AnimationConstants.FADE_OUT)
}

@Deprecated("Deprecated in Java")
override fun onBackPressed() {
if (supportFragmentManager.backStackEntryCount > 0) {
clearErrorMessages()
super.onBackPressed()
} else {
viewModel.onUserCancel()
if (viewModel.processing.value == false) {
if (supportFragmentManager.backStackEntryCount > 0) {
clearErrorMessages()
super.onBackPressed()
} else {
viewModel.onUserCancel()
}
}
}

Expand Down