gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: -check in integration test


From: gnunet
Subject: [taler-wallet-core] branch master updated: -check in integration test
Date: Wed, 11 Jan 2023 17:16:19 +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 3641e4cf0 -check in integration test
3641e4cf0 is described below

commit 3641e4cf0cfdd1569e4a85582676699f92aabfe3
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jan 11 17:16:15 2023 +0100

    -check in integration test
---
 .../src/operations/pay-merchant.ts                 | 45 +++++++++++++---------
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts 
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index 2f1f3375c..586f2638f 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -2811,34 +2811,43 @@ export async function abortPay(
       if (!purchase) {
         throw Error("purchase not found");
       }
+      const oldStatus = purchase.purchaseStatus;
       if (purchase.timestampFirstSuccessfulPay) {
         // No point in aborting it.  We don't even report an error.
         logger.warn(`tried to abort successful payment`);
         return;
       }
-      if (purchase.purchaseStatus === PurchaseStatus.Paying) {
+      if (oldStatus === PurchaseStatus.Paying) {
         purchase.purchaseStatus = PurchaseStatus.AbortingWithRefund;
       }
+      if (
+        cancelImmediately &&
+        oldStatus === PurchaseStatus.AbortingWithRefund
+      ) {
+        purchase.purchaseStatus = PurchaseStatus.PaymentAbortFinished;
+      }
       await tx.purchases.put(purchase);
-      await tx.operationRetries.delete(opId);
-      if (purchase.payInfo) {
-        const coinSel = purchase.payInfo.payCoinSelection;
-        const currency = Amounts.currencyOf(purchase.payInfo.totalPayCost);
-        const refreshCoins: CoinRefreshRequest[] = [];
-        for (let i = 0; i < coinSel.coinPubs.length; i++) {
-          refreshCoins.push({
-            amount: coinSel.coinContributions[i],
-            coinPub: coinSel.coinPubs[i],
-          });
+      if (oldStatus === PurchaseStatus.Paying) {
+        if (purchase.payInfo) {
+          const coinSel = purchase.payInfo.payCoinSelection;
+          const currency = Amounts.currencyOf(purchase.payInfo.totalPayCost);
+          const refreshCoins: CoinRefreshRequest[] = [];
+          for (let i = 0; i < coinSel.coinPubs.length; i++) {
+            refreshCoins.push({
+              amount: coinSel.coinContributions[i],
+              coinPub: coinSel.coinPubs[i],
+            });
+          }
+          await createRefreshGroup(
+            ws,
+            tx,
+            currency,
+            refreshCoins,
+            RefreshReason.AbortPay,
+          );
         }
-        await createRefreshGroup(
-          ws,
-          tx,
-          currency,
-          refreshCoins,
-          RefreshReason.AbortPay,
-        );
       }
+      await tx.operationRetries.delete(opId);
     });
 
   runOperationWithErrorReporting(ws, opId, async () => {

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