commit 284324a03b49ad69ce01792364ea1d9edc76d096
parent 891efae8b0e67edc11b8634f75b4d6acd4e45c5e
Author: Florian Dold <florian.dold@gmail.com>
Date: Sun, 24 May 2020 16:38:48 +0530
allow empty body
Diffstat:
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
@@ -109,6 +109,8 @@ data class EbicsHostTestRequest(
* the client must provide the passphrase.
*/
data class EbicsKeysBackupJson(
+ // Always "ebics"
+ val type: String,
val userID: String,
val partnerID: String,
val hostID: String,
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -44,10 +44,7 @@ import io.ktor.features.StatusPages
import io.ktor.http.ContentType
import io.ktor.http.HttpStatusCode
import io.ktor.jackson.jackson
-import io.ktor.request.ApplicationReceivePipeline
-import io.ktor.request.ApplicationReceiveRequest
-import io.ktor.request.receive
-import io.ktor.request.uri
+import io.ktor.request.*
import io.ktor.response.respond
import io.ktor.response.respondText
import io.ktor.routing.get
@@ -630,6 +627,10 @@ fun serverMain() {
call.respond(BankConnectionsList(connList))
}
+ post("/bank-connections/{connid}/backup") {
+ throw NotImplementedError()
+ }
+
post("/bank-connections/{connid}/connect") {
throw NotImplementedError()
}
@@ -735,8 +736,12 @@ fun serverMain() {
if (orderType.length != 3) {
throw NexusError(HttpStatusCode.BadRequest, "ebics order type must be three characters")
}
- val paramsJson = call.receive<EbicsStandardOrderParamsJson>()
- val orderParams = paramsJson.toOrderParams()
+ val paramsJson = call.receiveOrNull<EbicsStandardOrderParamsJson>()
+ val orderParams = if (paramsJson == null) {
+ EbicsStandardOrderParams()
+ } else {
+ paramsJson.toOrderParams()
+ }
val subscriberDetails = transaction {
val user = authenticateRequest(call.request)
val conn = requireBankConnection(call, "connid")