gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: test connection deletion (with cli)


From: gnunet
Subject: [libeufin] branch master updated: test connection deletion (with cli)
Date: Tue, 30 Jun 2020 17:07:02 +0200

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

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new f373c3a  test connection deletion (with cli)
f373c3a is described below

commit f373c3a6b62e33ebf0fb3e01bc3607ed0c157ce3
Author: MS <ms@taler.net>
AuthorDate: Tue Jun 30 17:06:47 2020 +0200

    test connection deletion (with cli)
---
 cli/libeufin-cli                                    | 21 +++++++++++++++++++++
 cli/setup-template.sh                               | 17 ++++++++++-------
 .../tech/libeufin/nexus/server/NexusServer.kt       |  2 +-
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/cli/libeufin-cli b/cli/libeufin-cli
index c517ec5..9df04c9 100755
--- a/cli/libeufin-cli
+++ b/cli/libeufin-cli
@@ -59,6 +59,27 @@ def export_backup(obj, connection_name, nexus_user_id, 
nexus_password, passphras
     print("Backup stored in {}".format(output_file))
 
 
+@bank_connection.command(help="delete bank connection")
+@click.option("--connection-name", help="Name of the bank connection to 
backup", required=True)
+@click.option("--nexus-user-id", help="Nexus user ID", required=True)
+@click.option("--nexus-password", help="Nexus password", required=True)
+@click.argument("nexus-base-url")
+@click.pass_obj
+def delete(obj, connection_name, nexus_user_id, nexus_password, 
nexus_base_url):
+
+    url = urljoin(nexus_base_url, 
"/bank-connections/delete-connection".format(connection_name))
+    try:
+        resp = post(
+            url,
+            json=dict(bankConnectionId=connection_name),
+            auth=auth.HTTPBasicAuth(nexus_user_id, nexus_password)
+        )
+    except Exception:
+        print("Could not reach nexus")
+        exit(1)
+
+    print(resp.content.decode("utf-8"))
+
 @bank_connection.command(help="restore backup")
 @click.option("--connection-name", help="Name of the bank connection to 
backup", required=True)
 @click.option("--nexus-user-id", help="Nexus user ID", required=True)
diff --git a/cli/setup-template.sh b/cli/setup-template.sh
index 4e8f95d..49a4325 100755
--- a/cli/setup-template.sh
+++ b/cli/setup-template.sh
@@ -3,7 +3,7 @@
 # Such template sets an env up using the Python CLI.
 # The setup goes until exchanging keys with the sandbox.
 
-set -eu
+set -e
 
 EBICS_HOST_ID=ebicshost
 EBICS_PARTNER_ID=ebicspartner
@@ -19,14 +19,17 @@ NEXUS_USER=u
 NEXUS_PASSWORD=p
 NEXUS_BANK_CONNECTION_NAME=b
 
-echo Nexus DB: $1
+if test -z $1; then
+  echo usage: ./setup-template.sh PATH-TO-NEXUS-DB
+  exit 1
+fi
 
 ########## setup sandbox #############
 
 # make ebics host at sandbox
 echo Making a ebics host at the sandbox
 sleep 2
-./libeufin-cli-new \
+./libeufin-cli \
   sandbox \
     make-ebics-host \
       --host-id=$EBICS_HOST_ID \
@@ -35,7 +38,7 @@ sleep 2
 # activate a ebics subscriber on that host
 echo Activating the ebics subscriber at the sandbox
 sleep 2
-./libeufin-cli-new \
+./libeufin-cli \
   sandbox \
     activate-ebics-subscriber \
       --host-id=$EBICS_HOST_ID \
@@ -45,7 +48,7 @@ sleep 2
 
 # give a bank account to such user
 echo Giving a bank account to such subscriber
-./libeufin-cli-new \
+./libeufin-cli \
   sandbox \
     associate-bank-account \
       --iban=$IBAN \
@@ -67,7 +70,7 @@ sleep 2
 
 # create a bank connection
 echo Creating a bank connection for such user
-./libeufin-cli-new \
+./libeufin-cli \
   bank-connection \
     new-ebics-connection \
       --connection-name $NEXUS_BANK_CONNECTION_NAME \
@@ -82,7 +85,7 @@ sleep 2
 
 # Bootstrapping such connection
 echo Bootstrapping the bank connection
-./libeufin-cli-new \
+./libeufin-cli \
   bank-connection \
     bootstrap-bank-connection \
       --connection-name $NEXUS_BANK_CONNECTION_NAME \
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index 29a4fc1..50022af 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -624,7 +624,7 @@ fun serverMain(dbName: String, host: String) {
                 call.respond(object {})
             }
 
-            post("/bank-connections/delete") {
+            post("/bank-connections/delete-connection") {
                 val body = call.receive<BankConnectionDeletion>()
                 transaction {
                     val conn = 
NexusBankConnectionEntity.findById(body.bankConnectionId) ?: throw NexusError(

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