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: implement abort


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: implement abort for more payment states
Date: Wed, 27 Mar 2024 20:08:31 +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 d13d465c4 wallet-core: implement abort for more payment states
d13d465c4 is described below

commit d13d465c4bdcd2462c916676ac9247fd241dbd9c
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Mar 27 20:08:23 2024 +0100

    wallet-core: implement abort for more payment states
---
 packages/taler-wallet-core/src/pay-merchant.ts | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/packages/taler-wallet-core/src/pay-merchant.ts 
b/packages/taler-wallet-core/src/pay-merchant.ts
index 40abd44a0..62309a300 100644
--- a/packages/taler-wallet-core/src/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -284,11 +284,6 @@ export class PayMerchantTransactionContext implements 
TransactionContext {
         }
         const oldTxState = computePayMerchantTransactionState(purchase);
         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;
-        }
         switch (oldStatus) {
           case PurchaseStatus.Done:
             return;
@@ -318,9 +313,22 @@ export class PayMerchantTransactionContext implements 
TransactionContext {
             }
             break;
           }
+          case PurchaseStatus.PendingQueryingAutoRefund:
+          case PurchaseStatus.SuspendedQueryingAutoRefund:
+          case PurchaseStatus.PendingAcceptRefund:
+          case PurchaseStatus.SuspendedPendingAcceptRefund:
+          case PurchaseStatus.PendingQueryingRefund:
+          case PurchaseStatus.SuspendedQueryingRefund:
+            if (!purchase.timestampFirstSuccessfulPay) {
+              throw Error("invalid state");
+            }
+            purchase.purchaseStatus = PurchaseStatus.Done;
+            break;
           case PurchaseStatus.DialogProposed:
             purchase.purchaseStatus = PurchaseStatus.AbortedProposalRefused;
             break;
+          default:
+            return;
         }
         await tx.purchases.put(purchase);
         await tx.operationRetries.delete(this.taskId);

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