gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (3118c928 -> d8f7744a)


From: gnunet
Subject: [libeufin] branch master updated (3118c928 -> d8f7744a)
Date: Sat, 18 Nov 2023 08:20:17 +0100

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

ms pushed a change to branch master
in repository libeufin.

    from 3118c928 nexus fetch: debug
     new e2a0842b nexus db
     new d8f7744a nexus fetch

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:
 database-versioning/libeufin-nexus-0001.sql        |  2 +-
 .../main/kotlin/tech/libeufin/nexus/Database.kt    | 13 ++++---
 .../main/kotlin/tech/libeufin/nexus/EbicsFetch.kt  | 45 +++++-----------------
 3 files changed, 19 insertions(+), 41 deletions(-)

diff --git a/database-versioning/libeufin-nexus-0001.sql 
b/database-versioning/libeufin-nexus-0001.sql
index 5c6f3082..61f97294 100644
--- a/database-versioning/libeufin-nexus-0001.sql
+++ b/database-versioning/libeufin-nexus-0001.sql
@@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS outgoing_transactions
   ,amount taler_amount NOT NULL
   ,wire_transfer_subject TEXT
   ,execution_time INT8 NOT NULL
-  ,credit_payto_uri TEXT NOT NULL
+  ,credit_payto_uri TEXT
   ,bank_transfer_id TEXT NOT NULL
   );
 
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Database.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Database.kt
index ae4b865f..64e2c9f7 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Database.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Database.kt
@@ -92,12 +92,15 @@ enum class PaymentInitiationOutcome {
 
 // OUTGOING PAYMENTS STRUCTS
 
+/**
+ * Collects data of a booked outgoing payment.
+ */
 data class OutgoingPayment(
     val amount: TalerAmount,
-    val wireTransferSubject: String,
     val executionTime: Instant,
-    val creditPaytoUri: String,
-    val bankTransferId: String
+    val bankTransferId: String,
+    val creditPaytoUri: String? = null, // not showing in camt.054
+    val wireTransferSubject: String? = null // not showing in camt.054
 )
 
 /**
@@ -183,8 +186,8 @@ class Database(dbConfig: String): java.io.Closeable {
      *
      * @param paymentData information about the outgoing payment.
      * @param reconcileId optional row ID of the initiated payment
-     *        that will reference this one.  Note: if this value is
-     *        not found, then NO row gets inserted in the database.
+     *        that will reference this one.  If null, then only the
+     *        outgoing payment record gets inserted.
      * @return operation outcome enum.
      */
     suspend fun outgoingPaymentCreate(
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
index 5b10369f..9e537104 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
@@ -250,40 +250,10 @@ private fun parseOutgoingTxNotif(
             }
         }
 
-        // Obtaining payment subject.
-        val subject = StringBuilder()
-            requireUniqueChildNamed("RmtInf") {
-              this.mapEachChildNamed("Ustrd") {
-                  val piece = this.focusElement.textContent
-                  subject.append(piece)
-              }
-            }
-
-        // Obtaining the payer's details
-        val creditorPayto = StringBuilder("payto://iban/")
-        requireUniqueChildNamed("RltdPties") {
-            requireUniqueChildNamed("CdtrAcct") {
-                requireUniqueChildNamed("Id") {
-                    requireUniqueChildNamed("IBAN") {
-                        creditorPayto.append(focusElement.textContent)
-                    }
-                }
-            }
-            requireUniqueChildNamed("Cdtr") {
-                requireUniqueChildNamed("Pty") {
-                    requireUniqueChildNamed("Nm") {
-                        val urlEncName = 
URLEncoder.encode(focusElement.textContent, "utf-8")
-                        creditorPayto.append("?receiver-name=$urlEncName")
-                    }
-                }
-            }
-        }
         ret.add(OutgoingPayment(
             amount = amount,
             bankTransferId = uidFromBank.toString(),
-            creditPaytoUri = creditorPayto.toString(),
-            executionTime = bookDate,
-            wireTransferSubject = subject.toString()
+            executionTime = bookDate
         ))
     }
     return ret
@@ -475,12 +445,17 @@ private suspend fun ingestOutgoingPayment(
         logger.debug("Outgoing payment with UID '${payment.bankTransferId}' 
already seen.")
         return
     }
-    // Get the initiate payment to link to this.
-    val initId: Long = db.initiatedPaymentGetFromUid(payment.bankTransferId)
-        ?: throw Exception("Outgoing payment lacks (submitted) initiated " +
+    /**
+     * Getting the initiate payment to link to this.  A missing initiated
+     * payment could mean that a third party is downloading the bank account
+     * history (to conduct an audit, for example)
+     */
+    val initId: Long? = db.initiatedPaymentGetFromUid(payment.bankTransferId);
+    if (initId == null)
+        logger.info("Outgoing payment lacks (submitted) initiated " +
                 "counterpart with UID ${payment.bankTransferId}"
         )
-    // store the payment and its linked init
+    // store the payment and its (maybe null) linked init
     val insertionResult = db.outgoingPaymentCreate(payment, initId)
     if (insertionResult != OutgoingPaymentOutcome.SUCCESS) {
         throw Exception("Could not store outgoing payment with UID " +

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