libeufin

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

commit 112cf9902cd86f60cac8589d540571b44a1dcd45
parent 70763ba07ef2e76031626010a87c1b9bc9e5e57b
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Mon, 13 Apr 2020 18:57:21 +0200

Link fresh CAMT entries to exchange-requested payments.

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/taler.kt | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt @@ -289,17 +289,18 @@ class Taler(app: Route) { /** This endpoint triggers the examination of raw incoming payments aimed * at separating the good payments (those that will lead to a new reserve * being created), from the invalid payments (those with a invalid subject - * that will soon be refunded.) */ - app.post("/ebics/taler/{id}/crunch-incoming-transactions") { + * that will soon be refunded.) Recently, the examination of raw OUTGOING + * payment was added as well. + */ + app.post("/ebics/taler/{id}/crunch-raw-transactions") { val id = expectId(call.parameters["id"]) // first find highest ID value of already processed rows. transaction { val subscriberAccount = getBankAccountsInfoFromId(id).first() - /** * Search for fresh INCOMING transactions having a BOOK status. Cancellations and * other status changes will (1) be _appended_ to the payment history, and (2) be - * handled _independently_ another dedicated routine. + * handled _independently_ by another dedicated routine. */ val latestIncomingPaymentId: Long = TalerIncomingPaymentEntity.getLast() EbicsRawBankTransactionEntity.find { @@ -330,9 +331,16 @@ class Taler(app: Route) { EbicsRawBankTransactionsTable.id greater latestOutgoingPaymentId and (EbicsRawBankTransactionsTable.status eq "BOOK") }.forEach { - + var talerRequested = TalerRequestedPaymentEntity.find { + TalerRequestedPayments.wtid eq it.unstructuredRemittanceInformation + }.firstOrNull() ?: throw NexusError( + HttpStatusCode.InternalServerError, + "Unrecognized fresh outgoing payment met (subject: ${it.unstructuredRemittanceInformation})." + ) + talerRequested.rawConfirmed = it } } + call.respondText ( "New raw payments Taler-processed", ContentType.Text.Plain,