From b567ba4668a5ac034e7227f53b5290195303980c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 13 Apr 2023 15:58:38 +0200 Subject: wallet-core: work around missing timestamp in legacy transaction --- packages/taler-wallet-core/src/operations/transactions.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'packages/taler-wallet-core/src/operations') diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 02c726449..3ace5bf71 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -525,7 +525,8 @@ function buildTransactionForPeerPullCredit( ? ExtendedStatus.Done : ExtendedStatus.Pending, pending: !wsr.timestampFinish, - timestamp: pullCredit.mergeTimestamp, + // Old transactions don't have it! + timestamp: pullCredit.mergeTimestamp ?? TalerProtocolTimestamp.now(), info: { expiration: wsr.wgInfo.contractTerms.purse_expiration, summary: wsr.wgInfo.contractTerms.summary, @@ -558,7 +559,8 @@ function buildTransactionForPeerPullCredit( exchangeBaseUrl: pullCredit.exchangeBaseUrl, extendedStatus: ExtendedStatus.Pending, pending: true, - timestamp: pullCredit.mergeTimestamp, + // Old transactions don't have it! + timestamp: pullCredit.mergeTimestamp ?? TalerProtocolTimestamp.now(), info: { expiration: peerContractTerms.purse_expiration, summary: peerContractTerms.summary, @@ -1387,6 +1389,9 @@ export async function getTransactions( if (!tx.amountRaw) { logger.warn(`missing amountRaw in ${j2s(tx)}`); } + if (!tx.timestamp) { + logger.warn(`missing timestamp in ${j2s(tx)}`); + } } const txPending = transactions.filter((x) => x.pending); -- cgit v1.2.3