commit 79d30b9873cd5db3693b61eaa39f5530aff4704f
parent bb19654bb584d8abb4eb94b4c6ee0cdf6437a5e7
Author: MS <ms@taler.net>
Date: Thu, 30 Jul 2020 16:26:06 +0200
fix attributes setting/getting
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -61,6 +61,8 @@ import java.util.*
import java.util.zip.DeflaterInputStream
import java.util.zip.InflaterInputStream
+val EbicsHostIdAttribute = AttributeKey<String>("RequestedEbicsHostID")
+
data class PainParseResult(
val creditorIban: String,
val creditorName: String,
@@ -790,7 +792,7 @@ private suspend fun ApplicationCall.receiveEbicsXml(): Document {
}
val requestedHostID = requestDocument.getElementsByTagName("HostID")
this.attributes.put(
- AttributeKey<String>("RequestedEbicsHostID"),
+ EbicsHostIdAttribute,
requestedHostID.item(0).textContent
)
return requestDocument
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -193,8 +193,7 @@ fun serverMain(dbName: String) {
val hostAuthPriv = transaction {
val host = EbicsHostEntity.find {
- EbicsHostsTable.hostID.upperCase() eq
- call.attributes.get<String>(AttributeKey("EbicsHostID")).toUpperCase()
+ EbicsHostsTable.hostID.upperCase() eq call.attributes.get(EbicsHostIdAttribute).toUpperCase()
}.firstOrNull() ?: throw SandboxError(
HttpStatusCode.InternalServerError,
"Requested Ebics host ID not found."