libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 923b242021397f14011e9d5abab8a5519361cd2d
parent 106c02fbf8c55376ac94575854de8c0134c387cb
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Mon, 18 Nov 2019 19:34:55 +0100

get TST message to validate

Diffstat:
Mnexus/src/main/kotlin/Main.kt | 49+++++++++++++++++++++++++++----------------------
Msandbox/src/main/kotlin/tech/libeufin/sandbox/XMLUtil.kt | 2+-
2 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt @@ -667,7 +667,7 @@ fun main() { return@post } - post("/ebics/subscribers/{id}/sync") { + post("/ebics/subscribers/{id}/sendTst") { val id = expectId(call.parameters["id"]) val (url, doc) = transaction { @@ -713,6 +713,7 @@ fun main() { orderDetails = EbicsRequest.OrderDetails().apply { orderType = "TST" orderAttribute = "OZHNN" + orderParams = EbicsRequest.StandardOrderParams() } bankPubKeyDigests = EbicsRequest.BankPubKeyDigests().apply { authentication = EbicsTypes.PubKeyDigest().apply { @@ -727,38 +728,35 @@ fun main() { version = "E002" value = CryptoUtil.getEbicsPublicKeyHash( CryptoUtil.loadRsaPublicKey(subscriber.bankEncryptionPublicKey!!.toByteArray()) - ) } } securityMedium = "0000" numSegments = BigInteger.ONE - - authSignature = SignatureType() } mutable = EbicsRequest.MutableHeader().apply { transactionPhase = EbicsTypes.TransactionPhaseType.INITIALISATION } - body = EbicsRequest.Body().apply { - dataTransfer = EbicsRequest.DataTransfer().apply { - signatureData = EbicsRequest.SignatureData().apply { - authenticate = true - value = usd_encrypted.encryptedData - } - dataEncryptionInfo = EbicsTypes.DataEncryptionInfo().apply { - transactionKey = usd_encrypted.encryptedTransactionKey - authenticate = true - encryptionPubKeyDigest = EbicsTypes.PubKeyDigest().apply { - algorithm = "http://www.w3.org/2001/04/xmlenc#sha256" - version = "E002" - value = CryptoUtil.getEbicsPublicKeyHash( - CryptoUtil.loadRsaPublicKey( - subscriber.bankEncryptionPublicKey!!.toByteArray() - ) + } + authSignature = SignatureType() + body = EbicsRequest.Body().apply { + dataTransfer = EbicsRequest.DataTransfer().apply { + signatureData = EbicsRequest.SignatureData().apply { + authenticate = true + value = usd_encrypted.encryptedData + } + dataEncryptionInfo = EbicsTypes.DataEncryptionInfo().apply { + transactionKey = usd_encrypted.encryptedTransactionKey + authenticate = true + encryptionPubKeyDigest = EbicsTypes.PubKeyDigest().apply { + algorithm = "http://www.w3.org/2001/04/xmlenc#sha256" + version = "E002" + value = CryptoUtil.getEbicsPublicKeyHash( + CryptoUtil.loadRsaPublicKey( + subscriber.bankEncryptionPublicKey!!.toByteArray() ) - } + ) } - hostId = subscriber.hostID } } } @@ -773,6 +771,13 @@ fun main() { } // send document here + val response = client.postToBank<EbicsResponse>(url, doc) + + call.respondText( + "not implemented\n", + ContentType.Text.Plain, + HttpStatusCode.OK + ) } post("/ebics/subscribers/{id}/sync") { diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/XMLUtil.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/XMLUtil.kt @@ -161,7 +161,7 @@ class XMLUtil private constructor() { try { getEbicsValidator().validate(xmlDoc) } catch (e: Exception) { - logger.warn("Validation failed: {}", e) + logger.warn("Validation failed: ${e}") return false } return true;