gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: wallet-core: notify on exchan


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: notify on exchange tos acceptance
Date: Mon, 08 Jan 2024 22:00:44 +0100

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 249039392 wallet-core: notify on exchange tos acceptance
249039392 is described below

commit 2490393924aa44e6e3c2c072110a6175aaf41a82
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jan 8 22:00:32 2024 +0100

    wallet-core: notify on exchange tos acceptance
---
 packages/taler-wallet-core/src/operations/exchanges.ts | 14 +++++++++++++-
 packages/taler-wallet-core/src/operations/withdraw.ts  |  8 +-------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts 
b/packages/taler-wallet-core/src/operations/exchanges.ts
index 766af27a8..ca3ea8af6 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -272,18 +272,30 @@ export async function acceptExchangeTermsOfService(
   exchangeBaseUrl: string,
   etag: string | undefined,
 ): Promise<void> {
-  await ws.db
+  const notif = await ws.db
     .mktx((x) => [x.exchanges, x.exchangeDetails])
     .runReadWrite(async (tx) => {
       const exch = await tx.exchanges.get(exchangeBaseUrl);
       if (exch && exch.tosCurrentEtag) {
+        const oldExchangeState = getExchangeState(exch);
         exch.tosAcceptedEtag = exch.tosCurrentEtag;
         exch.tosAcceptedTimestamp = timestampPreciseToDb(
           TalerPreciseTimestamp.now(),
         );
         await tx.exchanges.put(exch);
+        const newExchangeState = getExchangeState(exch);
+        return {
+          type: NotificationType.ExchangeStateTransition,
+          exchangeBaseUrl,
+          newExchangeState: newExchangeState,
+          oldExchangeState: oldExchangeState,
+        } satisfies WalletNotification;
       }
+      return undefined;
     });
+  if (notif) {
+    ws.notify(notif);
+  }
 }
 
 async function validateWireInfo(
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts 
b/packages/taler-wallet-core/src/operations/withdraw.ts
index 56f1d91bb..8221abea6 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -34,7 +34,6 @@ import {
   DenomSelectionState,
   Duration,
   ExchangeBatchWithdrawRequest,
-  ExchangeListItem,
   ExchangeUpdateStatus,
   ExchangeWireAccount,
   ExchangeWithdrawBatchResponse,
@@ -100,11 +99,7 @@ import {
   WithdrawalGroupStatus,
   WithdrawalRecordType,
 } from "../db.js";
-import {
-  ExchangeEntryDbRecordStatus,
-  isWithdrawableDenom,
-  timestampPreciseToDb,
-} from "../index.js";
+import { isWithdrawableDenom, timestampPreciseToDb } from "../index.js";
 import { InternalWalletState } from "../internal-wallet-state.js";
 import {
   TaskIdentifiers,
@@ -113,7 +108,6 @@ import {
   constructTaskIdentifier,
   makeCoinAvailable,
   makeCoinsVisible,
-  makeExchangeListItem,
   runLongpollAsync,
 } from "../operations/common.js";
 import { PendingTaskType } from "../pending-types.js";

-- 
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]