gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: Libeufin Tests.


From: gnunet
Subject: [taler-wallet-core] branch master updated: Libeufin Tests.
Date: Thu, 29 Apr 2021 11:20:31 +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 9928d2ef Libeufin Tests.
9928d2ef is described below

commit 9928d2ef35bbc8dbbfd7b673b79bc6050740e686
Author: MS <ms@taler.net>
AuthorDate: Thu Apr 29 11:19:17 2021 +0200

    Libeufin Tests.
    
    Testing refunds due to invalid subject.  Up to the
    point where the list of transactions is returned by
    the local bank account.
---
 .../src/integrationtests/libeufin.ts               | 37 ++++++++++++++++++----
 .../src/integrationtests/test-libeufin-refund.ts   | 26 +++++++++++++++
 2 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts 
b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
index ad906deb..cee0f79c 100644
--- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
@@ -39,8 +39,8 @@ export interface LibeufinNexusServiceInterface {
 }
 
 export interface LibeufinServices {
-  libeufinSandbox: LibeufinSandboxServiceInterface;
-  libeufinNexus: LibeufinNexusServiceInterface;
+  libeufinSandbox: LibeufinSandboxService;
+  libeufinNexus: LibeufinNexusService;
   commonDb: DbInfo;
 }
 
@@ -279,7 +279,7 @@ export interface SimulateIncomingTransactionRequest {
 /**
  * The bundle aims at minimizing the amount of input
  * data that is required to initialize a new user + Ebics
- * connection thereof.
+ * connection.
  */
 export class NexusUserBundle {
   userReq: CreateNexusUserRequest;
@@ -651,7 +651,7 @@ export namespace LibeufinSandboxApi {
   }
 
   export async function bookPayment(
-    libeufinSandboxService: LibeufinSandboxServiceInterface,
+    libeufinSandboxService: LibeufinSandboxService,
     creditorBundle: SandboxUserBundle,
     debitorBundle: SandboxUserBundle,
     subject: string,
@@ -849,9 +849,34 @@ export namespace LibeufinNexusApi {
     );
   }
 
+  export async function getAccountTransactions(
+    libeufinNexusService: LibeufinNexusService,
+    accountName: string,
+    username: string = "admin",
+    password: string = "test",
+  ): Promise<void> {
+    const baseUrl = libeufinNexusService.baseUrl;
+    let url = new URL(
+      `/bank-accounts/${accountName}/transactions`,
+      baseUrl,
+    );
+    await axios.get(
+      url.href,
+      {
+        auth: {
+          username: username,
+          password: password,
+        },
+      },
+    );
+  }
+
+
   export async function fetchAllTransactions(
     libeufinNexusService: LibeufinNexusService,
     accountName: string,
+    username: string = "admin",
+    password: string = "test",
   ): Promise<void> {
     const baseUrl = libeufinNexusService.baseUrl;
     let url = new URL(
@@ -866,8 +891,8 @@ export namespace LibeufinNexusApi {
       },
       {
         auth: {
-          username: "admin",
-          password: "test",
+          username: username,
+          password: password,
         },
       },
     );
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 0adabbf4..dc5a14c8 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts
@@ -23,6 +23,7 @@ import {
   NexusUserBundle,
   launchLibeufinServices,
   LibeufinSandboxApi,
+  LibeufinNexusApi,
 } from "./libeufin";
 
 /**
@@ -46,6 +47,10 @@ 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.
   await LibeufinSandboxApi.bookPayment(
     libeufinServices.libeufinSandbox,
     user02sandbox,
@@ -54,4 +59,25 @@ export async function runLibeufinRefundTest(t: 
GlobalTestState) {
     "1",
     "EUR",
   );
+
+  // STEPS.
+
+  // 1.  Exchange must import 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(
+    libeufinServices.libeufinNexus,
+    user02nexus.localAccountName,
+  );
 }

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