summaryrefslogtreecommitdiff
path: root/src/operations/history.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-19 20:42:49 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-19 20:42:49 +0100
commit0c9358c1b2bd80e25940022e86bd8daef8184ad7 (patch)
treea8c8ca0134bd886d8151633aff4c85e9513ad32c /src/operations/history.ts
parent49e3b3e5b9bbf1ce356ef68f301d50c689ceecb9 (diff)
downloadwallet-core-0c9358c1b2bd80e25940022e86bd8daef8184ad7.tar.gz
wallet-core-0c9358c1b2bd80e25940022e86bd8daef8184ad7.tar.bz2
wallet-core-0c9358c1b2bd80e25940022e86bd8daef8184ad7.zip
new date format, replace checkable annotations with codecs
Diffstat (limited to 'src/operations/history.ts')
-rw-r--r--src/operations/history.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/operations/history.ts b/src/operations/history.ts
index bb57a9c60..f02894b6b 100644
--- a/src/operations/history.ts
+++ b/src/operations/history.ts
@@ -37,6 +37,7 @@ import {
import { assertUnreachable } from "../util/assertUnreachable";
import { TransactionHandle, Store } from "../util/query";
import { ReserveTransactionType } from "../types/ReserveTransaction";
+import { timestampCmp } from "../util/time";
/**
* Create an event ID from the type and the primary key for the event.
@@ -53,11 +54,11 @@ function getOrderShortInfo(
return undefined;
}
return {
- amount: download.contractTerms.amount,
- orderId: download.contractTerms.order_id,
- merchantBaseUrl: download.contractTerms.merchant_base_url,
+ amount: Amounts.toString(download.contractData.amount),
+ orderId: download.contractData.orderId,
+ merchantBaseUrl: download.contractData.merchantBaseUrl,
proposalId: proposal.proposalId,
- summary: download.contractTerms.summary || "",
+ summary: download.contractData.summary,
};
}
@@ -356,9 +357,7 @@ export async function getHistory(
if (!orderShortInfo) {
return;
}
- const purchaseAmount = Amounts.parseOrThrow(
- purchase.contractTerms.amount,
- );
+ const purchaseAmount = purchase.contractData.amount;
let amountRefundedRaw = Amounts.getZero(purchaseAmount.currency);
let amountRefundedInvalid = Amounts.getZero(purchaseAmount.currency);
let amountRefundedEffective = Amounts.getZero(purchaseAmount.currency);
@@ -408,7 +407,7 @@ export async function getHistory(
},
);
- history.sort((h1, h2) => Math.sign(h1.timestamp.t_ms - h2.timestamp.t_ms));
+ history.sort((h1, h2) => timestampCmp(h1.timestamp, h2.timestamp));
return { history };
}