Skip to content

Commit 6aa112b

Browse files
committed
fix abort from cart when already processing
1 parent a81aa1f commit 6aa112b

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.49.3]
5+
6+
### Fixed
7+
- Transaction can now not be aborted anymore when already processing and user is still in cart
8+
49
## [0.49.2]
510

611
### Fixed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ allprojects {
3131
}
3232

3333
project.ext {
34-
sdkVersion='0.49.2'
34+
sdkVersion='0.49.3'
3535
versionCode=1
3636

3737
compileSdkVersion=31

core/src/main/java/io/snabble/sdk/Checkout.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,10 @@ public void success() {
169169
notifyStateChanged(Checkout.State.PAYMENT_ABORTED);
170170
}
171171

172+
stopPolling();
172173
invalidProducts = null;
173174
paymentMethod = null;
175+
174176
shoppingCart.generateNewUUID();
175177
shop = null;
176178
}
@@ -181,7 +183,9 @@ public void error() {
181183
if (error) {
182184
notifyStateChanged(Checkout.State.PAYMENT_PROCESSING_ERROR);
183185
} else {
184-
notifyStateChanged(Checkout.State.PAYMENT_ABORT_FAILED);
186+
if (state != State.PAYMENT_PROCESSING && state != State.PAYMENT_APPROVED) {
187+
notifyStateChanged(Checkout.State.PAYMENT_ABORT_FAILED);
188+
}
185189
}
186190
}
187191
});
@@ -209,7 +213,6 @@ public void abortSilently() {
209213

210214
public void cancelOutstandingCalls() {
211215
checkoutApi.cancel();
212-
stopPolling();
213216
}
214217

215218
/**
@@ -219,6 +222,7 @@ public void cancelOutstandingCalls() {
219222
*/
220223
public void reset() {
221224
cancelOutstandingCalls();
225+
stopPolling();
222226
notifyStateChanged(Checkout.State.NONE);
223227

224228
invalidProducts = null;

ui/src/main/java/io/snabble/sdk/ui/cart/CheckoutBar.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,10 @@ open class CheckoutBar @JvmOverloads constructor(
102102
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER)
103103
progressDialog.setMessage(context.getString(R.string.Snabble_pleaseWait))
104104
progressDialog.setCanceledOnTouchOutside(false)
105-
progressDialog.setCancelable(true)
105+
progressDialog.setCancelable(false)
106106
progressDialog.setOnKeyListener(DialogInterface.OnKeyListener { dialogInterface: DialogInterface, _, keyEvent: KeyEvent ->
107107
if (keyEvent.keyCode == KeyEvent.KEYCODE_BACK) {
108108
project.checkout.abort()
109-
dialogInterface.dismiss()
110109
return@OnKeyListener true
111110
}
112111
false

0 commit comments

Comments
 (0)