[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: address #6257
From: |
gnunet |
Subject: |
[libeufin] branch master updated: address #6257 |
Date: |
Tue, 10 Nov 2020 17:08:19 +0100 |
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 5975094 address #6257
5975094 is described below
commit 5975094156d254fdc44db3e3cab7f80b2b9a9e5f
Author: MS <ms@taler.net>
AuthorDate: Tue Nov 10 17:08:10 2020 +0100
address #6257
---
cli/libeufin-cli | 39 ++++++++++++++++++++-------------------
cli/setup-template.sh | 19 ++++++++-----------
2 files changed, 28 insertions(+), 30 deletions(-)
diff --git a/cli/libeufin-cli b/cli/libeufin-cli
index e4ac2c2..4bc0589 100755
--- a/cli/libeufin-cli
+++ b/cli/libeufin-cli
@@ -17,18 +17,19 @@ def fetch_env():
try:
nexus_base_url = os.environ["NEXUS_BASE_URL"]
nexus_username = os.environ["NEXUS_USERNAME"]
- obj.nexus_password = os.environ["NEXUS_PASSWORD"]
+ nexus_password = os.environ["NEXUS_PASSWORD"]
except KeyError:
print(
"Please ensure that NEXUS_BASE_URL,"
" NEXUS_USERNAME, NEXUS_PASSWORD exist"
" in the environment"
)
+ sys.exit(1)
return nexus_base_url, nexus_username, nexus_password
class NexusAccess:
def __init__(self, nexus_base_url=None, username=None, password=None):
- self.nexus_base_url = nexus_base_url,
+ self.nexus_base_url = nexus_base_url
self.username = username
self.password = password
@@ -72,7 +73,7 @@ def export_backup(obj, connection_name, passphrase,
output_file):
auth=auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password)
)
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
exit(1)
output = open(output_file, "w+")
@@ -95,7 +96,7 @@ def delete(obj, connection_name):
auth=auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password)
)
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
exit(1)
print(resp.content.decode("utf-8"))
@@ -129,7 +130,7 @@ def restore_backup(obj, backup_file, passphrase,
connection_name):
)
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
exit(1)
print(resp.content.decode("utf-8"))
@@ -144,7 +145,7 @@ def restore_backup(obj, backup_file, passphrase,
connection_name):
@click.pass_obj
def new_ebics_connection(obj, connection_name, ebics_url, host_id, partner_id,
ebics_user_id):
- url = urljoin(nexus_base_url, "/bank-connections")
+ url = urljoin(obj.nexus_base_url, "/bank-connections")
body = dict(
name=connection_name,
source="new",
@@ -152,9 +153,9 @@ def new_ebics_connection(obj, connection_name, ebics_url,
host_id, partner_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(obj.nexus_user_id,
obj.nexus_password))
+ resp = post(url, json=body, auth=auth.HTTPBasicAuth(obj.username,
obj.password))
except Exception:
- print("Could not reach nexus")
+ print(f"Could not reach nexus at {url}: {resp.json()}")
exit(1)
print(resp.content.decode("utf-8"))
@@ -162,11 +163,11 @@ def new_ebics_connection(obj, connection_name, ebics_url,
host_id, partner_id,
@click.argument("connection-name")
@click.pass_obj
def sync(obj, connection_name):
- url = urljoin(nexus_base_url,
"/bank-connections/{}/connect".format(connection_name))
+ url = urljoin(obj.nexus_base_url,
f"/bank-connections/{connection_name}/connect")
try:
- resp = post(url, json=dict(), auth =
auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password))
+ resp = post(url, json=dict(), auth = auth.HTTPBasicAuth(obj.username,
obj.password))
except Exception:
- print("Could not reach nexus")
+ print(f"Could not reach nexus at {url}")
return
print(resp.content.decode("utf-8"))
@@ -188,7 +189,7 @@ def import_bank_account(obj, connection_name,
offered_account_id, nexus_bank_acc
)
except Exception as ee:
print(ee)
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
return
print(resp.content.decode("utf-8"))
@@ -200,7 +201,7 @@ def download_bank_accounts(obj, connection_name):
try:
resp = post(url, json=dict(), auth =
auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password))
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
return
print(resp.content.decode("utf-8"))
@@ -210,7 +211,7 @@ def list_connections():
try:
resp = get(url, json=dict(), auth =
auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password))
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
return
print(resp.content.decode("utf-8"))
@@ -222,7 +223,7 @@ def list_offered_bank_accounts(obj, connection_name):
try:
resp = get(url, json=dict(), auth =
auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password))
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
return
print(resp.content.decode("utf-8"))
@@ -248,7 +249,7 @@ def prepare_payment(obj, account_name, credit_iban,
credit_bic, credit_name,
try:
resp = post(url, json=body, auth =
auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password))
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at " + url)
return
print(resp.content.decode("utf-8"))
@@ -263,7 +264,7 @@ def submit_payment(obj, account_name, payment_uuid):
try:
resp = post(url, json=dict(), auth =
auth.HTTPBasicAuth(obj.nexus_user_id, obj.nexus_password))
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus at" + url)
return
print(resp.content.decode("utf-8"))
@@ -277,7 +278,7 @@ def fetch_transactions(obj, account_name):
try:
resp = post(url, auth = auth.HTTPBasicAuth(obj.nexus_user_id,
obj.nexus_password))
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus " + url)
return
print(resp.content.decode("utf-8"))
@@ -289,7 +290,7 @@ def transactions(obj, account_name):
try:
resp = get(url, auth = auth.HTTPBasicAuth(obj.nexus_user_id,
obj.nexus_password))
except Exception:
- print("Could not reach nexus")
+ print("Could not reach nexus " + url)
return
print(resp.content.decode("utf-8"))
diff --git a/cli/setup-template.sh b/cli/setup-template.sh
index ddddbc6..a0bc4f8 100755
--- a/cli/setup-template.sh
+++ b/cli/setup-template.sh
@@ -3,8 +3,9 @@
# Such template sets an env up using the Python CLI.
# The setup goes until exchanging keys with the sandbox.
-set -e
+set -eu
+SANDBOX_URL="http://localhost:5000"
EBICS_HOST_ID=ebicshost
EBICS_PARTNER_ID=ebicspartner
EBICS_USER_ID=ebicsuser
@@ -24,6 +25,10 @@ if test -z $1; then
exit 1
fi
+export NEXUS_BASE_URL="http://localhost:5001/"
+export NEXUS_USERNAME=$NEXUS_USER
+export NEXUS_PASSWORD=$NEXUS_PASSWORD
+
########## setup sandbox #############
# make ebics host at sandbox
@@ -73,22 +78,14 @@ echo Creating a bank connection for such user
./libeufin-cli \
connections \
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 > /dev/null
+ $NEXUS_BANK_CONNECTION_NAME > /dev/null
sleep 2
# Bootstrapping such connection
echo Bootstrapping the bank connection
./libeufin-cli \
- connections \
- bootstrap-connection \
- --connection-name $NEXUS_BANK_CONNECTION_NAME \
- --nexus-user-id $NEXUS_USER \
- --nexus-password $NEXUS_PASSWORD \
- $NEXUS_URL > /dev/null
+ connections sync $NEXUS_BANK_CONNECTION_NAME > /dev/null
--
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: address #6257,
gnunet <=