aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/pay-merchant.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-09-13 16:08:51 +0200
committerFlorian Dold <florian@dold.me>2023-09-14 19:18:01 +0200
commitf4587c44fd6a6d76384cd671550890255c3fe650 (patch)
treef3eab7032e7ec4a6e49ffdf85ea57e3874b84130 /packages/taler-wallet-core/src/operations/pay-merchant.ts
parent59ef010b0e1f1eaf938a20a46f52d7c94af7b10d (diff)
wallet-core: use typed microsecond timestamps in DB
Diffstat (limited to 'packages/taler-wallet-core/src/operations/pay-merchant.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/pay-merchant.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index fe0cbeda0..97bf6e2a6 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -103,6 +103,7 @@ import {
RefundGroupStatus,
RefundItemRecord,
RefundItemStatus,
+ timestampPreciseToDb,
} from "../index.js";
import {
EXCHANGE_COINS_LOCK,
@@ -644,7 +645,7 @@ async function createPurchase(
noncePriv: priv,
noncePub: pub,
claimToken,
- timestamp: TalerPreciseTimestamp.now(),
+ timestamp: timestampPreciseToDb(TalerPreciseTimestamp.now()),
merchantBaseUrl,
orderId,
proposalId: proposalId,
@@ -717,7 +718,7 @@ async function storeFirstPaySuccess(
if (purchase.purchaseStatus === PurchaseStatus.PendingPaying) {
purchase.purchaseStatus = PurchaseStatus.Done;
}
- purchase.timestampFirstSuccessfulPay = now;
+ purchase.timestampFirstSuccessfulPay = timestampPreciseToDb(now);
purchase.lastSessionId = sessionId;
purchase.merchantPaySig = payResponse.sig;
purchase.posConfirmation = payResponse.pos_confirmation;
@@ -941,7 +942,9 @@ async function unblockBackup(
.forEachAsync(async (bp) => {
bp.state = {
tag: BackupProviderStateTag.Ready,
- nextBackupTimestamp: TalerPreciseTimestamp.now(),
+ nextBackupTimestamp: timestampPreciseToDb(
+ TalerPreciseTimestamp.now(),
+ ),
};
tx.backupProviders.put(bp);
});
@@ -1447,7 +1450,7 @@ export async function confirmPay(
totalPayCost: Amounts.stringify(payCostInfo),
};
p.lastSessionId = sessionId;
- p.timestampAccept = TalerPreciseTimestamp.now();
+ p.timestampAccept = timestampPreciseToDb(TalerPreciseTimestamp.now());
p.purchaseStatus = PurchaseStatus.PendingPaying;
await tx.purchases.put(p);
await spendCoins(ws, tx, {
@@ -2791,7 +2794,7 @@ async function storeRefunds(
proposalId: purchase.proposalId,
refundGroupId: newRefundGroupId,
status: RefundGroupStatus.Pending,
- timestampCreated: now,
+ timestampCreated: timestampPreciseToDb(now),
amountEffective: Amounts.stringify(
Amounts.zeroOfCurrency(currency),
),
@@ -2802,7 +2805,7 @@ async function storeRefunds(
const newItem: RefundItemRecord = {
coinPub: rf.coin_pub,
executionTime: rf.execution_time,
- obtainedTime: now,
+ obtainedTime: timestampPreciseToDb(now),
refundAmount: rf.refund_amount,
refundGroupId: newGroup.refundGroupId,
rtxid: rf.rtransaction_id,