gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: responding to /sendIni (nexus)


From: gnunet
Subject: [libeufin] branch master updated: responding to /sendIni (nexus)
Date: Wed, 06 Nov 2019 12:31:57 +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 9d0ea4a  responding to /sendIni (nexus)
9d0ea4a is described below

commit 9d0ea4ac586ef68ccf63269bcf11c2aa04bf866c
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Nov 6 12:31:51 2019 +0100

    responding to /sendIni (nexus)
---
 nexus/src/main/kotlin/Main.kt                      | 28 ++++++++++++----------
 .../src/main/kotlin/tech/libeufin/sandbox/Main.kt  |  1 -
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt
index 44eee74..9411fdc 100644
--- a/nexus/src/main/kotlin/Main.kt
+++ b/nexus/src/main/kotlin/Main.kt
@@ -45,6 +45,7 @@ import io.ktor.server.netty.Netty
 import org.jetbrains.exposed.sql.transactions.transaction
 import org.slf4j.LoggerFactory
 import tech.libeufin.sandbox.*
+import tech.libeufin.schema.ebics_h004.EbicsKeyManagementResponse
 import tech.libeufin.schema.ebics_h004.EbicsUnsecuredRequest
 import tech.libeufin.schema.ebics_s001.PubKeyValueType
 import tech.libeufin.schema.ebics_s001.SignaturePubKeyInfoType
@@ -147,7 +148,6 @@ fun main() {
             }
 
             post("/ebics/subscribers/{id}/sendIni") {
-                // empty body for now..?
                 val id = try {
                     call.parameters["id"]!!.toInt()
 
@@ -238,18 +238,22 @@ fun main() {
                     return@post
                 }
 
-                /**
-                 * TODO: check response status code,
-                 * and act accordingly when it differs from 200.
-                 */
-
-                // works: val responseJaxb = 
XMLUtil.convertStringToJaxb<EbicsKeyManagementResponse>(response)
+                val responseJaxb = 
XMLUtil.convertStringToJaxb<EbicsKeyManagementResponse>(response)
+                val returnCode = responseJaxb.value.body.returnCode.value
+                if (returnCode == "000000") {
+                    call.respond(
+                        HttpStatusCode.OK,
+                        NexusError("Sandbox accepted the key.")
+                    )
+                    return@post
+                } else {
 
-                call.respond(
-                    HttpStatusCode.OK,
-                    NexusError("Sandbox responded.")
-                )
-                return@post
+                    call.respond(
+                        HttpStatusCode.OK,
+                        NexusError("Sandbox did not accepted the key.  Error 
code: ${returnCode}")
+                    )
+                    return@post
+                }
             }
 
             post("/nexus") {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 7686401..c4d4b6a 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -353,7 +353,6 @@ private suspend fun ApplicationCall.ebicsweb() {
     }
 }
 
-
 fun main() {
     dbCreateTables()
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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