gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: differentiate connection type


From: gnunet
Subject: [libeufin] branch master updated: differentiate connection type
Date: Sun, 24 May 2020 12:49:08 +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 891efae  differentiate connection type
891efae is described below

commit 891efae8b0e67edc11b8634f75b4d6acd4e45c5e
Author: Florian Dold <address@hidden>
AuthorDate: Sun May 24 16:19:02 2020 +0530

    differentiate connection type
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 38 ++++++++++++-----------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index e36ae96..242c5f0 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -592,29 +592,31 @@ fun serverMain() {
                     val user = authenticateRequest(call.request)
                     when (body) {
                         is CreateBankConnectionFromBackupRequestJson -> {
-                            createEbicsBankConnectionFromBackup(body.name, 
user, body.passphrase, body.data)
+                            val type = body.data.get("type")
+                            if (type == null || !type.isTextual()) {
+                                throw NexusError(HttpStatusCode.BadRequest, 
"backup needs type")
+                            }
+                            when (type.textValue()) {
+                                "ebics" -> {
+                                    
createEbicsBankConnectionFromBackup(body.name, user, body.passphrase, body.data)
+                                }
+                                else -> {
+                                    throw 
NexusError(HttpStatusCode.BadRequest, "backup type not supported")
+                                }
+                            }
                         }
                         is CreateBankConnectionFromNewRequestJson -> {
-                            createEbicsBankConnection(body.name, user, 
body.data)
+                            when (body.type) {
+                                "ebics" -> {
+                                    createEbicsBankConnection(body.name, user, 
body.data)
+                                }
+                                else -> {
+                                    throw 
NexusError(HttpStatusCode.BadRequest, "connection type not supported")
+                                }
+                            }
                         }
                     }
                 }
-//                val bankConnectionName = body.name
-//                val bankConnectionType = body.get("type").textValue()
-//                transaction {
-//                    val user = authenticateRequest(call.request)
-//                    when (bankConnectionType) {
-//                        "ebics" -> {
-//                            createEbicsBankConnection(bankConnectionName, 
user, body)
-//                        }
-//                        else -> {
-//                            throw NexusError(
-//                                HttpStatusCode.BadRequest,
-//                                "Invalid bank connection type 
'${bankConnectionType}'"
-//                            )
-//                        }
-//                    }
-//                }
                 call.respond(object {})
             }
 

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



reply via email to

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