gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (b5848e37 -> 1bce72ce)


From: gnunet
Subject: [libeufin] branch master updated (b5848e37 -> 1bce72ce)
Date: Fri, 20 Jan 2023 21:07:36 +0100

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

ms pushed a change to branch master
in repository libeufin.

    from b5848e37 fix copy-and-paste error
     new f8b79329 Logging.
     new 1bce72ce Comments.  Rewording logging.

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:
 .../main/kotlin/tech/libeufin/nexus/FacadeUtil.kt  |  7 +++++--
 nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 24 +++++++++++++++-------
 .../kotlin/tech/libeufin/sandbox/CircuitApi.kt     | 19 ++++++++++++-----
 3 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt
index 2c2a3ea1..0227489c 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt
@@ -81,10 +81,13 @@ fun ingestFacadeTransactions(
         }
         try {
             if (refundCb != null) {
-                refundCb(bankAccount, facadeState.highestSeenMessageSerialId)
+                refundCb(
+                    bankAccount,
+                    facadeState.highestSeenMessageSerialId
+                )
             }
         } catch (e: Exception) {
-            logger.warn("sending refund payment failed", e);
+            logger.warn("sending refund payment failed", e)
         }
         facadeState.highestSeenMessageSerialId = lastId
     }
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index f14d5552..1777522c 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -288,7 +288,6 @@ fun talerFilter(payment: NexusBankTransactionEntity, 
txDtls: TransactionDetails)
     }
 
     if (!CryptoUtil.checkValidEddsaPublicKey(reservePub)) {
-        // FIXME: send back!
         logger.info("invalid public key detected")
         isInvalid = true
     }
@@ -316,23 +315,34 @@ fun maybeTalerRefunds(bankAccount: 
NexusBankAccountEntity, lastSeenId: Long) {
                 " after last seen transaction id: $lastSeenId"
     )
     transaction {
-        TalerInvalidIncomingPaymentsTable.innerJoin(NexusBankTransactionsTable,
-            { NexusBankTransactionsTable.id }, { 
TalerInvalidIncomingPaymentsTable.payment }).select {
+        TalerInvalidIncomingPaymentsTable.innerJoin(
+            NexusBankTransactionsTable,
+            { NexusBankTransactionsTable.id },
+            { TalerInvalidIncomingPaymentsTable.payment }
+        ).select {
+            /**
+             * Finds Taler-invalid incoming payments that weren't refunded
+             * yet and are newer than those processed along the last round.
+             */
             TalerInvalidIncomingPaymentsTable.refunded eq false and
                     (NexusBankTransactionsTable.bankAccount eq 
bankAccount.id.value) and
                     (NexusBankTransactionsTable.id greater lastSeenId)
-
         }.forEach {
+            // For each of them, extracts the wire details to reuse in the 
refund.
             val paymentData = jacksonObjectMapper().readValue(
                 it[NexusBankTransactionsTable.transactionJson],
                 CamtBankAccountEntry::class.java
             )
             if (paymentData.batches == null) {
                 logger.error(
-                    "A singleton batched payment was expected to be refunded," 
+
-                            " but none was found (in transaction 
(AcctSvcrRef): ${paymentData.accountServicerRef})"
+                    "Empty wire details encountered in transaction with" +
+                            " AcctSvcrRef: ${paymentData.accountServicerRef}." 
+
+                            " Taler can't refund."
+                )
+                throw NexusError(
+                    HttpStatusCode.InternalServerError,
+                    "Unexpected void payment, cannot refund"
                 )
-                throw NexusError(HttpStatusCode.InternalServerError, 
"Unexpected void payment, cannot refund")
             }
             val debtorAccount = 
paymentData.batches[0].batchTransactions[0].details.debtorAccount
             if (debtorAccount?.iban == null) {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
index 78870cf6..0f64efa6 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/CircuitApi.kt
@@ -390,10 +390,15 @@ fun circuitApi(circuitRoute: Route) {
                         message = op.tan
                     )
                 } catch (e: Exception) {
-                    throw internalServerError("E-mail TAN command threw 
exception: ${e.message}")
+                    throw internalServerError(
+                        "Sending the e-mail TAN failed for ${customer.email}." 
+
+                                "  The command threw this exception: 
${e.message}"
+                    )
                 }
                 if (!isSuccessful)
-                    throw internalServerError("E-mail TAN command failed.")
+                    throw internalServerError(
+                        "E-mail TAN command failed for ${customer.email}."
+                    )
             }
             SupportedTanChannels.SMS.name -> {
                 val isSuccessful = try {
@@ -411,10 +416,14 @@ fun circuitApi(circuitRoute: Route) {
                     )
 
                 } catch (e: Exception) {
-                    throw internalServerError("SMS TAN command threw 
exception: ${e.message}")
+                    throw internalServerError(
+                        "Sending the SMS TAN failed for ${customer.phone}." +
+                                " The command threw this exception: 
${e.message}"
+                    )
                 }
                 if (!isSuccessful)
-                    throw internalServerError("SMS TAN command failed.")
+                    throw internalServerError(
+                        "SMS TAN command failed for ${customer.phone}.")
             }
             SupportedTanChannels.FILE.name -> {
                 try {
@@ -425,7 +434,7 @@ fun circuitApi(circuitRoute: Route) {
                 }
             }
             else ->
-                throw internalServerError("The bank didn't catch a unsupported 
TAN channel: $tanChannel.")
+                throw internalServerError("The bank tried an unsupported TAN 
channel: $tanChannel.")
         }
         call.respond(HttpStatusCode.Accepted, object {val uuid = op.uuid})
         return@post

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