aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/transactions.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-03-18 15:32:41 +0100
committerFlorian Dold <florian@dold.me>2022-03-21 19:20:48 +0100
commitf8d12f7b0d4af1b1769b89e80c87f9c169678564 (patch)
tree2478696c7bc1efc6d090b93aa340de542a7dccd9 /packages/taler-wallet-core/src/operations/transactions.ts
parent32cd54e11d80bde0274b3c0238f8f5bd00ff83cb (diff)
downloadwallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.tar.xz
wallet: t_s/d_us migration
Diffstat (limited to 'packages/taler-wallet-core/src/operations/transactions.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts29
1 files changed, 19 insertions, 10 deletions
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 23ab39052..bc466f5a0 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -18,12 +18,12 @@
* Imports.
*/
import {
+ AbsoluteTime,
AmountJson,
Amounts,
Logger,
OrderShortInfo,
PaymentStatus,
- timestampCmp,
Transaction,
TransactionsRequest,
TransactionsResponse,
@@ -309,7 +309,7 @@ export async function getTransactions(
for (const rk of Object.keys(pr.refunds)) {
const refund = pr.refunds[rk];
- const groupKey = `${refund.executionTime.t_ms}`;
+ const groupKey = `${refund.executionTime.t_s}`;
refundGroupKeys.add(groupKey);
}
@@ -333,7 +333,7 @@ export async function getTransactions(
let amountEffective = Amounts.getZero(contractData.amount.currency);
for (const rk of Object.keys(pr.refunds)) {
const refund = pr.refunds[rk];
- const myGroupKey = `${refund.executionTime.t_ms}`;
+ const myGroupKey = `${refund.executionTime.t_s}`;
if (myGroupKey !== groupKey) {
continue;
}
@@ -403,8 +403,18 @@ export async function getTransactions(
const txPending = transactions.filter((x) => x.pending);
const txNotPending = transactions.filter((x) => !x.pending);
- txPending.sort((h1, h2) => timestampCmp(h1.timestamp, h2.timestamp));
- txNotPending.sort((h1, h2) => timestampCmp(h1.timestamp, h2.timestamp));
+ txPending.sort((h1, h2) =>
+ AbsoluteTime.cmp(
+ AbsoluteTime.fromTimestamp(h1.timestamp),
+ AbsoluteTime.fromTimestamp(h2.timestamp),
+ ),
+ );
+ txNotPending.sort((h1, h2) =>
+ AbsoluteTime.cmp(
+ AbsoluteTime.fromTimestamp(h1.timestamp),
+ AbsoluteTime.fromTimestamp(h2.timestamp),
+ ),
+ );
return { transactions: [...txNotPending, ...txPending] };
}
@@ -485,11 +495,10 @@ export async function deleteTransaction(
});
return;
}
- const reserveRecord:
- | ReserveRecord
- | undefined = await tx.reserves.indexes.byInitialWithdrawalGroupId.get(
- withdrawalGroupId,
- );
+ const reserveRecord: ReserveRecord | undefined =
+ await tx.reserves.indexes.byInitialWithdrawalGroupId.get(
+ withdrawalGroupId,
+ );
if (reserveRecord && !reserveRecord.initialWithdrawalStarted) {
const reservePub = reserveRecord.reservePub;
await tx.reserves.delete(reservePub);