libeufin

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

commit 870d3e29f78397f73a9515febfa1088ebb121f3f
parent dcc9d141fa47be6aceeffb23b95a4a0ae3914c01
Author: MS <ms@taler.net>
Date:   Fri,  6 Jan 2023 18:44:18 +0100

Nexus error handling.

Log, and respond the full EBICS report text
(received from the bank) to the client.

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt | 6+++---
Mutil/src/main/kotlin/Ebics.kt | 6+++++-
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsClient.kt @@ -255,9 +255,9 @@ suspend fun doEbicsUploadTransaction( * bank rejecting the operation instead of it * detecting the problem. */ - HttpStatusCode.InternalServerError, - "Unexpected EBICS technical return code: ${txResp.technicalReturnCode}", - txResp.technicalReturnCode + httpStatusCode = HttpStatusCode.InternalServerError, + reason = txResp.reportText, + ebicsTechnicalCode = txResp.technicalReturnCode ) } } diff --git a/util/src/main/kotlin/Ebics.kt b/util/src/main/kotlin/Ebics.kt @@ -47,7 +47,7 @@ data class EbicsProtocolError( val httpStatusCode: HttpStatusCode, val reason: String, /** - * This error type is also used when Nexus finds itself + * This class is also used when Nexus finds itself * in an inconsistent state, without interacting with the * bank. In this case, the EBICS code below can be left * null. @@ -386,6 +386,7 @@ data class EbicsResponseContent( val orderDataEncChunk: String?, val technicalReturnCode: EbicsReturnCode, val bankReturnCode: EbicsReturnCode, + val reportText: String, val segmentNumber: Int?, // Only present in init phase val numSegments: Int? @@ -496,6 +497,8 @@ fun parseAndValidateEbicsResponse( val techReturnCodeStr = resp.value.header.mutable.returnCode val techReturnCode = EbicsReturnCode.lookup(techReturnCodeStr) + val reportText = resp.value.header.mutable.reportText + val daeXml = resp.value.body.dataTransfer?.dataEncryptionInfo val dataEncryptionInfo = if (daeXml == null) { null @@ -507,6 +510,7 @@ fun parseAndValidateEbicsResponse( transactionID = resp.value.header._static.transactionID, bankReturnCode = bankReturnCode, technicalReturnCode = techReturnCode, + reportText = reportText, orderDataEncChunk = resp.value.body.dataTransfer?.orderData?.value, dataEncryptionInfo = dataEncryptionInfo, numSegments = resp.value.header._static.numSegments?.toInt(),