[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Fetching bank accounts goes in a dedic
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Fetching bank accounts goes in a dedicated function. |
Date: |
Thu, 13 Feb 2020 16:42:15 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new b1732c2 Fetching bank accounts goes in a dedicated function.
b1732c2 is described below
commit b1732c28fd7e41b50442090d3cd0be6241dc81f5
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 13 16:41:01 2020 +0100
Fetching bank accounts goes in a dedicated function.
---
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 52 +++++++++++++++++------
sandbox/src/main/python/libeufin-cli | 4 +-
2 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index b795584..8247511 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -468,20 +468,6 @@ fun main() {
val response = doEbicsDownloadTransaction(client,
subscriberData, "HTD", orderParams)
when (response) {
is EbicsDownloadSuccessResult -> {
- val payload =
XMLUtil.convertStringToJaxb<HTDResponseOrderData>(response.orderData.toString(Charsets.UTF_8))
- transaction {
- payload.value.partnerInfo.accountInfoList?.forEach
{
- EbicsAccountInfoEntity.new {
- this.subscriber =
getSubscriberEntityFromId(customerIdAtNexus)
- accountId = it.id
- accountHolder = it.accountHolder
- /* FIXME: how to figure out whether that's
a general or national account number?
- * This should affect the cast below */
- iban = (it.accountNumberList?.get(0) as
EbicsTypes.GeneralAccountNumber).value // FIXME: eventually get *all* of them
- bankCode = (it.bankCodeList?.get(0) as
EbicsTypes.GeneralBankCode).value // FIXME: eventually get *all* of them
- }
- }
- }
call.respondText(
response.orderData.toString(Charsets.UTF_8),
ContentType.Text.Plain,
@@ -966,6 +952,44 @@ fun main() {
)
}
+ post("/ebics/subscribers/{id}/fetch-accounts") {
+ val customerIdAtNexus = expectId(call.parameters["id"])
+ val paramsJson = call.receive<EbicsStandardOrderParamsJson>()
+ val orderParams = paramsJson.toOrderParams()
+ val subscriberData =
getSubscriberDetailsFromId(customerIdAtNexus)
+ val response = doEbicsDownloadTransaction(client,
subscriberData, "HTD", orderParams)
+ when (response) {
+ is EbicsDownloadSuccessResult -> {
+ val payload =
XMLUtil.convertStringToJaxb<HTDResponseOrderData>(response.orderData.toString(Charsets.UTF_8))
+ transaction {
+ payload.value.partnerInfo.accountInfoList?.forEach
{
+ EbicsAccountInfoEntity.new {
+ this.subscriber =
getSubscriberEntityFromId(customerIdAtNexus)
+ accountId = it.id
+ accountHolder = it.accountHolder
+ /* FIXME: how to figure out whether that's
a general or national account number?
+ * This should affect the cast below */
+ iban = (it.accountNumberList?.get(0) as
EbicsTypes.GeneralAccountNumber).value // FIXME: eventually get *all* of them
+ bankCode = (it.bankCodeList?.get(0) as
EbicsTypes.GeneralBankCode).value // FIXME: eventually get *all* of them
+ }
+ }
+ }
+ call.respondText(
+ response.orderData.toString(Charsets.UTF_8),
+ ContentType.Text.Plain,
+ HttpStatusCode.OK
+ )
+ }
+ is EbicsDownloadBankErrorResult -> {
+ call.respond(
+ HttpStatusCode.BadGateway,
+ EbicsErrorJson(EbicsErrorDetailJson("bankError",
response.returnCode.errorCode))
+ )
+ }
+ }
+ return@post
+ }
+
/* performs a keys backup */
post("/ebics/subscribers/{id}/backup") {
val id = expectId(call.parameters["id"])
diff --git a/sandbox/src/main/python/libeufin-cli
b/sandbox/src/main/python/libeufin-cli
index 282e35a..e90c8a2 100755
--- a/sandbox/src/main/python/libeufin-cli
+++ b/sandbox/src/main/python/libeufin-cli
@@ -585,12 +585,12 @@ def prepare(ctx, account_id, nexus_base_url):
@click.argument(
"nexus-base-url"
)
-def htd(ctx, account_id, prepare, nexus_base_url):
+def fetch_accounts(ctx, account_id, prepare, nexus_base_url):
if prepare:
ctx.invoke(ini)
ctx.invoke(hia)
ctx.invoke(sync)
- url = urljoin(nexus_base_url,
"/ebics/subscribers/{}/sendHtd".format(account_id))
+ url = urljoin(nexus_base_url,
"/ebics/subscribers/{}/fetch-accounts".format(account_id))
try:
resp = post(url, json=dict())
except Exception:
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Fetching bank accounts goes in a dedicated function.,
gnunet <=