commit cbe4ce3f2853b4113d0550396a9b37b3bdc7bec2
parent 65e3e08d705ef2a8b82e6b6f3d1da09a24ff75b7
Author: MS <ms@taler.net>
Date: Sat, 7 Jan 2023 14:03:47 +0100
Tests.
Testing that some pain.001-valid amounts
are still rejected after the XML validation.
That happens because pain.001 allows more
than 2 fractional digits, whereas Taler has a
limit of 2.
Diffstat:
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git 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() {