gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Get CAMT.053 validation test to pass.


From: gnunet
Subject: [libeufin] branch master updated: Get CAMT.053 validation test to pass.
Date: Tue, 07 Jul 2020 17:50:44 +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 574db78  Get CAMT.053 validation test to pass.
574db78 is described below

commit 574db786cd75b055df6e633aaac58dbd6355dadb
Author: MS <ms@taler.net>
AuthorDate: Tue Jul 7 17:48:54 2020 +0200

    Get CAMT.053 validation test to pass.
---
 .../tech/libeufin/sandbox/EbicsProtocolBackend.kt  | 15 ++++------
 sandbox/src/test/kotlin/CamtTest.kt                | 33 ++++++++++++++++++++++
 util/src/main/kotlin/JSON.kt                       |  6 ++--
 util/src/main/kotlin/XMLUtil.kt                    |  8 +++++-
 4 files changed, 49 insertions(+), 13 deletions(-)

diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 37d3611..9e4a2bb 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -212,9 +212,6 @@ fun buildCamtString(type: Int, subscriberIban: String, 
history: MutableList<RawP
                                     text("Debitor/Owner Name")
                                 }
                                 element("Svcr/FinInstnId") {
-                                    element("BIC") {
-                                        text("Owner Bic")
-                                    }
                                     element("Nm") {
                                         text("Libeufin Bank")
                                     }
@@ -242,7 +239,9 @@ fun buildCamtString(type: Int, subscriberIban: String, 
history: MutableList<RawP
                                     text(Amount(0).toPlainString())
                                 }
                                 element("CdtDbtInd") {
-                                    text("UNUSED")
+                                    // a temporary value to get the camt to 
validate.
+                                    // Should be fixed along #6269
+                                    text("CRDT")
                                 }
                                 element("Dt/Dt") {
                                     // date of this balance
@@ -261,8 +260,9 @@ fun buildCamtString(type: Int, subscriberIban: String, 
history: MutableList<RawP
                                     text(Amount(0).toPlainString())
                                 }
                                 element("CdtDbtInd") {
-                                    // CRDT or DBIT here
-                                    text("UNUSED")
+                                    // a temporary value to get the camt to 
validate.
+                                    // Should be fixed along #6269
+                                    text("DBIT")
                                 }
                                 element("Dt/Dt") {
                                     text(dashedDate)
@@ -396,9 +396,6 @@ fun buildCamtString(type: Int, subscriberIban: String, 
history: MutableList<RawP
                                     element("RmtInf/Ustrd") {
                                         text(it.subject)
                                     }
-                                    element("AddtlNtryInf") {
-                                        text("additional information not 
given")
-                                    }
                                 }
                             }
                         }
diff --git a/sandbox/src/test/kotlin/CamtTest.kt 
b/sandbox/src/test/kotlin/CamtTest.kt
new file mode 100644
index 0000000..b2f34a8
--- /dev/null
+++ b/sandbox/src/test/kotlin/CamtTest.kt
@@ -0,0 +1,33 @@
+import org.junit.Test
+import tech.libeufin.sandbox.buildCamtString
+import tech.libeufin.util.RawPayment
+import tech.libeufin.util.XMLUtil
+import kotlin.test.assertTrue
+
+class CamtTest {
+
+    @Test
+    fun camtTest() {
+        val payment = RawPayment(
+            creditorIban = "GB33BUKB20201222222222",
+            creditorName = "Oliver Smith",
+            creditorBic = "BUKBGB33",
+            debitorIban = "GB33BUKB20201333333333",
+            debitorName = "John Doe",
+            debitorBic = "BUKBGB33",
+            amount = "2",
+            currency = "EUR",
+            subject = "reimbursement",
+            date = "1000-02-02",
+            uid = 0
+        )
+        val xml = buildCamtString(
+            53,
+            "GB33BUKB20201222222222",
+            mutableListOf(payment)
+        )
+        assertTrue {
+            XMLUtil.validateFromString(xml.get(0))
+        }
+    }
+}
\ No newline at end of file
diff --git a/util/src/main/kotlin/JSON.kt b/util/src/main/kotlin/JSON.kt
index 02a977d..288df46 100644
--- a/util/src/main/kotlin/JSON.kt
+++ b/util/src/main/kotlin/JSON.kt
@@ -26,14 +26,14 @@ package tech.libeufin.util
  */
 data class RawPayment(
     val creditorIban: String,
-    val creditorBic: String?,
+    val creditorBic: String? = null,
     val creditorName: String,
     val debitorIban: String,
-    val debitorBic: String?,
+    val debitorBic: String? = null,
     val debitorName: String,
     val amount: String,
     val currency: String,
     val subject: String,
-    val date: String?,
+    val date: String? = null,
     val uid: Int? = null
 )
\ No newline at end of file
diff --git a/util/src/main/kotlin/XMLUtil.kt b/util/src/main/kotlin/XMLUtil.kt
index e8f626f..816571f 100644
--- a/util/src/main/kotlin/XMLUtil.kt
+++ b/util/src/main/kotlin/XMLUtil.kt
@@ -153,7 +153,13 @@ class XMLUtil private constructor() {
                     return DOMInputImpl(publicId, systemId, baseUri, res, 
"UTF-8")
                 }
             }
-            val schemaInputs: Array<Source> = listOf("xsd/ebics_H004.xsd", 
"xsd/ebics_hev.xsd").map {
+            val schemaInputs: Array<Source> = listOf(
+                "xsd/ebics_H004.xsd",
+                "xsd/ebics_hev.xsd",
+                "xsd/camt.052.001.02.xsd",
+                "xsd/camt.053.001.02.xsd",
+                "xsd/camt.054.001.02.xsd"
+            ).map {
                 val stream =
                     classLoader.getResourceAsStream(it) ?: throw 
FileNotFoundException("Schema file $it not found.")
                 StreamSource(stream)

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