Skip to content

Commit e3a1911

Browse files
committed
check for order id in receipts
1 parent e98a78c commit e3a1911

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

CHANGELOG.md

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

4+
## [0.14.3]
5+
6+
### Changes
7+
- Now exposing orderId in Checkout
8+
- ReceiptListView is now checking for orderId while fetching
9+
410
## [0.14.2]
511

612
### Fixed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ allprojects {
2323
}
2424

2525
project.ext {
26-
sdkVersion='0.14.2'
26+
sdkVersion='0.14.3'
2727
versionCode=1
2828

2929
compileSdkVersion=28

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ public void approveOfflineMethod() {
471471
}
472472
}
473473

474+
public String getOrderId() {
475+
return checkoutProcess != null ? checkoutProcess.orderId : null;
476+
}
477+
474478
public void setClientAcceptedPaymentMethods(PaymentMethod[] acceptedPaymentMethods) {
475479
clientAcceptedPaymentMethods = acceptedPaymentMethods;
476480
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ public static class CheckoutProcessResponse {
128128
public Map<String, Href> links;
129129
public Boolean supervisorApproval;
130130
public Boolean paymentApproval;
131+
@SerializedName("orderID")
132+
public String orderId;
131133
public boolean aborted;
132134
public JsonObject checkoutInfo;
133135
public PaymentMethod paymentMethod;

ui/src/main/java/io/snabble/sdk/ui/receipts/ReceiptListView.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,17 @@ public void success(ReceiptInfo[] newReceiptInfos) {
105105
receiptInfos = newReceiptInfos;
106106

107107
if (checkout != null && checkout.getState() == Checkout.State.PAYMENT_APPROVED) {
108-
showProgressBar = true;
108+
boolean containsOrder = false;
109+
for (ReceiptInfo receiptInfo : newReceiptInfos) {
110+
if (receiptInfo.getId().equals(checkout.getOrderId())) {
111+
containsOrder = true;
112+
break;
113+
}
114+
}
115+
116+
if (!containsOrder) {
117+
showProgressBar = true;
118+
}
109119
}
110120

111121
recyclerView.getAdapter().notifyDataSetChanged();

0 commit comments

Comments
 (0)