diff options
author | Florian Dold <florian@dold.me> | 2021-01-18 23:35:41 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-01-18 23:35:41 +0100 |
commit | 5f3c02d31a223add55a32b20f4a289210cbb4f15 (patch) | |
tree | d91ded55692aea1294c0565328515f120559ab6a /packages/taler-wallet-core/src/operations/transactions.ts | |
parent | f884193b1adf0861f710c6ab1bb94ea2073ade65 (diff) | |
download | wallet-core-5f3c02d31a223add55a32b20f4a289210cbb4f15.tar.xz |
implement deposits
Diffstat (limited to 'packages/taler-wallet-core/src/operations/transactions.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 23 |
1 files changed, 23 insertions, 0 deletions
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( |