libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 1bce72ce659f7ec739fdb88806a2fcc5aa21c875
parent f8b79329c9f2831af55b1e2f49c4ea3c779565d8
Author: MS <ms@taler.net>
Date:   Fri, 20 Jan 2023 21:07:16 +0100

Comments.  Rewording logging.

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt | 7+++++--
Mnexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 24+++++++++++++++++-------
2 files changed, 22 insertions(+), 9 deletions(-)

diff --git 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 @@ -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) {