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: remove refundAmountAwait


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix: remove refundAmountAwaiting when refund is accepted
Date: Sun, 10 Dec 2023 23:03:28 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new ed05a19bb fix: remove refundAmountAwaiting when refund is accepted
ed05a19bb is described below

commit ed05a19bb477f331f3b0933cd1daf7b3eed4bce2
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Sun Dec 10 19:03:20 2023 -0300

    fix: remove refundAmountAwaiting when refund is accepted
---
 packages/taler-harness/src/harness/harness.ts      | 26 +++++++++-------------
 .../src/integrationtests/test-refund.ts            | 20 +++++++++++++++--
 .../src/operations/pay-merchant.ts                 |  1 +
 .../src/platform/chrome.ts                         |  1 -
 4 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/packages/taler-harness/src/harness/harness.ts 
b/packages/taler-harness/src/harness/harness.ts
index 242bf2207..a6ed59032 100644
--- a/packages/taler-harness/src/harness/harness.ts
+++ b/packages/taler-harness/src/harness/harness.ts
@@ -371,7 +371,7 @@ export class GlobalTestState {
     });
     proc.on("exit", (code, signal) => {
       if (code == 0 && signal == null) {
-        logger.info(`process ${logName} exited with success`);
+        logger.trace(`process ${logName} exited with success`);
       } else {
         logger.warn(`process ${logName} exited ${j2s({ code, signal })}`);
       }
@@ -582,7 +582,7 @@ class BankServiceBase {
     protected globalTestState: GlobalTestState,
     protected bankConfig: BankConfig,
     protected configFile: string,
-  ) {}
+  ) { }
 }
 
 export interface HarnessExchangeBankAccount {
@@ -602,8 +602,7 @@ export interface HarnessExchangeBankAccount {
  */
 export class FakebankService
   extends BankServiceBase
-  implements BankServiceHandle
-{
+  implements BankServiceHandle {
   proc: ProcessWrapper | undefined;
 
   http = createPlatformHttpLib({ enableThrottling: false });
@@ -733,8 +732,7 @@ export class FakebankService
  */
 export class LibeufinBankService
   extends BankServiceBase
-  implements BankServiceHandle
-{
+  implements BankServiceHandle {
   proc: ProcessWrapper | undefined;
 
   http = createPlatformHttpLib({ enableThrottling: false });
@@ -1186,7 +1184,7 @@ export class ExchangeService implements 
ExchangeServiceInterface {
     private exchangeConfig: ExchangeConfig,
     private configFilename: string,
     private keyPair: EddsaKeyPair,
-  ) {}
+  ) { }
 
   get name() {
     return this.exchangeConfig.name;
@@ -1542,7 +1540,7 @@ export class MerchantService implements 
MerchantServiceInterface {
     private globalState: GlobalTestState,
     private merchantConfig: MerchantConfig,
     private configFilename: string,
-  ) {}
+  ) { }
 
   private currentTimetravelOffsetMs: number | undefined;
 
@@ -1880,7 +1878,7 @@ export class WalletService {
   constructor(
     private globalState: GlobalTestState,
     private opts: WalletServiceOptions,
-  ) {}
+  ) { }
 
   get socketPath() {
     const unixPath = path.join(
@@ -1989,7 +1987,7 @@ export class WalletClient {
     return client.call(operation, payload);
   }
 
-  constructor(private args: WalletClientArgs) {}
+  constructor(private args: WalletClientArgs) { }
 
   async connect(): Promise<void> {
     const waiter = this.waiter;
@@ -2056,11 +2054,9 @@ export class WalletCli {
           ? `--crypto-worker=${cliOpts.cryptoWorkerType}`
           : "";
         const logName = `wallet-${self.name}`;
-        const command = `taler-wallet-cli ${
-          self.timetravelArg ?? ""
-        } ${cryptoWorkerArg} --no-throttle -LTRACE --skip-defaults --wallet-db 
'${
-          self.dbfile
-        }' api '${op}' ${shellWrap(JSON.stringify(payload))}`;
+        const command = `taler-wallet-cli ${self.timetravelArg ?? ""
+          } ${cryptoWorkerArg} --no-throttle -LTRACE --skip-defaults 
--wallet-db '${self.dbfile
+          }' api '${op}' ${shellWrap(JSON.stringify(payload))}`;
         const resp = await sh(self.globalTestState, logName, command);
         logger.info("--- wallet core response ---");
         logger.info(resp);
diff --git a/packages/taler-harness/src/integrationtests/test-refund.ts 
b/packages/taler-harness/src/integrationtests/test-refund.ts
index aeeb91f38..0d95ea035 100644
--- a/packages/taler-harness/src/integrationtests/test-refund.ts
+++ b/packages/taler-harness/src/integrationtests/test-refund.ts
@@ -23,6 +23,7 @@ import {
   MerchantApiClient,
   NotificationType,
   TransactionMajorState,
+  TransactionType,
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { GlobalTestState } from "../harness/harness.js";
@@ -58,7 +59,6 @@ export async function runRefundTest(t: GlobalTestState) {
   await withdrawalRes.withdrawalFinishedCond;
 
   // Set up order.
-
   const orderResp = await merchantClient.createOrder({
     order: {
       summary: "Buy me!",
@@ -94,6 +94,15 @@ 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)
+  }
+
   const ref = await merchantClient.giveRefund({
     amount: "TESTKUDOS:5",
     instance: "default",
@@ -113,7 +122,6 @@ export async function runRefundTest(t: GlobalTestState) {
     const r = await wallet.client.call(WalletApiOperation.StartRefundQuery, {
       transactionId: r1.transactionId,
     });
-    console.log(r);
 
     await refundFinishedCond;
   }
@@ -127,6 +135,14 @@ export async function runRefundTest(t: GlobalTestState) {
     console.log(JSON.stringify(r2, undefined, 2));
   }
 
+  {
+    const tx = await wallet.client.call(WalletApiOperation.GetTransactionById, 
{
+      transactionId: r1.transactionId,
+    });
+
+    t.assertTrue(tx.type === TransactionType.Payment && tx.refundPending === 
undefined)
+  }
+
   // FIXME: Test is incomplete without this!
   // {
   //   const refundQueriedCond = wallet.waitForNotificationCond(
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts 
b/packages/taler-wallet-core/src/operations/pay-merchant.ts
index fcaabed56..88730bf3b 100644
--- a/packages/taler-wallet-core/src/operations/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts
@@ -2367,6 +2367,7 @@ async function processPurchaseAutoRefund(
           }
           const oldTxState = computePayMerchantTransactionState(p);
           p.purchaseStatus = PurchaseStatus.Done;
+          p.refundAmountAwaiting = undefined;
           const newTxState = computePayMerchantTransactionState(p);
           await tx.purchases.put(p);
           return { oldTxState, newTxState };
diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts 
b/packages/taler-wallet-webextension/src/platform/chrome.ts
index a4394be2c..04ecd80cc 100644
--- a/packages/taler-wallet-webextension/src/platform/chrome.ts
+++ b/packages/taler-wallet-webextension/src/platform/chrome.ts
@@ -178,7 +178,6 @@ function openWalletURIFromPopup(uri: TalerUri): void {
   // the target pathname should handle what happens if the endpoint is not 
there
   // like "trying to open from popup but this uri is not handled"
 
-  encodeURIComponent;
   let url: string | undefined = undefined;
   switch (uri.type) {
     case TalerUriAction.WithdrawExchange:

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