gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: fix refund test


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix refund test
Date: Tue, 13 Feb 2024 12:26:29 +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 336361b99 fix refund test
336361b99 is described below

commit 336361b99fa2528071f9e3b0431cd03176d8f2dc
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Feb 13 12:26:28 2024 +0100

    fix refund test
---
 .../taler-harness/src/integrationtests/test-refund.ts    | 16 ++++++++++++----
 .../taler-wallet-core/src/operations/pay-merchant.ts     |  1 +
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-refund.ts 
b/packages/taler-harness/src/integrationtests/test-refund.ts
index 0d95ea035..aa245803d 100644
--- a/packages/taler-harness/src/integrationtests/test-refund.ts
+++ b/packages/taler-harness/src/integrationtests/test-refund.ts
@@ -20,6 +20,7 @@
 import {
   Duration,
   durationFromSpec,
+  j2s,
   MerchantApiClient,
   NotificationType,
   TransactionMajorState,
@@ -94,13 +95,14 @@ export async function runRefundTest(t: GlobalTestState) {
 
   t.assertTrue(orderStatus.order_status === "paid");
 
-
   {
     const tx = await wallet.client.call(WalletApiOperation.GetTransactionById, 
{
       transactionId: r1.transactionId,
     });
 
-    t.assertTrue(tx.type === TransactionType.Payment && tx.refundPending === 
undefined)
+    t.assertTrue(
+      tx.type === TransactionType.Payment && tx.refundPending === undefined,
+    );
   }
 
   const ref = await merchantClient.giveRefund({
@@ -117,9 +119,10 @@ export async function runRefundTest(t: GlobalTestState) {
     const refundFinishedCond = wallet.waitForNotificationCond(
       (x) =>
         x.type === NotificationType.TransactionStateTransition &&
+        x.transactionId === r1.transactionId &&
         x.newTxState.major === TransactionMajorState.Done,
     );
-    const r = await wallet.client.call(WalletApiOperation.StartRefundQuery, {
+    await wallet.client.call(WalletApiOperation.StartRefundQuery, {
       transactionId: r1.transactionId,
     });
 
@@ -130,6 +133,7 @@ export async function runRefundTest(t: GlobalTestState) {
     const r2 = await wallet.client.call(WalletApiOperation.GetBalances, {});
     console.log(JSON.stringify(r2, undefined, 2));
   }
+
   {
     const r2 = await wallet.client.call(WalletApiOperation.GetTransactions, 
{});
     console.log(JSON.stringify(r2, undefined, 2));
@@ -140,7 +144,11 @@ export async function runRefundTest(t: GlobalTestState) {
       transactionId: r1.transactionId,
     });
 
-    t.assertTrue(tx.type === TransactionType.Payment && tx.refundPending === 
undefined)
+    console.log(j2s(tx));
+
+    t.assertTrue(
+      tx.type === TransactionType.Payment && tx.refundPending === undefined,
+    );
   }
 
   // FIXME: Test is incomplete without this!
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts 
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index 3acfbd457..52f9c70b1 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -3106,6 +3106,7 @@ async function storeRefunds(
         } else {
           myPurchase.purchaseStatus = PurchaseStatus.Done;
         }
+        myPurchase.refundAmountAwaiting = undefined;
       }
       await tx.purchases.put(myPurchase);
       const newTxState = computePayMerchantTransactionState(myPurchase);

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