gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: consider deposit operations f


From: gnunet
Subject: [taler-wallet-core] branch master updated: consider deposit operations for pending operations
Date: Sat, 07 Aug 2021 17:59:15 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new c077c0d8 consider deposit operations for pending operations
c077c0d8 is described below

commit c077c0d8c08fb83fb6f4ba860a9d600cc22131c3
Author: Florian Dold <florian@dold.me>
AuthorDate: Sat Aug 7 17:59:06 2021 +0200

    consider deposit operations for pending operations
---
 .../src/integrationtests/test-deposit.ts           |  2 ++
 .../taler-wallet-core/src/operations/pending.ts    | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/packages/taler-wallet-cli/src/integrationtests/test-deposit.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-deposit.ts
index 585ca999..156661e4 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-deposit.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-deposit.ts
@@ -56,7 +56,9 @@ export async function runDepositTest(t: GlobalTestState) {
   );
   console.log("transactions", JSON.stringify(transactions, undefined, 2));
   t.assertDeepEqual(transactions.transactions[0].type, "withdrawal");
+  t.assertTrue(!transactions.transactions[0].pending);
   t.assertDeepEqual(transactions.transactions[1].type, "deposit");
+  t.assertTrue(!transactions.transactions[1].pending);
   // The raw amount is what ends up on the bank account, which includes
   // deposit and wire fees.
   t.assertDeepEqual(transactions.transactions[1].amountRaw, "TESTKUDOS:9.79");
diff --git a/packages/taler-wallet-core/src/operations/pending.ts 
b/packages/taler-wallet-core/src/operations/pending.ts
index 3a6af186..200e6ccb 100644
--- a/packages/taler-wallet-core/src/operations/pending.ts
+++ b/packages/taler-wallet-core/src/operations/pending.ts
@@ -180,6 +180,27 @@ async function gatherProposalPending(
   });
 }
 
+async function gatherDepositPending(
+  tx: GetReadOnlyAccess<{ depositGroups: typeof WalletStoresV1.depositGroups 
}>,
+  now: Timestamp,
+  resp: PendingOperationsResponse,
+): Promise<void> {
+  await tx.depositGroups.iter().forEach((dg) => {
+    if (dg.timestampFinished) {
+      return;
+    }
+    const timestampDue = dg.retryInfo?.nextRetry ?? getTimestampNow();
+    resp.pendingOperations.push({
+      type: PendingTaskType.Deposit,
+      givesLifeness: true,
+      timestampDue,
+      depositGroupId: dg.depositGroupId,
+      lastError: dg.lastError,
+      retryInfo: dg.retryInfo,
+    });
+  });
+}
+
 async function gatherTipPending(
   tx: GetReadOnlyAccess<{ tips: typeof WalletStoresV1.tips }>,
   now: Timestamp,
@@ -313,6 +334,7 @@ export async function getPendingOperations(
       await gatherRefreshPending(tx, now, resp);
       await gatherWithdrawalPending(tx, now, resp);
       await gatherProposalPending(tx, now, resp);
+      await gatherDepositPending(tx, now, resp);
       await gatherTipPending(tx, now, resp);
       await gatherPurchasePending(tx, now, resp);
       await gatherRecoupPending(tx, now, resp);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]