Skip to content

Commit 49f3745

Browse files
committed
only fallback to offline payment methods if offline capable payment method is selected
1 parent 39b35a9 commit 49f3745

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-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.51.6]
5+
6+
### Fixed
7+
- Only fallback to offline payment method if an offline capable payment method is selected
8+
49
## [0.51.5]
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.51.5'
34+
sdkVersion='0.51.6'
3535
versionCode=1
3636

3737
compileSdkVersion=31

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private PaymentMethod getFallbackPaymentMethod() {
255255
}
256256

257257
public void checkout() {
258-
checkout(-1);
258+
checkout(-1, false);
259259
}
260260

261261
/**
@@ -268,7 +268,7 @@ public void checkout() {
268268
* You then need to sometime after call @link Checkout#pay(PaymentMethod)}
269269
* to pay with that payment method.
270270
*/
271-
public void checkout(long timeout) {
271+
public void checkout(long timeout, boolean allowFallbackAfterTimeout) {
272272
checkoutProcess = null;
273273
rawCheckoutProcess = null;
274274
signedCheckoutInfo = null;
@@ -349,7 +349,7 @@ public void unknownError() {
349349
@Override
350350
public void connectionError() {
351351
PaymentMethod fallback = getFallbackPaymentMethod();
352-
if(fallback != null) {
352+
if(fallback != null && allowFallbackAfterTimeout) {
353353
paymentMethod = fallback;
354354
priceToPay = shoppingCart.getTotalPrice();
355355
checkoutRetryer.add(backendCart);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ open class CheckoutBar @JvmOverloads constructor(
217217
object : OneShotClickListener() {
218218
override fun click() {
219219
if (entry.paymentMethod.isOfflineMethod) {
220-
project.checkout.checkout(3000)
220+
project.checkout.checkout(3000, true)
221221
} else {
222222
project.checkout.checkout()
223223
}

0 commit comments

Comments
 (0)