gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (55183184 -> ec21de30)


From: gnunet
Subject: [libeufin] branch master updated (55183184 -> ec21de30)
Date: Wed, 01 Nov 2023 16:29:50 +0100

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

ms pushed a change to branch master
in repository libeufin.

    from 55183184 Fix add_incoming auth and clean tests
     new 0fd1c7e4 Fixing mock payment initiator.
     new 2c0c7f49 initiated payments table
     new c29d7da3 shorter config names
     new ec21de30 debug

The 4 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:
 contrib/payment_initiation_debug.sh                            |  6 +++---
 database-versioning/libeufin-nexus-0001.sql                    |  5 +++--
 nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt        | 10 +++++-----
 nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt       |  9 +++++----
 nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt      |  5 +++++
 nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt |  1 +
 6 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/contrib/payment_initiation_debug.sh 
b/contrib/payment_initiation_debug.sh
index 8eb64496..0a18ae55 100755
--- a/contrib/payment_initiation_debug.sh
+++ b/contrib/payment_initiation_debug.sh
@@ -30,7 +30,7 @@ echo database: $DB_NAME
 # Optionally reading the user-provided request UID.
 if test -n "${LIBEUFIN_SUBMIT_REQUEST_UID:-}"
   then SUBMIT_REQUEST_UID="$LIBEUFIN_SUBMIT_REQUEST_UID"
-  else SUBMIT_REQUEST_UID=$(uuidgen)
+  else SUBMIT_REQUEST_UID=$(uuidgen | cut -c -30)
 fi
 
 # Finally inserting the initiated payment into the database.
@@ -43,8 +43,8 @@ INSERT INTO libeufin_nexus.initiated_outgoing_transactions
   request_uid)
   VALUES ((1,0),
   '${PAYMENT_SUBJECT}',
-  1,
-  'payto://iban/BIC/${IBAN_CREDITOR}',
+  $(($(date +%s) * 1000000)),
+  'payto://iban/POFICHBE/${IBAN_CREDITOR}?receiver-name=Merchant',
   '${SUBMIT_REQUEST_UID}')"
 
 # Only logging errors.
diff --git a/database-versioning/libeufin-nexus-0001.sql 
b/database-versioning/libeufin-nexus-0001.sql
index 2d888b4d..b320cbaf 100644
--- a/database-versioning/libeufin-nexus-0001.sql
+++ b/database-versioning/libeufin-nexus-0001.sql
@@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS initiated_outgoing_transactions
   ,outgoing_transaction_id INT8 REFERENCES outgoing_transactions 
(outgoing_transaction_id)
   ,submitted BOOL DEFAULT FALSE 
   ,hidden BOOL DEFAULT FALSE -- FIXME: explain this.
-  ,request_uid TEXT NOT NULL UNIQUE
+  ,request_uid TEXT NOT NULL UNIQUE CHECK (char_length(request_uid) <= 35)
   ,failure_message TEXT -- NOTE: that may mix soon failures (those found at 
initiation time), or late failures (those found out along a fetch operation)
   );
 
@@ -71,7 +71,8 @@ COMMENT ON COLUMN initiated_outgoing_transactions.request_uid
   IS 'Unique identifier of this outgoing transaction initiation.
 This value could come both from a nexus-httpd client or directly
 generated when nexus-fetch bounces one payment.  In both cases, this
-value will be used as a unique identifier for its related pain.001 document.';
+value will be used as a unique identifier for its related pain.001 document.
+For this reason, it must have at most 35 characters';
 
 -- only active in exchange mode.
 CREATE TABLE IF NOT EXISTS bounced_transactions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
index af9f4204..04c5306f 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSetup.kt
@@ -327,15 +327,15 @@ class EbicsSetup: CliktCommand("Set up the EBICS 
subscriber") {
         val cfg = doOrFail { extractEbicsConfig(this.configFile) }
         if (checkFullConfig) {
             doOrFail {
-                cfg.config.requireString("nexus-ebics-submit", 
"frequency").apply {
+                cfg.config.requireString("nexus-submit", "frequency").apply {
                     if (getFrequencyInSeconds(this) == null)
-                        throw Exception("frequency value of nexus-ebics-submit 
section is not valid: $this")
+                        throw Exception("frequency value of nexus-submit 
section is not valid: $this")
                 }
-                cfg.config.requireString("nexus-ebics-fetch", 
"frequency").apply {
+                cfg.config.requireString("nexus-fetch", "frequency").apply {
                     if (getFrequencyInSeconds(this) == null)
-                        throw Exception("frequency value of nexus-ebics-fetch 
section is not valid: $this")
+                        throw Exception("frequency value of nexus-fetch 
section is not valid: $this")
                 }
-                cfg.config.requirePath("nexus-ebics-fetch", 
"statement_log_directory")
+                cfg.config.requirePath("nexus-fetch", 
"statement_log_directory")
                 cfg.config.requireNumber("nexus-httpd", "port")
                 cfg.config.requirePath("nexus-httpd", "unixpath")
                 cfg.config.requireString("nexus-httpd", "serve")
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
index 36cce2a1..896e4cb1 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
@@ -68,8 +68,7 @@ private suspend fun submitInitiatedPayment(
         debitAccount = cfg.myIbanAccount,
         wireTransferSubject = initiatedPayment.wireTransferSubject
     )
-    submitPayment(xml, cfg, clientPrivateKeysFile, bankPublicKeysFile, 
httpClient)
-    return true
+    return submitPayment(xml, cfg, clientPrivateKeysFile, bankPublicKeysFile, 
httpClient)
 }
 
 /**
@@ -142,6 +141,7 @@ private fun submitBatch(
 ) {
     runBlocking {
         db.initiatedPaymentsUnsubmittedGet(cfg.currency).forEach {
+            logger.debug("Submitting payment initiation with row ID: 
${it.key}")
             val submitted = submitInitiatedPayment(
                 httpClient,
                 cfg,
@@ -159,7 +159,8 @@ private fun submitBatch(
                 if (!flagged) {
                     logger.warn("Initiated payment with row ID ${it.key} could 
not be flagged as submitted")
                 }
-            }
+            } else
+                logger.warn("Initiated payment with row ID ${it.key} could not 
be submitted")
         }
     }
 }
@@ -183,7 +184,7 @@ class EbicsSubmit : CliktCommand("Submits any initiated 
payment found in the dat
     override fun run() {
         val cfg: EbicsSetupConfig = doOrFail { extractEbicsConfig(configFile) }
         val frequency: Int = doOrFail {
-            val configValue = cfg.config.requireString("nexus-ebics-submit", 
"frequency")
+            val configValue = cfg.config.requireString("nexus-submit", 
"frequency")
             return@doOrFail checkFrequency(configValue)
         }
         val dbCfg = cfg.config.extractDbConfigOrFail()
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt
index 85ed8b6e..5f40a07f 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt
@@ -113,6 +113,7 @@ suspend fun submitPayment(
     bankkeys: BankPublicKeysFile,
     httpClient: HttpClient
 ): Boolean {
+    logger.debug("Submitting pain.001: $pain001xml")
     val orderService: Ebics3Request.OrderDetails.Service = 
Ebics3Request.OrderDetails.Service().apply {
         serviceName = "MCT"
         scope = "CH"
@@ -133,5 +134,9 @@ suspend fun submitPayment(
         logger.error("Could not send the pain.001 document to the bank.")
         return false
     }
+    logger.debug("Payment submitted, report text is: 
${maybeUploaded.reportText}," +
+            " EBICS technical code is: ${maybeUploaded.technicalReturnCode}," +
+            " bank technical return code is: ${maybeUploaded.bankReturnCode}"
+    )
     return true
 }
\ No newline at end of file
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt
index a10dcbcf..ac7a90e4 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsCommon.kt
@@ -94,6 +94,7 @@ fun decryptAndDecompressPayload(
  *         EBICS handler, or null otherwise.
  */
 suspend fun HttpClient.postToBank(bankUrl: String, msg: String): String? {
+    logger.debug("POSTing EBICS to: $bankUrl")
     val resp: HttpResponse = try {
         this.post(urlString = bankUrl) {
             expectSuccess = false // avoids exceptions on non-2xx statuses.

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