gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: ebics/fetch-c52


From: gnunet
Subject: [libeufin] branch master updated: ebics/fetch-c52
Date: Wed, 10 Jun 2020 08:18:48 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new a58a9c2  ebics/fetch-c52
a58a9c2 is described below

commit a58a9c2258d547a280b961436eb330a63230fa1e
Author: Florian Dold <florian.dold@gmail.com>
AuthorDate: Tue Jun 9 12:55:31 2020 +0530

    ebics/fetch-c52
---
 .../src/main/kotlin/tech/libeufin/nexus/Helpers.kt | 14 ++++++++------
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt  | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
index 57a9d25..377c875 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
@@ -210,17 +210,19 @@ suspend fun fetchEbicsC5x(
     val orderParamsJson = EbicsStandardOrderParamsJson(
         EbicsDateRangeJson(start, end)
     )
-    /** More types C52/C54 .. forthcoming */
-    if (historyType != "C53") throw NexusError(
-        HttpStatusCode.InternalServerError,
-        "Ebics query tried on unknown message $historyType"
-    )
     val response = doEbicsDownloadTransaction(
         client,
         subscriberDetails,
         historyType,
         orderParamsJson.toOrderParams()
     )
+    when (historyType) {
+        "C52" -> {}
+        "C53" -> {}
+        else -> {
+            throw NexusError(HttpStatusCode.BadRequest, "history type 
'$historyType' not supported")
+        }
+    }
     when (response) {
         is EbicsDownloadSuccessResult -> {
             response.orderData.unzipWithLambda {
@@ -237,7 +239,7 @@ suspend fun fetchEbicsC5x(
                     if (oldMsg == null) {
                         NexusBankMessageEntity.new {
                             this.bankConnection = conn
-                            this.code = "C53"
+                            this.code = historyType
                             this.messageId = msgId
                             this.message = 
ExposedBlob(it.second.toByteArray(Charsets.UTF_8))
                         }
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 756a9e3..11394ba 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -964,6 +964,28 @@ fun serverMain(dbName: String) {
                 call.respond(object {})
             }
 
+            post("/bank-connections/{connid}/ebics/fetch-c52") {
+                val paramsJson = if (call.request.hasBody()) {
+                    call.receive<EbicsDateRangeJson>()
+                } else {
+                    null
+                }
+                val ret = transaction {
+                    val user = authenticateRequest(call.request)
+                    val conn = requireBankConnection(call, "connid")
+                    if (conn.type != "ebics") {
+                        throw NexusError(HttpStatusCode.BadRequest, "bank 
connection is not of type 'ebics'")
+                    }
+                    object {
+                        val subscriber = 
getEbicsSubscriberDetails(user.id.value, conn.id.value)
+                        val connId = conn.id.value
+                    }
+
+                }
+                fetchEbicsC5x("C52", client, ret.connId, paramsJson?.start, 
paramsJson?.end, ret.subscriber)
+                call.respond(object {})
+            }
+
             post("/bank-connections/{connid}/ebics/send-ini") {
                 val subscriber = transaction {
                     val user = authenticateRequest(call.request)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]