Skip to content

Commit 96782f0

Browse files
committed
Fixed cancelling of EncodedCodes checkouts
1 parent 7cd97ce commit 96782f0

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -392,18 +392,14 @@ public void pay(PaymentMethod paymentMethod) {
392392
}
393393

394394
private void pay(final PaymentMethod paymentMethod, boolean force) {
395-
if (signedCheckoutInfo != null || paymentMethod.isOfflineMethod()) {
395+
if (signedCheckoutInfo != null) {
396396
boolean isRequestingPaymentMethod = (state == State.REQUEST_PAYMENT_METHOD);
397397
boolean wasRequestingPaymentMethod = (lastState == State.REQUEST_PAYMENT_METHOD
398398
|| lastState == State.VERIFYING_PAYMENT_METHOD);
399399

400400
if (force || isRequestingPaymentMethod || (state == State.CONNECTION_ERROR && wasRequestingPaymentMethod)) {
401401
this.paymentMethod = paymentMethod;
402402

403-
if(paymentMethod.isOfflineMethod()){
404-
notifyStateChanged(State.WAIT_FOR_APPROVAL);
405-
}
406-
407403
CheckoutProcessRequest checkoutProcessRequest = new CheckoutProcessRequest();
408404
checkoutProcessRequest.paymentMethod = paymentMethod;
409405
checkoutProcessRequest.signedCheckoutInfo = signedCheckoutInfo;
@@ -423,10 +419,6 @@ private void pay(final PaymentMethod paymentMethod, boolean force) {
423419
call.enqueue(new Callback() {
424420
@Override
425421
public void onResponse(Call call, Response response) throws IOException {
426-
if(paymentMethod.isOfflineMethod()){
427-
return;
428-
}
429-
430422
if (response.isSuccessful()) {
431423
ResponseBody body = response.body();
432424
if (body == null) {
@@ -459,20 +451,14 @@ public void onResponse(Call call, Response response) throws IOException {
459451

460452
@Override
461453
public void onFailure(Call call, IOException e) {
462-
if(paymentMethod.isOfflineMethod()){
463-
return;
464-
}
465-
466454
if (!call.isCanceled()) {
467455
Logger.e("Connection error while creating checkout process");
468456
notifyStateChanged(State.CONNECTION_ERROR);
469457
}
470458
}
471459
});
472460

473-
if(!paymentMethod.isOfflineMethod()) {
474-
notifyStateChanged(State.VERIFYING_PAYMENT_METHOD);
475-
}
461+
notifyStateChanged(State.VERIFYING_PAYMENT_METHOD);
476462
}
477463
}
478464
}
@@ -634,8 +620,7 @@ public PaymentMethod[] getAvailablePaymentMethods() {
634620
List<PaymentMethod> result = new ArrayList<>();
635621

636622
for (PaymentMethod clientPaymentMethod : clientAcceptedPaymentMethods) {
637-
if(paymentMethods.contains(clientPaymentMethod)
638-
|| clientPaymentMethod.isOfflineMethod()){
623+
if(paymentMethods.contains(clientPaymentMethod)){
639624
result.add(clientPaymentMethod);
640625
}
641626
}

0 commit comments

Comments
 (0)