gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (1ca5677f -> 8b73c30b)


From: gnunet
Subject: [taler-wallet-core] branch master updated (1ca5677f -> 8b73c30b)
Date: Wed, 01 Sep 2021 17:52:01 +0200

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

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

    from 1ca5677f Need to "tick" before asking transactions to libeufin.
     new 2cecdccb remove test without assertions
     new 79c14e77 Avoid Sandbox (deprecated) POST /admin/payments/ API.
     new 8b73c30b Avoid Sandbox (deprecated) POST /admin/payments/ API.

The 3 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:
 build-system/taler-build-scripts                   |  2 +-
 .../test-libeufin-api-bankaccount.ts               | 25 +++----
 .../test-libeufin-api-sandbox-transactions.ts      | 50 +++++++------
 .../test-libeufin-refund-multiple-users.ts         | 34 +++++----
 .../src/integrationtests/test-libeufin-refund.ts   | 54 ++++++--------
 .../test-libeufin-sandbox-camt-statement.ts        | 83 ----------------------
 .../src/integrationtests/testrunner.ts             |  2 -
 7 files changed, 72 insertions(+), 178 deletions(-)
 delete mode 100644 
packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-camt-statement.ts

diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
index 38c168b1..c76fb9b3 160000
--- a/build-system/taler-build-scripts
+++ b/build-system/taler-build-scripts
@@ -1 +1 @@
-Subproject commit 38c168b11eeeab93562ffa74b3e2aff4b596c77a
+Subproject commit c76fb9b3af6ec43f2d2a83e6b4f523dcc5ac6a54
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts
 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts
index 2fbc952e..d5169402 100644
--- 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts
+++ 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts
@@ -88,20 +88,17 @@ export async function runLibeufinApiBankaccountTest(t: 
GlobalTestState) {
     "mock",
     "local-mock",
   );
-
-  await LibeufinSandboxApi.bookPayment2(sandbox, {
-    creditorIban: "DE71500105179674997361",
-    creditorBic: "BELADEBEXXX",
-    creditorName: "mock",
-    debtorIban: "DE84500105176881385584",
-    debtorBic: "BELADEBEXXX",
-    debtorName: "mock2",
-    subject: "mock subject",
-    currency: "EUR",
-    amount: "1",
-    uid: "mock",
-    direction: "CRDT",
-  });
+  await LibeufinSandboxApi.simulateIncomingTransaction(
+    sandbox,
+    "mock", // creditor bankaccount label
+    {
+      debtorIban: "DE84500105176881385584",
+      debtorBic: "BELADEBEXXX",
+      debtorName: "mock2",
+      amount: "1",
+      subject: "mock subject",
+    }
+  );
   await LibeufinNexusApi.fetchAllTransactions(nexus, "local-mock");
   let transactions = await LibeufinNexusApi.getAccountTransactions(
     nexus,
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts
 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts
index fc558af1..f9676c58 100644
--- 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts
+++ 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts
@@ -42,32 +42,30 @@ export async function 
runLibeufinApiSandboxTransactionsTest(t: GlobalTestState)
     label: "mock-account",
     currency: "EUR"
   });
-  await LibeufinSandboxApi.bookPayment2(sandbox, {
-    creditorIban: "DE71500105179674997361",
-    creditorBic: "BELADEBEXXX",
-    creditorName: "mock",
-    debtorIban: "DE84500105176881385584",
-    debtorBic: "BELADEBEXXX",
-    debtorName: "mock2",
-    subject: "mock subject",
-    currency: "EUR",
-    amount: "1",
-    uid: "mock",
-    direction: "CRDT",
-  });
-  await LibeufinSandboxApi.bookPayment2(sandbox, {
-    creditorIban: "DE71500105179674997361",
-    creditorBic: "BELADEBEXXX",
-    creditorName: "mock",
-    debtorIban: "DE84500105176881385584",
-    debtorBic: "BELADEBEXXX",
-    debtorName: "mock2",
-    subject: "mock subject 2",
-    currency: "EUR",
-    amount: "1.1",
-    uid: "mock2",
-    direction: "CRDT",
-  });
+  await LibeufinSandboxApi.simulateIncomingTransaction(
+    sandbox, 
+    "mock-account",
+    {
+    
+      debtorIban: "DE84500105176881385584",
+      debtorBic: "BELADEBEXXX",
+      debtorName: "mock2",
+      subject: "mock subject",
+      amount: "1" // EUR is default.
+    }
+  )
+  await LibeufinSandboxApi.simulateIncomingTransaction(
+    sandbox, 
+    "mock-account",
+    {
+    
+      debtorIban: "DE84500105176881385584",
+      debtorBic: "BELADEBEXXX",
+      debtorName: "mock2",
+      subject: "mock subject 2",
+      amount: "1.1" // EUR is default.
+    }
+  )
   let ret = await LibeufinSandboxApi.getAccountInfoWithBalance(sandbox, 
"mock-account");
   t.assertAmountEquals(ret.data.balance, "EUR:2.1");
 }
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts
 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts
index d15a2d65..1159ddf4 100644
--- 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts
+++ 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts
@@ -68,39 +68,37 @@ export async function runLibeufinRefundMultipleUsersTest(t: 
GlobalTestState) {
     ["twg"],
   );
 
-  /**
-   * user01 pays user02 using a invalid subject.  At the end,
-   * user01 checks whether one incoming payment exists in the
-   * history.  This one incoming payment will be the refund.
-   */
-  await LibeufinSandboxApi.bookPayment(
-    libeufinServices.libeufinSandbox,
-    user02sandbox,
-    user01sandbox,
+  // user 01 gets the payment
+  await libeufinServices.libeufinSandbox.makeTransaction(
+    user02sandbox.ebicsBankAccount.label, // debit
+    user01sandbox.ebicsBankAccount.label, // credit
+    "EUR:1",
     "not a public key",
-    "1",
-    "EUR",
   );
 
+  // user 01 fetches the payments
   await LibeufinNexusApi.fetchAllTransactions(
     libeufinServices.libeufinNexus,
-    user02nexus.localAccountName,
+    user01nexus.localAccountName,
   );
-  delayMs(2000); // time to ingest.
 
+  // user 01 tries to submit the reimbursement, as
+  // the payment didn't have a valid public key in
+  // the subject.
   await LibeufinNexusApi.submitInitiatedPayment(
     libeufinServices.libeufinNexus,
-    user02nexus.localAccountName,
+    user01nexus.localAccountName,
     "1", // so far the only one that can exist.
   );
 
-  // Counterpart checks whether the reimbursement shows up.
+  // user 02 checks whether a reimbursement arrived.
   let history = await LibeufinSandboxApi.getAccountTransactions(
     libeufinServices.libeufinSandbox,
-    user01sandbox.ebicsBankAccount["label"],
+    user02sandbox.ebicsBankAccount["label"],
   );
-
-  t.assertTrue(history["payments"].length == 1);
+  // reimbursement arrived IFF the total payments are 2:
+  // 1 the original (faulty) transaction + 1 the reimbursement.
+  t.assertTrue(history["payments"].length == 2);
 }
 
 runLibeufinRefundMultipleUsersTest.suites = ["libeufin"];
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
index 843a35d8..5f6619de 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
@@ -58,58 +58,44 @@ export async function runLibeufinRefundTest(t: 
GlobalTestState) {
     ["twg"],
   );
 
-  /**
-   * user01 pays user02 using a invalid subject.  At the end,
-   * user01 checks whether one incoming payment exists in the
-   * history.  This one incoming payment will be the refund.
-   */
-  await LibeufinSandboxApi.bookPayment(
-    libeufinServices.libeufinSandbox,
-    user02sandbox,
-    user01sandbox,
+  // user 02 pays user 01 with a faulty (non Taler) subject.
+  await libeufinServices.libeufinSandbox.makeTransaction(
+    user02sandbox.ebicsBankAccount.label, // debit
+    user01sandbox.ebicsBankAccount.label, // credit
+    "EUR:1",
     "not a public key",
-    "1",
-    "EUR",
   );
 
-  // check payment shows up in the Sandbox' history.
-  // NOTE: the debitor account has no entry so far, because
-  // the call above is a mere test method that books only one
-  // CRDT transaction.
-  const txsCredit = await LibeufinSandboxApi.getAccountTransactions(
-    libeufinServices.libeufinSandbox,
-    user02sandbox.ebicsBankAccount["label"]);
-  t.assertTrue(txsCredit["payments"].length == 1);
-
-  // Gets the faulty payment in the (ingested) history.
+  // The bad payment should be now ingested and prepared as
+  // a reimbursement.
   await LibeufinNexusApi.fetchAllTransactions(
     libeufinServices.libeufinNexus,
-    user02nexus.localAccountName,
+    user01nexus.localAccountName,
   );
-  // Give time to ingest.
-  delayMs(2000);
-
-  // Check payment shows up in Nexus history.
+  // Check that the payment arrived at the Nexus.
   const nexusTxs = await LibeufinNexusApi.getAccountTransactions(
     libeufinServices.libeufinNexus,
-    user02nexus.localAccountName,
+    user01nexus.localAccountName,
   );
   t.assertTrue(nexusTxs.data["transactions"].length == 1);
 
-  // This should pay the faulty payment back.
+  // Submit the reimbursement
   await LibeufinNexusApi.submitInitiatedPayment(
     libeufinServices.libeufinNexus,
-    user02nexus.localAccountName,
-    // The initiated payment ID below got set by the Taler
-    // facade; at this point only one can / must exist.
+    user01nexus.localAccountName,
+    // The initiated payment (= the reimbursement) ID below
+    // got set by the Taler facade; at this point only one must
+    // exist.  If "1" is not found, a 404 will make this test fail.
     "1",
   );
 
-  // Counterpart checks whether the reimbursement shows up.
+  // user 02 checks whether the reimbursement arrived.
   let history = await LibeufinSandboxApi.getAccountTransactions(
     libeufinServices.libeufinSandbox,
-    user01sandbox.ebicsBankAccount["label"],
+    user02sandbox.ebicsBankAccount["label"],
   );
-  t.assertTrue(history["payments"].length == 1);
+  // 2 payments must exist: 1 the original (faulty) payment +
+  // 1 the reimbursement.
+  t.assertTrue(history["payments"].length == 2);
 }
 runLibeufinRefundTest.suites = ["libeufin"];
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-camt-statement.ts
 
b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-camt-statement.ts
deleted file mode 100644
index 8a3a4ef3..00000000
--- 
a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-camt-statement.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 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
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- * Imports.
- */
-import { GlobalTestState } from "./harness";
-import {
-  NexusUserBundle,
-  LibeufinNexusApi,
-  LibeufinNexusService,
-  LibeufinSandboxService,
-  LibeufinSandboxApi,
-  findNexusPayment,
-} from "./libeufin";
-
-export async function runLibeufinSandboxCamtStatementTest(t: GlobalTestState) {
-
-  const sandbox = await LibeufinSandboxService.create(t, {
-    httpPort: 5012,
-    databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`,
-  });
-  await sandbox.start();
-  await sandbox.pingUntilAvailable();
-  await LibeufinSandboxApi.createBankAccount(sandbox, {
-    iban: "DE71500105179674997360",
-    bic: "BELADEBEXXX",
-    name: "Mock Name 0",
-    label: "mock-account-0",
-    currency: "EUR"
-  });
-  await LibeufinSandboxApi.createBankAccount(sandbox, {
-    iban: "DE71500105179674997361",
-    bic: "BELADEBEXXX",
-    name: "Mock Name",
-    label: "mock-account",
-    currency: "EUR"
-  });
-  await LibeufinSandboxApi.bookPayment2(sandbox, {
-    creditorIban: "DE71500105179674997361",
-    creditorBic: "BELADEBEXXX",
-    creditorName: "mock",
-    debtorIban: "DE84500105176881385584",
-    debtorBic: "BELADEBEXXX",
-    debtorName: "mock2",
-    subject: "mock subject",
-    currency: "EUR",
-    amount: "1",
-    uid: "mock",
-    direction: "CRDT",
-  });
-  await LibeufinSandboxApi.bookPayment2(sandbox, {
-    creditorIban: "DE71500105179674997361",
-    creditorBic: "BELADEBEXXX",
-    creditorName: "mock",
-    debtorIban: "DE84500105176881385584",
-    debtorBic: "BELADEBEXXX",
-    debtorName: "mock2",
-    subject: "mock subject 2",
-    currency: "EUR",
-    amount: "1.1",
-    uid: "mock2",
-    direction: "CRDT",
-  });
-  let beforeTick = await sandbox.c53tick();
-  console.log(beforeTick);
-  let afterTick = await sandbox.c53tick();
-  console.log(afterTick);
-}
-runLibeufinSandboxCamtStatementTest.suites = ["libeufin"];
diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts 
b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
index 32d369fc..71f92095 100644
--- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
@@ -71,7 +71,6 @@ import { runLibeufinApiUsersTest } from 
"./test-libeufin-api-users";
 import { runLibeufinApiBankaccountTest } from 
"./test-libeufin-api-bankaccount";
 import { runLibeufinApiSandboxTransactionsTest } from 
"./test-libeufin-api-sandbox-transactions";
 import { runLibeufinApiSandboxCamtTest } from 
"./test-libeufin-api-sandbox-camt";
-import { runLibeufinSandboxCamtStatementTest } from 
"./test-libeufin-sandbox-camt-statement";
 import { runLibeufinSandboxWireTransferCliTest } from 
"./test-libeufin-sandbox-wire-transfer-cli";
 import { runDepositTest } from "./test-deposit";
 import CancellationToken from "cancellationtoken";
@@ -123,7 +122,6 @@ const allTests: TestMainFunction[] = [
   runLibeufinApiBankconnectionTest,
   runLibeufinApiSandboxTransactionsTest,
   runLibeufinApiSandboxCamtTest,
-  runLibeufinSandboxCamtStatementTest,
   runLibeufinSandboxWireTransferCliTest,
   runMerchantExchangeConfusionTest,
   runMerchantInstancesTest,

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