gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Use EBICS_PROCESSING_ERROR as "Interna


From: gnunet
Subject: [libeufin] branch master updated: Use EBICS_PROCESSING_ERROR as "Internal server error".
Date: Tue, 31 Aug 2021 12:19:51 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 67e593c  Use EBICS_PROCESSING_ERROR as "Internal server error".
67e593c is described below

commit 67e593cafdcaabdaa78ac80d6241f7065c637d47
Author: MS <ms@taler.net>
AuthorDate: Mon Aug 30 23:19:28 2021 -1100

    Use EBICS_PROCESSING_ERROR as "Internal server error".
---
 .../tech/libeufin/sandbox/EbicsProtocolBackend.kt  | 26 ++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 8c2c7fc..e10af80 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -103,6 +103,16 @@ private class EbicsUnsupportedOrderType : 
EbicsRequestError(
     "091005"
 )
 
+/**
+ * Used here also for "Internal server error".  For example, when the
+ * sandbox itself generates a invalid XML response.  Strictly, this error
+ * should only be used for _business_ related problems.
+ */
+private class EbicsProcessingError(detail: String) : EbicsRequestError(
+    "[EBICS_PROCESSING_ERROR] $detail",
+    "091116"
+)
+
 private suspend fun ApplicationCall.respondEbicsKeyManagement(
     errorText: String,
     errorCode: String,
@@ -637,14 +647,22 @@ private fun handleCct(paymentRequest: String) {
 
 private fun handleEbicsC53(requestContext: RequestContext): ByteArray {
     logger.debug("Handling C53 request")
+
+    /**
+     * By multiple statements, this function is responsible to return
+     * a list of Strings: one for each statement.
+     */
     val camt = constructCamtResponse(
         53,
         requestContext.subscriber
     )
-   if (!XMLUtil.validateFromString(camt)) throw SandboxError(
-            HttpStatusCode.InternalServerError,
-            "CAMT document was generated invalid"
+   if (!XMLUtil.validateFromString(camt)) throw EbicsProcessingError(
+       "Sandbox generated a invalid XML response."
    )
+    /**
+     * Here, the list of strings will be converted to list of
+     * ByteArray and passed to the zip() method.
+     */
     return listOf(camt.toByteArray(Charsets.UTF_8)).zip()
 }
 
@@ -977,7 +995,7 @@ private fun 
handleEbicsDownloadTransactionInitialization(requestContext: Request
         "HTD" -> handleEbicsHtd(requestContext)
         "HKD" -> handleEbicsHkd(requestContext)
         "C53" -> handleEbicsC53(requestContext)
-        "C52" -> throw EbicsUnsupportedOrderType()
+        "C52" -> throw EbicsUnsupportedOrderType() // TBD
         "TSD" -> handleEbicsTSD()
         "PTK" -> handleEbicsPTK()
         else -> throw EbicsInvalidXmlError()

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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