gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Relaxing the transaction details searc


From: gnunet
Subject: [libeufin] branch master updated: Relaxing the transaction details search.
Date: Mon, 30 Nov 2020 15:48:22 +0100

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 51471a6  Relaxing the transaction details search.
51471a6 is described below

commit 51471a696f205b910070e981a1adaf2523a769cb
Author: MS <ms@taler.net>
AuthorDate: Mon Nov 30 15:42:25 2020 +0100

    Relaxing the transaction details search.
---
 .idea/vcs.xml                                      |  1 +
 .../tech/libeufin/nexus/iso20022/Iso20022.kt       | 36 ++++++++--------------
 2 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 246ffef..c8faf33 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -4,5 +4,6 @@
     <mapping directory="" vcs="Git" />
     <mapping directory="$PROJECT_DIR$/build-common" vcs="Git" />
     <mapping directory="$PROJECT_DIR$/build-system/taler-build-scripts" 
vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/parsing-tests" vcs="Git" />
   </component>
 </project>
\ No newline at end of file
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt
index 7d29821..b3e0be0 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/iso20022/Iso20022.kt
@@ -264,16 +264,9 @@ data class ReturnInfo(
 )
 
 data class BatchTransaction(
-    // We tolerate the lack of amount in case
-    // this batch is a singleton and can inherit by
-    // parent node.
     val amount: CurrencyAmount?,
-
-    // We tolerate the lack of direction, in case all
-    // the sub-transactions can inherit from the parent node.
     val creditDebitIndicator: CreditDebitIndicator?,
-
-    val details: TransactionDetails
+    val details: TransactionDetails?
 )
 
 @JsonInclude(JsonInclude.Include.NON_NULL)
@@ -720,7 +713,7 @@ private fun XmlElementDestructor.extractBatches(
             )
         }
         var amountChecksum: CurrencyAmount? = null
-        val txs = mapEachChildNamed("TxDtls") {
+        var txs = mapEachChildNamed("TxDtls") {
             val details = extractTransactionDetails(outerCreditDebitIndicator)
             val txCreditDebitIndicator = maybeExtractCreditDebitIndicator()
             if (txCreditDebitIndicator != null) {
@@ -733,7 +726,7 @@ private fun XmlElementDestructor.extractBatches(
             if (txAmount == null) {
                 NexusAssert(
                     inheritableBatchAmount != null,
-                    "Missing or inconsistent information about singleton 
sub-transaction(s) amount(s)"
+                    "Missing or inconsistent information about singleton 
sub-transaction(s) amount(s) (0)"
                 )
                 txAmount = inheritableBatchAmount
             }
@@ -746,22 +739,17 @@ private fun XmlElementDestructor.extractBatches(
         }
         if (amountChecksum == null) {
             NexusAssert(
-                numTxs == 0 && txs.isEmpty() && inheritableBatchAmount != null,
-                "Internal amount-check failed (0)"
+                txs.isEmpty(),
+                "Missing or inconsistent information about singleton 
sub-transaction(s) amount(s) (1)"
             )
+            // Without ANY sub-transaction defined, the batch MUST have it 
mentioned ALREADY somewhere "before".
+            NexusAssert(
+                inheritableBatchAmount != null,
+                "Missing or inconsistent information about singleton 
sub-transaction(s) amount(s) (2)"
+            )
+            amountChecksum = batchAmount
             txs = mutableListOf(
-                BatchTransaction(
-                    inheritableBatchAmount,
-                    outerCreditDebitIndicator,
-                    /**
-                     * FIXME: the current "details extractor" assumes that
-                     * only TxDtls can have details, and so it ignores the
-                     * case where ZERO TxDtls are given but such information
-                     * is scattered somewhere between the Ntry and the NtryDtls
-                     * (including the Btch.)
-                     *
-                     */
-                )
+                BatchTransaction(batchAmount, outerCreditDebitIndicator, null)
             )
         }
         NexusAssert(

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