libeufin

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

commit e59182e54d31b7bcbf5042c796facb7d361a06b4
parent c64384fdfbe57cb919ead40021f9e5c1f88ad037
Author: MS <ms@taler.net>
Date:   Tue, 12 Jul 2022 11:07:19 +0200

bounce duplicate reserves

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt | 1-
Mnexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 17++++++++++++-----
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/FacadeUtil.kt @@ -80,7 +80,6 @@ fun ingestFacadeTransactions( lastId = it.id.value } try { - // FIXME: This currently does not do proper error handing. if (refundCb != null) { refundCb(bankAccount, facadeState.highestSeenMessageSerialId) } diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt @@ -241,6 +241,7 @@ private suspend fun talerTransfer(call: ApplicationCall) { } fun talerFilter(payment: NexusBankTransactionEntity, txDtls: TransactionDetails) { + var isInvalid = false // True when pub is invalid or duplicate. val subject = txDtls.unstructuredRemittanceInformation val debtorName = txDtls.debtor?.name if (debtorName == null) { @@ -276,24 +277,30 @@ fun talerFilter(payment: NexusBankTransactionEntity, txDtls: TransactionDetails) this.payment = payment timestampMs = System.currentTimeMillis() } - // FIXME: send back! + // Will be paid back by the refund handler. return } // Check if reserve_pub was used already val maybeExist = TalerIncomingPaymentEntity.find { TalerIncomingPaymentsTable.reservePublicKey eq reservePub }.firstOrNull() - if (maybeExist != null) throw conflict("Reserve pub '$reservePub' was used already") + if (maybeExist != null) { + val msg = "Reserve pub '$reservePub' was used already" + logger.info(msg) + isInvalid = true + } if (!CryptoUtil.checkValidEddsaPublicKey(reservePub)) { // FIXME: send back! - logger.warn("invalid public key") + logger.info("invalid public key detected") + isInvalid = true + } + if (isInvalid) { TalerInvalidIncomingPaymentEntity.new { this.payment = payment timestampMs = System.currentTimeMillis() } - logger.warn("Invalid public key found") - // FIXME: send back! + // Will be paid back by the refund handler. return } TalerIncomingPaymentEntity.new {