gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: logging wire transfer subjects along P


From: gnunet
Subject: [libeufin] branch master updated: logging wire transfer subjects along Pain communication
Date: Tue, 29 Nov 2022 15:17:47 +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 c868441a logging wire transfer subjects along Pain communication
c868441a is described below

commit c868441acbfb1f3e72f5a254e97c38883afaca79
Author: MS <ms@taler.net>
AuthorDate: Tue Nov 29 15:16:20 2022 +0100

    logging wire transfer subjects along Pain communication
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt        |  6 ++++++
 .../main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt | 10 +++++-----
 nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt  |  7 +++++--
 .../main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt  |  5 +++--
 4 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
index d7831bae..d4420db6 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Scheduling.kt
@@ -53,11 +53,17 @@ private suspend fun runTask(client: HttpClient, sched: 
TaskSchedule) {
         when (sched.resourceType) {
             "bank-account" -> {
                 when (sched.type) {
+                    /**
+                     * Downloads and ingests the payment records from the bank.
+                     */
                     "fetch" -> {
                         @Suppress("BlockingMethodInNonBlockingContext")
                         val fetchSpec = 
jacksonObjectMapper().readValue(sched.params, FetchSpecJson::class.java)
                         fetchBankAccountTransactions(client, fetchSpec, 
sched.resourceId)
                     }
+                    /**
+                     * Submits the payment preparations that are found in the 
database.
+                     */
                     "submit" -> {
                         submitAllPaymentInitiations(client, sched.resourceId)
                     }
diff --git 
a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
index 3b0ef108..10576e30 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
@@ -78,7 +78,6 @@ suspend fun submitAllPaymentInitiations(httpClient: 
HttpClient, accountid: Strin
     data class Submission(
         val id: Long
     )
-    logger.debug("auto-submitter started")
     val workQueue = mutableListOf<Submission>()
     transaction {
         val account = NexusBankAccountEntity.findByName(accountid) ?: throw 
NexusError(
@@ -91,12 +90,14 @@ suspend fun submitAllPaymentInitiations(httpClient: 
HttpClient, accountid: Strin
         }.forEach {
             // Filter out non EBICS.
             val defaultBankConnectionId = 
it.bankAccount.defaultBankConnection?.id ?: throw NexusError(
-                HttpStatusCode.BadRequest,
-                "needs default bank connection"
+                HttpStatusCode.NotFound,
+                "Default bank connection not found.  Can't submit Pain 
document"
             )
             val bankConnection = 
NexusBankConnectionEntity.findById(defaultBankConnectionId) ?: throw NexusError(
                 HttpStatusCode.InternalServerError,
-                "Bank account '${it.id.value}' doesn't map to any bank 
connection (named '${defaultBankConnectionId}')"
+                "Bank connection '$defaultBankConnectionId' " +
+                        "(pointed by bank account 
'${it.bankAccount.bankAccountName}')" +
+                        " not found in the database."
             )
             if (bankConnection.type != "ebics") {
                 logger.info("Skipping non-implemented bank connection 
'${bankConnection.type}'")
@@ -106,7 +107,6 @@ suspend fun submitAllPaymentInitiations(httpClient: 
HttpClient, accountid: Strin
         }
     }
     workQueue.forEach {
-        logger.debug("Submitting payment ${it.id}")
         submitPaymentInitiation(httpClient, it.id)
     }
 }
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
index e1d63e5b..ab359a16 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
@@ -501,7 +501,9 @@ class EbicsBankConnectionProtocol: BankConnectionProtocol {
                 subscriberDetails
             )
     }
-
+    /**
+     * Submit one Pain.001 for one payment initiations.
+     */
     override suspend fun submitPaymentInitiation(httpClient: HttpClient, 
paymentInitiationId: Long) {
         val r = transaction {
             val paymentInitiation = 
PaymentInitiationEntity.findById(paymentInitiationId)
@@ -527,7 +529,8 @@ class EbicsBankConnectionProtocol: BankConnectionProtocol {
                     messageId = paymentInitiation.messageId
                 )
             )
-            logger.debug("Sending Pain.001: 
${paymentInitiation.paymentInformationId}")
+            logger.debug("Sending Pain.001: 
${paymentInitiation.paymentInformationId}," +
+                    " for payment: '${paymentInitiation.subject}'")
             if (!XMLUtil.validateFromString(painMessage)) throw NexusError(
                 HttpStatusCode.InternalServerError, "Pain.001 message is 
invalid."
             )
diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index b6e9f237..5c525d92 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -704,14 +704,15 @@ private fun parsePain001(paymentRequest: String): 
PainParseResult {
  */
 private fun handleCct(paymentRequest: String) {
     val parseResult = parsePain001(paymentRequest)
-    logger.debug("Handling Pain.001: ${parseResult.pmtInfId}")
+    logger.debug("Handling Pain.001: ${parseResult.pmtInfId}, " +
+            "for payment: ${parseResult.subject}")
     transaction(Connection.TRANSACTION_SERIALIZABLE, repetitionAttempts = 10) {
         val maybeExist = BankAccountTransactionEntity.find {
             BankAccountTransactionsTable.pmtInfId eq parseResult.pmtInfId
         }.firstOrNull()
         if (maybeExist != null) {
             logger.info(
-                "Nexus submitted twice the PAIN: ${maybeExist.pmtInfId}. Not 
taking any action." +
+                "Nexus submitted twice the Pain: ${maybeExist.pmtInfId}. Not 
taking any action." +
                         "  Sandbox gave it this reference: 
${maybeExist.accountServicerReference}"
             )
             return@transaction

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