commit a36f42a1ebfd2ea3e4ff325742fa9b1020852266
parent 31848283c03c1ad2bc0fdb0c473eb739ca688193
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date: Fri, 8 Nov 2019 13:24:49 +0100
python tool calls /ebics/subscribers now.
Diffstat:
2 files changed, 54 insertions(+), 3 deletions(-)
diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt
@@ -248,9 +248,10 @@ fun main() {
}.id.value
}
- call.respond(
- HttpStatusCode.OK,
- EbicsSubscriberInfoResponse(id)
+ call.respondText(
+ "Subscriber registered, ID: ${id}",
+ ContentType.Text.Plain,
+ HttpStatusCode.OK
)
return@post
}
diff --git a/sandbox/src/main/python/libeufin-cli b/sandbox/src/main/python/libeufin-cli
@@ -76,4 +76,54 @@ def sync(obj, customer_id):
print(resp.content.decode("utf-8"))
+
+@ebics.command(help="insert new subscriber into Nexus")
+@click.pass_obj
+@click.option(
+ "--ebics-url",
+ help="URL of the EBICS server (defaults to http://localhost:5001/)",
+ required=False,
+ default="http://localhost:5001"
+)
+@click.option(
+ "--user-id",
+ help="ID of the user to add in the system" ,
+ required=True
+)
+@click.option(
+ "--partner-id",
+ help="ID of the partner associated with the user" ,
+ required=True
+)
+@click.option(
+ "--system-id",
+ help="ID of the software acting on behalf of this user" ,
+ required=False
+)
+@click.option(
+ "--host-id",
+ help="ID of the EBICS server" ,
+ required=True
+)
+def new(obj, user_id, partner_id, system_id, host_id, ebics_url):
+
+ url = urljoin(obj["base_url"], "/ebics/subscribers")
+ body = json=dict(
+ ebicsURL=ebics_url,
+ userID=user_id,
+ partnerID=partner_id,
+ hostID=host_id
+ )
+
+ if system_id:
+ body.update(system_id)
+
+ try:
+ resp = post(url, json=body)
+ except Exception:
+ print("Could not reach the bank")
+ return
+
+ print(resp.content.decode("utf-8"))
+
cli()