From 5f3c02d31a223add55a32b20f4a289210cbb4f15 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 18 Jan 2021 23:35:41 +0100 Subject: implement deposits --- .../src/operations/transactions.ts | 23 ++++++++++++++++++++++ 1 file changed, 23 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 c7e6a9c53..d49031551 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -96,6 +96,7 @@ export async function getTransactions( Stores.withdrawalGroups, Stores.planchets, Stores.recoupGroups, + Stores.depositGroups, ], // Report withdrawals that are currently in progress. async (tx) => { @@ -203,6 +204,28 @@ export async function getTransactions( }); }); + tx.iter(Stores.depositGroups).forEachAsync(async (dg) => { + const amount = Amounts.parseOrThrow(dg.contractTermsRaw.amount); + if (shouldSkipCurrency(transactionsRequest, amount.currency)) { + return; + } + + transactions.push({ + type: TransactionType.Deposit, + amountRaw: Amounts.stringify(dg.effectiveDepositAmount), + amountEffective: Amounts.stringify(dg.totalPayCost), + pending: !dg.timestampFinished, + timestamp: dg.timestampCreated, + targetPaytoUri: dg.wire.payto_uri, + transactionId: makeEventId( + TransactionType.Deposit, + dg.depositGroupId, + ), + depositGroupId: dg.depositGroupId, + ...(dg.lastError ? { error: dg.lastError } : {}), + }); + }); + tx.iter(Stores.purchases).forEachAsync(async (pr) => { if ( shouldSkipCurrency( -- cgit v1.2.3