gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: nexus: adding --debug to read from STD


From: gnunet
Subject: [libeufin] branch master updated: nexus: adding --debug to read from STDIN
Date: Wed, 15 Nov 2023 15:52:48 +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 c8ee5921 nexus: adding --debug to read from STDIN
c8ee5921 is described below

commit c8ee59217de3af90dae76baf5563e9b77a99d623
Author: MS <ms@taler.net>
AuthorDate: Wed Nov 15 15:52:33 2023 +0100

    nexus: adding --debug to read from STDIN
---
 nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt  | 11 ++++++++---
 nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt | 10 ++++++----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
index f4cd09d6..fe31ea50 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsFetch.kt
@@ -482,6 +482,12 @@ class EbicsFetch: CliktCommand("Fetches bank records.  
Defaults to camt.054 noti
                 " latest document is always until the current time."
     )
 
+    private val debug by option(
+        help = "Reads one ISO20022 document from STDIN and prints " +
+                "the parsing results.  It does not affect the database."
+    ).flag(default = false)
+
+
     /**
      * This function collects the main steps of fetching banking records.
      * In this current version, it does not implement long polling, instead
@@ -515,10 +521,9 @@ class EbicsFetch: CliktCommand("Fetches bank records.  
Defaults to camt.054 noti
         if (onlyStatements) whichDoc = SupportedDocument.CAMT_053
         if (onlyLogs) whichDoc = SupportedDocument.PAIN_002_LOGS
 
-        // If STDIN has data, we run in debug mode: parse, print, and return.
-        val maybeStdin = generateSequence(::readLine).joinToString("\n")
-        if (maybeStdin.isNotEmpty()) {
+        if (debug) {
             logger.debug("Reading from STDIN, running in debug mode.  Not 
involving the database.")
+            val maybeStdin = generateSequence(::readLine).joinToString("\n")
             when(whichDoc) {
                 SupportedDocument.CAMT_054 -> {
                     val incoming = findIncomingTxInNotification(maybeStdin, 
cfg.currency)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
index ab92cc09..47a895d8 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/EbicsSubmit.kt
@@ -229,6 +229,9 @@ class EbicsSubmit : CliktCommand("Submits any initiated 
payment found in the dat
                 "ignoring the 'frequency' configuration value"
     ).flag(default = false)
 
+    private val debug by option(
+        help = "Reads the pain.001 document from STDIN and submits it to the 
bank"
+    ).flag(default = false)
     /**
      * Submits any initiated payment that was not submitted
      * so far and -- according to the configuration -- returns
@@ -259,10 +262,9 @@ class EbicsSubmit : CliktCommand("Submits any initiated 
payment found in the dat
             clientPrivateKeysFile = clientKeys,
             httpClient = HttpClient()
         )
-        // If STDIN has data, we run in debug mode: submit and return.
-        val maybeStdin = generateSequence(::readLine).joinToString("\n")
-        if (maybeStdin.isNotEmpty()) {
-            logger.info("Submitting STDIN to the bank")
+        if (debug) {
+            logger.info("Running in debug mode, submitting STDIN to the bank")
+            val maybeStdin = generateSequence(::readLine).joinToString("\n")
             doOrFail {
                 runBlocking {
                     submitPain001(

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