Skip to content

Commit

Permalink
Add order/receipt isSuccessful state (APPS-1893) (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaier authored Nov 18, 2024
1 parent a642dd4 commit 24dc316
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file.
### Removed
### Fixed

## [0.78.0]
### Added
* core: Add the `isSuccessful` state to orders/receipts

## [0.77.1]
### Changed
* core: Change the PaymentCredentialsFlow's StateFlow to be a SharedFlow w/o replaying and state management
Expand Down
10 changes: 8 additions & 2 deletions core/src/main/java/io/snabble/sdk/ReceiptInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,11 @@ data class ReceiptInfo(
* Final price of the order
*/
@JvmField
val price: String
)
val price: String,

/**
* State of the order
*/
@JvmField
val isSuccessful: Boolean
)
6 changes: 4 additions & 2 deletions core/src/main/java/io/snabble/sdk/ReceiptsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static class ApiOrder {
public String shopName;
public int price;
public Map<String, ApiLink> links;
public boolean isSuccessful;
}

/** Data class for api links **/
Expand Down Expand Up @@ -149,7 +150,8 @@ public void success(ApiReceipt apiReceipt) {
simpleDateFormat.parse(apiOrder.date).getTime(),
url != null ? snabble.absoluteUrl(url) : null,
apiOrder.shopName,
priceFormatter.format(apiOrder.price));
priceFormatter.format(apiOrder.price),
apiOrder.isSuccessful);

result.add(receiptInfo);
} catch (ParseException e) {
Expand All @@ -176,4 +178,4 @@ public void error(Throwable t) {
receiptUpdateCallback.failure();
}
}
}
}
4 changes: 2 additions & 2 deletions core/src/test/resources/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@
],
"gatewayCertificates": [
{
"value": "MIIE7DCCAtQCFGdGHrKz0qHO/gnMT9YdAFHBfiKfMA0GCSqGSIb3DQEBCwUAMFQxC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ydFB/V0AJJ9golHa+7SwIM66ckB1F0fGyJntfMcCVFr9JsZkDs1U71ExPaqepeS8A/vAdhn/IWzm7oVAJi5U106po8xnBaiyOewzdDfF97yAmlGRW9aBdgFvyT++T4B+PDAvRuN87k61KdKW9fQhijvtCcmAdeobSAAwd5o2wy2DvauAGo9nAxwJ+2IA7nLKWoNloaLcnKisxo=",
"validUntil": "2026-10-23T00:00:00Z"
}
]
}

0 comments on commit 24dc316

Please sign in to comment.