[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: cli upgrading
From: |
gnunet |
Subject: |
[libeufin] branch master updated: cli upgrading |
Date: |
Thu, 11 Jun 2020 18:40:59 +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 ca27936 cli upgrading
ca27936 is described below
commit ca27936df1c5bdfcab7b26e1be8a24503c260a73
Author: MS <ms@taler.net>
AuthorDate: Thu Jun 11 18:39:14 2020 +0200
cli upgrading
adding a bash script that uses the new python cli.
It bootstraps a new environment using the sandbox.
---
cli/libeufin-cli-new | 30 ++++++++++-----
cli/setup-template.sh | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+), 10 deletions(-)
diff --git a/cli/libeufin-cli-new b/cli/libeufin-cli-new
index 854f732..b4e6844 100755
--- a/cli/libeufin-cli-new
+++ b/cli/libeufin-cli-new
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
-import os
import click
import json
import hashlib
@@ -46,19 +45,19 @@ def sandbox(ctx):
@click.argument("nexus-base-url")
@click.pass_obj
def new_ebics_connection(obj, connection_name, ebics_url, host_id, partner_id,
- nexus_user_id, nexus_password, nexus_base_url):
+ nexus_user_id, nexus_password, nexus_base_url,
ebics_user_id):
url = urljoin(nexus_base_url, "/bank-connections")
body = dict(
name=connection_name,
source="new",
type="ebics",
- data=dict(ebicsURL=ebics_url, hostID=host_id, partnerID=partner_id,
userID=user_id)
+ data=dict(ebicsURL=ebics_url, hostID=host_id, partnerID=partner_id,
userID=ebics_user_id)
),
try:
resp = post(url, json=body, auth = auth.HTTPBasicAuth(nexus_user_id,
nexus_password))
except Exception:
print("Could not reach nexus")
- return
+ exit(1)
print(resp.content.decode("utf-8"))
@bank_connection.command(help="bootstrap the bank connection")
@@ -103,6 +102,7 @@ def import_bank_accounts(obj, connection_name,
nexus_user_id, nexus_password, ne
@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 prepare_payment(obj, account_name, credit_iban, credit_bic, credit_name,
nexus_user_id, nexus_password, nexus_base_url):
url = urljoin(nexus_basd_url,
"/bank-accounts/{}/prepared-payments".format(account_name))
@@ -128,6 +128,7 @@ def prepare_payment(obj, account_name, credit_iban,
credit_bic, credit_name,
@click.option("--nexus-user-id", help="nexus user id", required=True)
@click.option("--nexus-password", help="nexus user password", required=True)
@click.argument("nexus-base-url")
+@click.pass_obj
def submit_payment(obj, account_name, payment_uuid, nexus_user_id,
nexus_password, nexus_base_url):
url = urljoin(
nexus_base_url,
"/bank-accounts/{}/prepared-payments/{}/submit".format(account_name,
payment_uuid)
@@ -144,6 +145,7 @@ def submit_payment(obj, account_name, payment_uuid,
nexus_user_id, nexus_passwor
@click.option("--nexus-user-id", help="nexus user id", required=True)
@click.option("--nexus-password", help="nexus user password", required=True)
@click.argument("nexus-base-url")
+@click.pass_obj
def submit_payment(obj, account_name, nexus_user_id, nexus_password,
nexus_base_url):
url = urljoin(
nexus_base_url,
"/bank-accounts/{}/fetch-transactions".format(account_name)
@@ -160,6 +162,7 @@ def submit_payment(obj, account_name, nexus_user_id,
nexus_password, nexus_base_
@click.option("--nexus-user-id", help="nexus user id", required=True)
@click.option("--nexus-password", help="nexus user password", required=True)
@click.argument("nexus-base-url")
+@click.pass_obj
def transactions(obj, account_name, nexus_user_id, nexus_password,
nexus_base_url):
url = urljoin(nexus_base_url,
"/bank-accounts/{}/transactions".format(account_name))
try:
@@ -173,21 +176,26 @@ def transactions(obj, account_name, nexus_user_id,
nexus_password, nexus_base_ur
@sandbox.command(help="activate a Ebics host")
@click.option("--host-id", help="Ebics host ID", required=True)
@click.argument("sandbox-base-url")
+@click.pass_obj
def make_ebics_host(obj, host_id, sandbox_base_url):
url = urljoin(sandbox_base_url, "/admin/ebics/host")
try:
- post(url, json=dict(hostID=host_id, ebicsVersion="2.5"))
+ resp = post(url, json=dict(hostID=host_id, ebicsVersion="2.5"))
except Exception:
print("Could not reach sandbox")
return
print(resp.content.decode("utf-8"))
@sandbox.command(help="activate a Ebics subscriber")
+@click.option("--host-id", help="Ebics host ID", required=True)
+@click.option("--partner-id", help="Ebics partner ID", required=True)
+@click.option("--user-id", help="Ebics user ID", required=True)
@click.argument("sandbox-base-url")
+@click.pass_obj
def activate_ebics_subscriber(obj, host_id, partner_id, user_id,
sandbox_base_url):
url = urljoin(sandbox_base_url, "/admin/ebics/subscribers")
try:
- post(url, json=dict(hostID=host_id, partnerID=partner_id,
userID=user_id))
+ resp = post(url, json=dict(hostID=host_id, partnerID=partner_id,
userID=user_id))
except Exception:
print("Could not reach sandbox")
return
@@ -198,10 +206,11 @@ def activate_ebics_subscriber(obj, host_id, partner_id,
user_id, sandbox_base_ur
@click.option("--bic", help="BIC", required=True)
@click.option("--person-name", help="bank account owner name", required=True)
@click.option("--account-name", help="label of this bank account",
required=True)
-@click.option("--ebics_user_id", help="user ID of the Ebics subscriber",
required=True)
-@click.option("--ebics_host_id", help="host ID of the Ebics subscriber",
required=True)
-@click.option("--ebics_partner_id", help="partner ID of the Ebics subscriber",
required=True)
+@click.option("--ebics-user-id", help="user ID of the Ebics subscriber",
required=True)
+@click.option("--ebics-host-id", help="host ID of the Ebics subscriber",
required=True)
+@click.option("--ebics-partner-id", help="partner ID of the Ebics subscriber",
required=True)
@click.argument("sandbox-base-url")
+@click.pass_obj
def associate_bank_account(obj, iban, bic, person_name, account_name,
ebics_user_id, ebics_host_id, ebics_partner_id,
sandbox_base_url):
url = urljoin(sandbox_base_url, "/admin/ebics/bank-accounts")
@@ -226,8 +235,9 @@ def associate_bank_account(obj, iban, bic, person_name,
account_name,
@click.option("--debtor-name", help="name of the person who is sending the
payment")
@click.option("--amount", help="amount, no currency")
@click.option("--currency", help="currency")
-@click.option("--subject", help="Payment subject")
+@click.option("--subject", help="payment subject")
@click.argument("sandbox-base-url")
+@click.pass_obj
def book_payment(obj, creditor_iban, creditor_bic, creditor_name, debtor_iban,
debtor_bic, debtor_name, amount, currency, subject,
sandbox_base_url):
diff --git a/cli/setup-template.sh b/cli/setup-template.sh
new file mode 100755
index 0000000..574c762
--- /dev/null
+++ b/cli/setup-template.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# Such template sets an env up using the Python CLI.
+
+# set -eu
+set -u
+
+EBICS_HOST_ID=ebicshost
+EBICS_PARTNER_ID=ebicspartner
+EBICS_USER_ID=ebicsuser
+EBICS_BASE_URL="$SANDBOX_URL/ebicsweb"
+
+IBAN=x
+BIC=y
+PERSON_NAME=z
+ACCOUNT_NAME=a
+
+NEXUS_USER=u
+NEXUS_PASSWORD=p
+NEXUS_BANK_CONNECTION_NAME=b
+
+########## setup sandbox #############
+
+# make ebics host as sandbox
+echo Making a ebics host at the sandbox
+sleep 3
+./libeufin-cli-new \
+ sandbox \
+ make-ebics-host \
+ --host-id=$EBICS_HOST_ID \
+ $SANDBOX_URL
+
+# activate a ebics subscriber on that host
+echo Activating the ebics subscriber at the sandbox
+sleep 3
+./libeufin-cli-new \
+ sandbox \
+ activate-ebics-subscriber \
+ --host-id=$EBICS_HOST_ID \
+ --partner-id=$EBICS_PARTNER_ID \
+ --user-id=$EBICS_USER_ID \
+ $SANDBOX_URL
+
+# give a bank account to such user
+echo Giving a bank account to such subscriber
+./libeufin-cli-new \
+ sandbox \
+ associate-bank-account \
+ --iban=$IBAN \
+ --bic=$BIC \
+ --person-name=$PERSON_NAME \
+ --account-name=$ACCOUNT_NAME \
+ --ebics-user-id=$EBICS_USER_ID \
+ --ebics-host-id=$EBICS_HOST_ID \
+ --ebics-partner-id=$EBICS_PARTNER_ID \
+ $SANDBOX_URL
+sleep 3
+
+########## setup nexus #############
+
+# create a user
+echo Creating a nexus user
+nexus superuser --password $NEXUS_PASSWORD $NEXUS_USER
+sleep 3
+
+# create a bank connection
+echo Creating a bank connection for such user
+./libeufin-cli-new \
+ bank-connection \
+ new-ebics-connection \
+ --connection-name $NEXUS_BANK_CONNECTION_NAME \
+ --ebics-url $EBICS_BASE_URL \
+ --host-id $EBICS_HOST_ID \
+ --partner-id $EBICS_PARTNER_ID \
+ --ebics-user-id $EBICS_USER_ID \
+ --nexus-user-id $NEXUS_USER \
+ --nexus-password $NEXUS_PASSWORD \
+ $NEXUS_URL
+sleep 3
+
+# Bootstrapping such connection
+echo Bootstrapping the bank connection
+./libeufin-cli-new \
+ bank-connection \
+ bootstrap-bank-connection \
+ --connection-name $NEXUS_BANK_CONNECTION_NAME \
+ --nexus-user-id $NEXUS_USER \
+ --nexus-password $NEXUS_PASSWORD \
+ $NEXUS_URL
+sleep 3
+
+# Fetching the bank accounts
+echo Fetching the bank accounts
+./libeufin-cli-new \
+ bank-connection \
+ import-bank-accounts \
+ --connection-name $NEXUS_BANK_CONNECTION_NAME \
+ --nexus-user-id $NEXUS_USER \
+ --nexus-password $NEXUS_PASSWORD \
+ $NEXUS_URL
+sleep 3
+
+echo User is setup, history can be requested, and \
+ new payments can be prepared and submitted.
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: cli upgrading,
gnunet <=