aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/tip.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/tip.ts
parent32cd54e11d80bde0274b3c0238f8f5bd00ff83cb (diff)
downloadwallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.tar.xz
wallet: t_s/d_us migration
Diffstat (limited to 'packages/taler-wallet-core/src/operations/tip.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/tip.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts
index a2a4e6f49..765120294 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -22,7 +22,6 @@ import {
parseTipUri,
codecForTipPickupGetResponse,
Amounts,
- getTimestampNow,
TalerErrorDetails,
NotificationType,
TipPlanchetDetail,
@@ -32,6 +31,7 @@ import {
DenomKeyType,
BlindedDenominationSignature,
codecForMerchantTipResponseV2,
+ TalerProtocolTimestamp,
} from "@gnu-taler/taler-util";
import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js";
import {
@@ -39,6 +39,7 @@ import {
CoinRecord,
CoinSourceType,
CoinStatus,
+ TipRecord,
} from "../db.js";
import { j2s } from "@gnu-taler/taler-util";
import { checkDbInvariant, checkLogicInvariant } from "../util/invariants.js";
@@ -115,14 +116,14 @@ export async function prepareTip(
const secretSeed = encodeCrock(getRandomBytes(64));
const denomSelUid = encodeCrock(getRandomBytes(32));
- const newTipRecord = {
+ const newTipRecord: TipRecord = {
walletTipId: walletTipId,
acceptedTimestamp: undefined,
tipAmountRaw: amount,
tipExpiration: tipPickupStatus.expiration,
exchangeBaseUrl: tipPickupStatus.exchange_url,
merchantBaseUrl: res.merchantBaseUrl,
- createdTimestamp: getTimestampNow(),
+ createdTimestamp: TalerProtocolTimestamp.now(),
merchantTipId: res.merchantTipId,
tipAmountEffective: Amounts.sub(
amount,
@@ -397,7 +398,7 @@ async function processTipImpl(
if (tr.pickedUpTimestamp) {
return;
}
- tr.pickedUpTimestamp = getTimestampNow();
+ tr.pickedUpTimestamp = TalerProtocolTimestamp.now();
tr.lastError = undefined;
tr.retryInfo = initRetryInfo();
await tx.tips.put(tr);
@@ -421,7 +422,7 @@ export async function acceptTip(
logger.error("tip not found");
return false;
}
- tipRecord.acceptedTimestamp = getTimestampNow();
+ tipRecord.acceptedTimestamp = TalerProtocolTimestamp.now();
await tx.tips.put(tipRecord);
return true;
});