gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: helper function to generate XML error


From: gnunet
Subject: [libeufin] branch master updated: helper function to generate XML error responses
Date: Thu, 23 Jul 2020 11:18:09 +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 d39dc0a  helper function to generate XML error responses
d39dc0a is described below

commit d39dc0a08537d31ccc6dbd2b8e59c4db4530c571
Author: MS <ms@taler.net>
AuthorDate: Thu Jul 23 11:17:47 2020 +0200

    helper function to generate XML error responses
---
 .../tech/libeufin/sandbox/EbicsProtocolBackend.kt  |  2 +-
 util/src/main/kotlin/ebics_h004/EbicsResponse.kt   | 27 +++++++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 6a9d0d5..0635ae7 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -932,7 +932,7 @@ private fun 
handleEbicsDownloadTransactionInitialization(requestContext: Request
         "HKD" -> handleEbicsHkd(requestContext)
         /* Temporarily handling C52/C53 with same logic */
         "C53" -> handleEbicsC53(requestContext)
-        "C52" -> handleEbicsC53(requestContext)
+        "C52" -> handleEbicsC53(requestContext) // why?
         "TSD" -> handleEbicsTSD(requestContext)
         "PTK" -> handleEbicsPTK(requestContext)
         else -> throw EbicsInvalidXmlError()
diff --git a/util/src/main/kotlin/ebics_h004/EbicsResponse.kt 
b/util/src/main/kotlin/ebics_h004/EbicsResponse.kt
index c31f62e..1e1bbeb 100644
--- a/util/src/main/kotlin/ebics_h004/EbicsResponse.kt
+++ b/util/src/main/kotlin/ebics_h004/EbicsResponse.kt
@@ -2,6 +2,7 @@ package tech.libeufin.util.ebics_h004
 
 import org.apache.xml.security.binding.xmldsig.SignatureType
 import tech.libeufin.util.CryptoUtil
+import tech.libeufin.util.XMLUtil
 import java.math.BigInteger
 import javax.xml.bind.annotation.*
 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter
@@ -124,6 +125,31 @@ class EbicsResponse {
     }
 
     companion object {
+
+        fun createForUploadWithError(
+            errorText: String, errorCode: String, phase: 
EbicsTypes.TransactionPhaseType
+        ): EbicsResponse {
+            val resp = EbicsResponse().apply {
+                this.version = "H004"
+                this.revision = 1
+                this.header = EbicsResponse.Header().apply {
+                    this.mutable = EbicsResponse.MutableHeaderType().apply {
+                        this.reportText = errorText
+                        this.returnCode = errorCode
+                        this.transactionPhase = phase
+                    }
+                    _static = EbicsResponse.StaticHeaderType()
+                }
+                this.authSignature = SignatureType()
+                this.body = EbicsResponse.Body().apply {
+                    this.returnCode = EbicsResponse.ReturnCode().apply {
+                        this.value = errorCode
+                    }
+                }
+            }
+            return resp
+        }
+
         fun createForUploadInitializationPhase(transactionID: String, orderID: 
String): EbicsResponse {
             return EbicsResponse().apply {
                 this.version = "H004"
@@ -182,7 +208,6 @@ class EbicsResponse {
             }
         }
 
-
         fun createForUploadTransferPhase(
             transactionID: String,
             segmentNumber: Int,

-- 
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]