gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (2051aded5 -> d0d19c2e8)


From: gnunet
Subject: [taler-wallet-core] branch master updated (2051aded5 -> d0d19c2e8)
Date: Wed, 23 Aug 2023 14:48:06 +0200

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

dold pushed a change to branch master
in repository wallet-core.

    from 2051aded5 -formatting / don't use deprecated method
     new 9be4034cc harness: shared test environment WIP
     new d0d19c2e8 harness: specify use_stefan in merchant backend

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-harness/src/harness/harness.ts      | 40 ++++++----
 packages/taler-harness/src/harness/helpers.ts      | 85 ++++++++++++++++++++++
 .../test-merchant-instances-urls.ts                |  8 +-
 .../src/integrationtests/test-simple-payment.ts    |  7 +-
 packages/taler-wallet-core/src/bank-api-client.ts  |  2 +-
 5 files changed, 117 insertions(+), 25 deletions(-)

diff --git a/packages/taler-harness/src/harness/harness.ts 
b/packages/taler-harness/src/harness/harness.ts
index c9202c60e..4e2bae8f2 100644
--- a/packages/taler-harness/src/harness/harness.ts
+++ b/packages/taler-harness/src/harness/harness.ts
@@ -467,6 +467,22 @@ export async function setupDb(t: GlobalTestState): 
Promise<DbInfo> {
   };
 }
 
+/**
+ * Make sure that the taler-integrationtest-shared database exists.
+ * Don't delete it if it already exists.
+ */
+export async function setupSharedDb(t: GlobalTestState): Promise<DbInfo> {
+  const dbname = "taler-integrationtest-shared";
+  const databases = await runCommand(t, "list-dbs", "psql", ["-Aqtl"]);
+  if (databases.indexOf("taler-integrationtest-shared") < 0) {
+    await runCommand(t, "createdb", "createdb", [dbname]);
+  }
+  return {
+    connStr: `postgres:///${dbname}`,
+    dbname,
+  };
+}
+
 export interface BankConfig {
   currency: string;
   httpPort: number;
@@ -857,6 +873,13 @@ export class FakebankService
     accountPassword: string;
   }[] = [];
 
+  /**
+   * Create a new fakebank service handle.
+   * 
+   * First generates the configuration for the fakebank and
+   * then creates a fakebank handle, but doesn't start the fakebank
+   * service yet.
+   */
   static async create(
     gc: GlobalTestState,
     bc: BankConfig,
@@ -1935,14 +1958,8 @@ export class MerchantService implements 
MerchantServiceInterface {
       name: instanceConfig.name,
       address: instanceConfig.address ?? {},
       jurisdiction: instanceConfig.jurisdiction ?? {},
-      default_max_wire_fee:
-        instanceConfig.defaultMaxWireFee ??
-        `${this.merchantConfig.currency}:1.0`,
-      default_wire_fee_amortization:
-        instanceConfig.defaultWireFeeAmortization ?? 3,
-      default_max_deposit_fee:
-        instanceConfig.defaultMaxDepositFee ??
-        `${this.merchantConfig.currency}:1.0`,
+      // FIXME: In some tests, we might want to make this configurable
+      use_stefan: true,
       default_wire_transfer_delay:
         instanceConfig.defaultWireTransferDelay ??
         Duration.toTalerProtocolDuration(
@@ -1984,9 +2001,6 @@ export interface PartialMerchantInstanceConfig {
   paytoUris: string[];
   address?: unknown;
   jurisdiction?: unknown;
-  defaultMaxWireFee?: string;
-  defaultMaxDepositFee?: string;
-  defaultWireFeeAmortization?: number;
   defaultWireTransferDelay?: TalerProtocolDuration;
   defaultPayDelay?: TalerProtocolDuration;
 }
@@ -2029,9 +2043,7 @@ export interface MerchantInstanceConfig {
   name: string;
   address: unknown;
   jurisdiction: unknown;
-  default_max_wire_fee: string;
-  default_max_deposit_fee: string;
-  default_wire_fee_amortization: number;
+  use_stefan: boolean;
   default_wire_transfer_delay: TalerProtocolDuration;
   default_pay_delay: TalerProtocolDuration;
 }
diff --git a/packages/taler-harness/src/harness/helpers.ts 
b/packages/taler-harness/src/harness/helpers.ts
index 3e91c8bd9..dd2c85ce1 100644
--- a/packages/taler-harness/src/harness/helpers.ts
+++ b/packages/taler-harness/src/harness/helpers.ts
@@ -55,6 +55,7 @@ import {
   MerchantService,
   MerchantServiceInterface,
   setupDb,
+  setupSharedDb,
   WalletCli,
   WalletClient,
   WalletService,
@@ -204,6 +205,90 @@ export async function createSimpleTestkudosEnvironment(
   };
 }
 
+export async function useSharedTestkudosEnvironment(t: GlobalTestState) {
+  const coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => 
x("TESTKUDOS"));
+
+  const db = await setupSharedDb(t);
+
+  const bank = await BankService.create(t, {
+    allowRegistrations: true,
+    currency: "TESTKUDOS",
+    database: db.connStr,
+    httpPort: 8082,
+  });
+
+  const exchange = ExchangeService.create(t, {
+    name: "testexchange-1",
+    currency: "TESTKUDOS",
+    httpPort: 8081,
+    database: db.connStr,
+  });
+
+  const merchant = await MerchantService.create(t, {
+    name: "testmerchant-1",
+    currency: "TESTKUDOS",
+    httpPort: 8083,
+    database: db.connStr,
+  });
+
+  const exchangeBankAccount = await bank.createExchangeAccount(
+    "myexchange",
+    "x",
+  );
+  await exchange.addBankAccount("1", exchangeBankAccount);
+
+  bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri);
+
+  await bank.start();
+
+  await bank.pingUntilAvailable();
+
+  exchange.addCoinConfigList(coinConfig);
+
+  await exchange.start();
+  await exchange.pingUntilAvailable();
+
+  merchant.addExchange(exchange);
+
+  await merchant.start();
+  await merchant.pingUntilAvailable();
+
+  await merchant.addInstance({
+    id: "default",
+    name: "Default Instance",
+    paytoUris: [getPayto("merchant-default")],
+    defaultWireTransferDelay: Duration.toTalerProtocolDuration(
+      Duration.fromSpec({ minutes: 1 }),
+    ),
+  });
+
+  await merchant.addInstance({
+    id: "minst1",
+    name: "minst1",
+    paytoUris: [getPayto("minst1")],
+    defaultWireTransferDelay: Duration.toTalerProtocolDuration(
+      Duration.fromSpec({ minutes: 1 }),
+    ),
+  });
+
+  const { walletClient, walletService } = await createWalletDaemonWithClient(
+    t,
+    { name: "wallet" },
+  );
+
+  console.log("setup done!");
+
+  return {
+    commonDb: db,
+    exchange,
+    merchant,
+    walletClient,
+    walletService,
+    bank,
+    exchangeBankAccount,
+  };
+}
+
 /**
  * Run a test case with a simple TESTKUDOS Taler environment, consisting
  * of one exchange, one bank and one merchant.
diff --git 
a/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts 
b/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts
index 1b5d50fd1..534b35278 100644
--- 
a/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts
+++ 
b/packages/taler-harness/src/integrationtests/test-merchant-instances-urls.ts
@@ -67,12 +67,10 @@ export async function runMerchantInstancesUrlsTest(t: 
GlobalTestState) {
   await clientForDefault.createInstance({
     id: "default",
     address: {},
-    default_max_deposit_fee: "TESTKUDOS:1",
-    default_max_wire_fee: "TESTKUDOS:1",
+    use_stefan: true,
     default_pay_delay: Duration.toTalerProtocolDuration(
       Duration.fromSpec({ seconds: 60 }),
     ),
-    default_wire_fee_amortization: 1,
     default_wire_transfer_delay: Duration.toTalerProtocolDuration(
       Duration.fromSpec({ seconds: 60 }),
     ),
@@ -92,12 +90,10 @@ export async function runMerchantInstancesUrlsTest(t: 
GlobalTestState) {
   await clientForDefault.createInstance({
     id: "myinst",
     address: {},
-    default_max_deposit_fee: "TESTKUDOS:1",
-    default_max_wire_fee: "TESTKUDOS:1",
     default_pay_delay: Duration.toTalerProtocolDuration(
       Duration.fromSpec({ seconds: 60 }),
     ),
-    default_wire_fee_amortization: 1,
+    use_stefan: true,
     default_wire_transfer_delay: Duration.toTalerProtocolDuration(
       Duration.fromSpec({ seconds: 60 }),
     ),
diff --git a/packages/taler-harness/src/integrationtests/test-simple-payment.ts 
b/packages/taler-harness/src/integrationtests/test-simple-payment.ts
index 82fa5f21d..58ab61435 100644
--- a/packages/taler-harness/src/integrationtests/test-simple-payment.ts
+++ b/packages/taler-harness/src/integrationtests/test-simple-payment.ts
@@ -1,6 +1,6 @@
 /*
  This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
+ (C) 2023 Taler Systems S.A.
 
  GNU Taler is free software; you can redistribute it and/or modify it under the
  terms of the GNU General Public License as published by the Free Software
@@ -20,11 +20,10 @@
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { GlobalTestState } from "../harness/harness.js";
 import {
-  createSimpleTestkudosEnvironmentV2,
   withdrawViaBankV2,
   makeTestPaymentV2,
+  useSharedTestkudosEnvironment,
 } from "../harness/helpers.js";
-import { j2s } from "@gnu-taler/taler-util";
 
 /**
  * Run test for basic, bank-integrated withdrawal and payment.
@@ -33,7 +32,7 @@ export async function runSimplePaymentTest(t: 
GlobalTestState) {
   // Set up test environment
 
   const { walletClient, bank, exchange, merchant } =
-    await createSimpleTestkudosEnvironmentV2(t);
+    await useSharedTestkudosEnvironment(t);
 
   // Withdraw digital cash into the wallet.
 
diff --git a/packages/taler-wallet-core/src/bank-api-client.ts 
b/packages/taler-wallet-core/src/bank-api-client.ts
index a7484b0b2..01c28e8e8 100644
--- a/packages/taler-wallet-core/src/bank-api-client.ts
+++ b/packages/taler-wallet-core/src/bank-api-client.ts
@@ -330,7 +330,7 @@ export class WireGatewayApiClient {
  * but it will be nice to have in utils to be used by others
  */
 export class BankAccessApiClient {
-  httpLib;
+  httpLib: HttpRequestLibrary;
 
   constructor(private args: BankAccessApiClientArgs) {
     this.httpLib = createPlatformHttpLib({

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