mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-05 08:03:47 -04:00
Support for new Voucher Vault export
This commit is contained in:
@@ -9,6 +9,7 @@ Changes:
|
||||
- Support importing password-protected zip files
|
||||
- Support importing from Stocard (Beta)
|
||||
- Fix useless whitespace in notes from Fidme import
|
||||
- Support new Voucher Vault export format
|
||||
|
||||
## v1.14.1 (2021-06-14)
|
||||
|
||||
|
||||
@@ -61,11 +61,13 @@ public class VoucherVaultImporter implements Importer
|
||||
expiry = dateFormat.parse(jsonCard.getString("expires"));
|
||||
}
|
||||
|
||||
BigDecimal balance;
|
||||
if (!jsonCard.isNull("balance")) {
|
||||
BigDecimal balance = new BigDecimal("0");
|
||||
if (jsonCard.has("balanceMilliunits")) {
|
||||
if (!jsonCard.isNull("balanceMilliunits")) {
|
||||
balance = new BigDecimal(String.valueOf(jsonCard.getInt("balanceMilliunits") / 1000.0));
|
||||
}
|
||||
} else if (!jsonCard.isNull("balance")) {
|
||||
balance = new BigDecimal(String.valueOf(jsonCard.getDouble("balance")));
|
||||
} else {
|
||||
balance = new BigDecimal("0");
|
||||
}
|
||||
|
||||
Currency balanceType = Currency.getInstance("USD");
|
||||
|
||||
@@ -1194,6 +1194,7 @@ public class ImportExportTest
|
||||
" \"expires\": null,\n" +
|
||||
" \"removeOnceExpired\": true,\n" +
|
||||
" \"balance\": null,\n" +
|
||||
" \"balanceMilliunits\": null,\n" +
|
||||
" \"color\": \"GREY\"\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
@@ -1203,7 +1204,8 @@ public class ImportExportTest
|
||||
" \"codeType\": \"CODE39\",\n" +
|
||||
" \"expires\": \"2021-03-26T00:00:00.000\",\n" +
|
||||
" \"removeOnceExpired\": true,\n" +
|
||||
" \"balance\": 3.5,\n" +
|
||||
" \"balance\": null,\n" +
|
||||
" \"balanceMilliunits\": 3500,\n" +
|
||||
" \"color\": \"PURPLE\"\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
|
||||
Reference in New Issue
Block a user