commit 35f5f8318b1395bdaf705d4ce2b0833cb645af19
parent 1d4f7c73677ccd029b7c5be91c45a254a569901c
Author: Florian Dold <florian.dold@gmail.com>
Date: Wed, 25 Mar 2020 18:03:26 +0530
add raw CRZ query
Diffstat:
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/cli/python/libeufin-cli b/cli/python/libeufin-cli
@@ -397,6 +397,30 @@ def c52(obj, account_id, date_range, nexus_base_url):
resp = post(url, json=req)
print(resp.content.decode("utf-8"))
+@ebics.command(help="Send CRZ message")
+@click.pass_obj
+@click.option(
+ "--account-id",
+ help="Numerical ID of the customer at the Nexus",
+ required=True
+)
+@click.option(
+ "--date-range",
+ help="Date range for the query",
+ nargs=2,
+ required=False,
+)
+@click.argument(
+ "nexus-base-url"
+)
+def crz(obj, account_id, date_range, nexus_base_url):
+ if date_range is not None and len(date_range) == 2:
+ req = dict(dateRange=dict(start=date_range[0], end=date_range[1]))
+ else:
+ req = dict()
+ url = urljoin(nexus_base_url, "/ebics/subscribers/{}/sendCRZ".format(account_id))
+ resp = post(url, json=req)
+ print(resp.content.decode("utf-8"))
@ebics.command(help="Send C53 message")
@click.pass_obj
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -661,6 +661,29 @@ fun main() {
}
}
+ post("/ebics/subscribers/{id}/sendCRZ") {
+ val id = expectId(call.parameters["id"])
+ val paramsJson = call.receive<EbicsStandardOrderParamsJson>()
+ val orderParams = paramsJson.toOrderParams()
+ val subscriberData = getSubscriberDetailsFromId(id)
+ val response = doEbicsDownloadTransaction(client, subscriberData, "CRZ", orderParams)
+ when (response) {
+ is EbicsDownloadSuccessResult -> {
+ call.respondText(
+ unzipOrderData(response.orderData),
+ ContentType.Text.Plain,
+ HttpStatusCode.OK
+ )
+ }
+ is EbicsDownloadBankErrorResult -> {
+ call.respond(
+ HttpStatusCode.BadGateway,
+ EbicsErrorJson(EbicsErrorDetailJson("bankError", response.returnCode.errorCode))
+ )
+ }
+ }
+ }
+
post("/ebics/subscribers/{id}/sendC53") {
val id = expectId(call.parameters["id"])
val paramsJson = call.receive<EbicsStandardOrderParamsJson>()