gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: Testing: done with simple ref


From: gnunet
Subject: [taler-wallet-core] branch master updated: Testing: done with simple refund case.
Date: Fri, 30 Apr 2021 11:46:08 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new eaa5aba4 Testing: done with simple refund case.
eaa5aba4 is described below

commit eaa5aba4e21dbf86a27860575f8f22a80993e0f3
Author: MS <ms@taler.net>
AuthorDate: Fri Apr 30 11:45:47 2021 +0200

    Testing: done with simple refund case.
---
 .../src/integrationtests/libeufin.ts               | 26 +++++++++++++++--
 .../src/integrationtests/test-libeufin-refund.ts   | 33 +++++++++++-----------
 2 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts 
b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
index a6012719..480dadbe 100644
--- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
@@ -784,6 +784,28 @@ export namespace LibeufinNexusApi {
     );
   }
 
+  export async function submitInitiatedPayment(
+    libeufinNexusService: LibeufinNexusServiceInterface,
+    accountName: string,
+    paymentId: string,
+  ): Promise<void> {
+    const baseUrl = libeufinNexusService.baseUrl;
+    let url = new URL(
+      `bank-accounts/${accountName}/payment-initiations/${paymentId}/submit`,
+      baseUrl,
+    );
+    await axios.post(
+      url.href,
+      {},
+      {
+        auth: {
+          username: "admin",
+          password: "test",
+        },
+      },
+    );
+  }
+
   export async function fetchAccounts(
     libeufinNexusService: LibeufinNexusServiceInterface,
     connectionName: string,
@@ -874,6 +896,8 @@ export namespace LibeufinNexusApi {
                 JSON.stringify(response.data, null, 2));
   }
 
+  // FIXME: this function should return some structured
+  // object that represents a history.
   export async function getAccountTransactions(
     libeufinNexusService: LibeufinNexusService,
     accountName: string,
@@ -894,8 +918,6 @@ export namespace LibeufinNexusApi {
         },
       },
     );
-    console.log(`History of account: ${accountName}`,
-                JSON.stringify(response.data, null, 2));
   }
 
 
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 e7233421..a0e94fe5 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
@@ -47,10 +47,11 @@ export async function runLibeufinRefundTest(t: 
GlobalTestState) {
     [user01sandbox, user02sandbox],
   );
 
-  // user02 - acting as the Exchange - gets money from user01,
-  // but this one gets the subject wrong - not a valid public key.
-  // The result should be a reimbursement - minus a small fee - of
-  // the paid money to user01.
+  /**
+   * 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,
@@ -60,24 +61,22 @@ export async function runLibeufinRefundTest(t: 
GlobalTestState) {
     "EUR",
   );
 
-  // STEPS.
-
-  // 1.  Exchange must fetch this payment into its Nexus / Facade.
-  // 2.  Facade logic should process incoming payments.
-  // 3.  A reimbursement should be prepared.
-  // 4.  The reimbursement payment should be sent.
-
-  // Steps 1-3 should happen all-at-once when triggering the import
-  // logic.  4 needs to be explicitly triggered (because here there's
-  // no background task activated, yet?)
-  
   await LibeufinNexusApi.fetchAllTransactions(
     libeufinServices.libeufinNexus,
     user02nexus.localAccountName,
   );
-  
-  await LibeufinNexusApi.getAccountTransactions(
+
+  await LibeufinNexusApi.submitInitiatedPayment(
     libeufinServices.libeufinNexus,
     user02nexus.localAccountName,
+    "1", // so far the only one that can exist.
+  ); 
+
+  // Counterpart checks whether the reimbursement shows up.
+  let history = await LibeufinSandboxApi.getAccountTransactions(
+    libeufinServices.libeufinSandbox,
+    "remote-account-01"
   );
+
+  t.assertTrue(history["payments"].length == 1)
 }

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