gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: harness: wait for withdrawal,


From: gnunet
Subject: [taler-wallet-core] branch master updated: harness: wait for withdrawal, configure instance properly
Date: Wed, 06 Sep 2023 14:19:25 +0200

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 6affe04fe harness: wait for withdrawal, configure instance properly
6affe04fe is described below

commit 6affe04fe6919767181274891fd948688dedd700
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Sep 6 14:19:24 2023 +0200

    harness: wait for withdrawal, configure instance properly
---
 .../src/integrationtests/test-bank-api.ts          |  2 +-
 .../src/integrationtests/test-denom-unoffered.ts   |  3 ++-
 .../src/integrationtests/test-payment-multiple.ts  |  4 ++-
 .../src/integrationtests/test-refund-gone.ts       |  4 ++-
 .../src/integrationtests/test-wallet-balance.ts    | 17 ++++++++++--
 .../taler-wallet-core/src/util/coinSelection.ts    | 30 +++++++++++-----------
 6 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts 
b/packages/taler-harness/src/integrationtests/test-bank-api.ts
index 1c359732e..a13ff63c7 100644
--- a/packages/taler-harness/src/integrationtests/test-bank-api.ts
+++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts
@@ -106,7 +106,7 @@ export async function runBankApiTest(t: GlobalTestState) {
   // Make sure that registering twice results in a 409 Conflict
   {
     const e = await t.assertThrowsTalerErrorAsync(async () => {
-      await bankClient.registerAccount("user1", "pw1");
+      await bankClient.registerAccount("user1", "pw2");
     });
     t.assertTrue(e.errorDetail.httpStatusCode === 409);
   }
diff --git 
a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts 
b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
index afd0c901b..b4268ee42 100644
--- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
+++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts
@@ -50,13 +50,14 @@ export async function runDenomUnofferedTest(t: 
GlobalTestState) {
   // Effectively we completely reset the exchange,
   // but keep the exchange master public key.
 
+  await merchant.stop();
+
   await exchange.stop();
   await exchange.purgeDatabase();
   await exchange.purgeSecmodKeys();
   await exchange.start();
   await exchange.pingUntilAvailable();
 
-  await merchant.stop();
   await merchant.start();
   await merchant.pingUntilAvailable();
 
diff --git 
a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts 
b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts
index 23972ed63..4ef5e3bff 100644
--- a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts
+++ b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts
@@ -123,13 +123,15 @@ export async function runPaymentMultipleTest(t: 
GlobalTestState) {
 
   // Withdraw digital cash into the wallet.
 
-  await withdrawViaBankV2(t, {
+  const wres = await withdrawViaBankV2(t, {
     walletClient,
     bank,
     exchange,
     amount: "TESTKUDOS:100",
   });
 
+  await wres.withdrawalFinishedCond;
+
   // Set up order.
 
   const orderResp = await merchantClient.createOrder({
diff --git a/packages/taler-harness/src/integrationtests/test-refund-gone.ts 
b/packages/taler-harness/src/integrationtests/test-refund-gone.ts
index 9ba078a6d..d50919934 100644
--- a/packages/taler-harness/src/integrationtests/test-refund-gone.ts
+++ b/packages/taler-harness/src/integrationtests/test-refund-gone.ts
@@ -44,13 +44,15 @@ export async function runRefundGoneTest(t: GlobalTestState) 
{
 
   // Withdraw digital cash into the wallet.
 
-  await withdrawViaBankV2(t, {
+  const wres = await withdrawViaBankV2(t, {
     walletClient,
     bank,
     exchange,
     amount: "TESTKUDOS:20",
   });
 
+  await wres.withdrawalFinishedCond;
+
   // Set up order.
 
   const orderResp = await merchantClient.createOrder({
diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts 
b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts
index 243c90e2e..fc2774adf 100644
--- a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts
+++ b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts
@@ -19,7 +19,9 @@
  */
 import {
   Amounts,
+  Duration,
   MerchantApiClient,
+  MerchantContractTerms,
   PreparePayResultType,
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
@@ -41,7 +43,18 @@ export async function runWalletBalanceTest(t: 
GlobalTestState) {
   const { merchant, walletClient, exchange, bank } =
     await createSimpleTestkudosEnvironmentV2(t);
 
-  const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl());
+  await merchant.addInstanceWithWireAccount({
+    id: "myinst",
+    name: "My Instance",
+    paytoUris: ["payto://void/foo"],
+    defaultWireTransferDelay: Duration.toTalerProtocolDuration(
+      Duration.fromSpec({ minutes: 1 }),
+    ),
+  });
+
+  const merchantClient = new MerchantApiClient(
+    merchant.makeInstanceBaseUrl("myinst"),
+  );
 
   // Withdraw digital cash into the wallet.
 
@@ -54,7 +67,7 @@ export async function runWalletBalanceTest(t: 
GlobalTestState) {
 
   await wres.withdrawalFinishedCond;
 
-  const order = {
+  const order: Partial<MerchantContractTerms> = {
     summary: "Buy me!",
     amount: "TESTKUDOS:5",
     fulfillment_url: "taler://fulfillment-success/thx",
diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts 
b/packages/taler-wallet-core/src/util/coinSelection.ts
index daba2ead5..abf0bbc02 100644
--- a/packages/taler-wallet-core/src/util/coinSelection.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection.ts
@@ -588,22 +588,22 @@ async function selectPayMerchantCandidates(
         for (const acc of exchangeDetails.wireInfo.accounts) {
           const pp = parsePaytoUri(acc.payto_uri);
           checkLogicInvariant(!!pp);
-          if (pp.targetType === req.wireMethod) {
-            // also check that wire method is supported now
-            const wireFeeStr = exchangeDetails.wireInfo.feesForType[
-              req.wireMethod
-            ]?.find((x) => {
-              return AbsoluteTime.isBetween(
-                AbsoluteTime.now(),
-                AbsoluteTime.fromProtocolTimestamp(x.startStamp),
-                AbsoluteTime.fromProtocolTimestamp(x.endStamp),
-              );
-            })?.wireFee;
-            if (wireFeeStr) {
-              wireMethodFee = wireFeeStr;
-            }
-            break;
+          if (pp.targetType !== req.wireMethod) {
+            continue;
           }
+          const wireFeeStr = exchangeDetails.wireInfo.feesForType[
+            req.wireMethod
+          ]?.find((x) => {
+            return AbsoluteTime.isBetween(
+              AbsoluteTime.now(),
+              AbsoluteTime.fromProtocolTimestamp(x.startStamp),
+              AbsoluteTime.fromProtocolTimestamp(x.endStamp),
+            );
+          })?.wireFee;
+          if (wireFeeStr) {
+            wireMethodFee = wireFeeStr;
+          }
+          break;
         }
         if (!wireMethodFee) {
           break;

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