From 043a5f89fe020bbb55170a9fc355c3d699ad8761 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 8 Sep 2020 19:54:23 +0530 Subject: tipping transaction list entry, integration test and DB simplifications --- .../src/operations/transactions.ts | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'packages/taler-wallet-core/src/operations/transactions.ts') diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index b5f77a190..026a91ef3 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -38,6 +38,7 @@ import { OrderShortInfo, } from "../types/transactions"; import { getFundingPaytoUris } from "./reserves"; +import { TipResponse } from "../types/talerTypes"; /** * Create an event ID from the type and the primary key for the event. @@ -308,6 +309,29 @@ export async function getTransactions( }); }); }); + + tx.iter(Stores.tips).forEachAsync(async (tipRecord) => { + if ( + shouldSkipCurrency( + transactionsRequest, + tipRecord.tipAmountRaw.currency, + ) + ) { + return; + } + if (!tipRecord.acceptedTimestamp) { + return; + } + transactions.push({ + type: TransactionType.Tip, + amountEffective: Amounts.stringify(tipRecord.tipAmountEffective), + amountRaw: Amounts.stringify(tipRecord.tipAmountRaw), + pending: !tipRecord.pickedUpTimestamp, + timestamp: tipRecord.acceptedTimestamp, + transactionId: makeEventId(TransactionType.Tip, tipRecord.walletTipId), + error: tipRecord.lastError, + }); + }); }, ); -- cgit v1.2.3