gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (7dfef458 -> cbe4ce3f)


From: gnunet
Subject: [libeufin] branch master updated (7dfef458 -> cbe4ce3f)
Date: Sat, 07 Jan 2023 14:07:09 +0100

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

ms pushed a change to branch master
in repository libeufin.

    from 7dfef458 Test debit detection when serving EBICS.
     new 65e3e08d comment
     new cbe4ce3f Tests.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nexus/src/test/kotlin/DownloadAndSubmit.kt         | 28 ++++++++++++++++++++++
 .../tech/libeufin/sandbox/EbicsProtocolBackend.kt  |  5 ++++
 2 files changed, 33 insertions(+)

diff --git a/nexus/src/test/kotlin/DownloadAndSubmit.kt 
b/nexus/src/test/kotlin/DownloadAndSubmit.kt
index 0b8b5914..d656711b 100644
--- a/nexus/src/test/kotlin/DownloadAndSubmit.kt
+++ b/nexus/src/test/kotlin/DownloadAndSubmit.kt
@@ -302,6 +302,34 @@ class DownloadAndSubmit {
         }
     }
 
+    /**
+     * Test that pain.001 amounts ALSO have max 2 fractional digits, like 
Taler's.
+     * That makes Sandbox however NOT completely compatible with the pain.001 
standard,
+     * since this allows up to 5 fractional digits.  */
+    @Test
+    fun testFractionalDigits() {
+        withNexusAndSandboxUser {
+            testApplication {
+                application(sandboxApp)
+                runBlocking {
+                    // Create Pain.001 with excessive amount.
+                    addPaymentInitiation(
+                        Pain001Data(
+                            creditorIban = getIban(),
+                            creditorBic = "SANDBOXX",
+                            creditorName = "Tester",
+                            subject = "test payment",
+                            sum = "1.001", // wrong 3 fractional digits.
+                            currency = "TESTKUDOS"
+                        ),
+                        "foo"
+                    )
+                    assertException<EbicsProtocolError> { 
submitAllPaymentInitiations(client, "foo") }
+                }
+            }
+        }
+    }
+
     // Test the EBICS error message in case of debt threshold being surpassed
     @Test
     fun testDebit() {
diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index c2e235c5..d820f44f 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -677,6 +677,11 @@ private fun parsePain001(paymentRequest: String): 
PainParseResult {
 
                         }
                     }
+                    /**
+                     * NOTE: this check breaks the compatibility with pain.001,
+                     * because that allows up to 5 fractional digits.  For 
Taler
+                     * compatibility however, we enforce the max 2 fractional 
digits policy.
+                     */
                     if (!validatePlainAmount(txDetails.amt.textContent)) {
                         throw EbicsProcessingError(
                             "Amount number malformed: 
${txDetails.amt.textContent}"

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