libeufin

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

commit accd4f5052a33abff75ecdec6b9b95bf9f37daae
parent 30df1e0c3d84ccaace6c01a25451eb51a6796387
Author: MS <ms@taler.net>
Date:   Sat,  6 Jun 2020 02:05:50 +0200

automatic payment submission

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 5+++--
Mnexus/src/main/kotlin/tech/libeufin/nexus/taler.kt | 2++
Msandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt | 3+++
3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -264,8 +264,9 @@ fun schedulePeriodicWork() { logger.debug("Outer background job") try { delay(Duration.ofSeconds(1)) - downloadTalerFacadesTransactions(this) + downloadTalerFacadesTransactions() ingestTalerTransactions() + submitPreparedPaymentsViaEbics() } catch (e: Exception) { logger.info("==== Background job exception ====\n${e.message}======") } @@ -274,7 +275,7 @@ fun schedulePeriodicWork() { } /** Crawls all the facades, and requests history for each of its creators. */ -suspend fun downloadTalerFacadesTransactions(myScope: CoroutineScope) { +suspend fun downloadTalerFacadesTransactions() { val httpClient = HttpClient() val work = mutableListOf<Pair<String, String>>() transaction { diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt @@ -402,6 +402,8 @@ suspend fun submitPreparedPaymentsViaEbics() { val pain001document = createPain001document(it) val subscriberDetails = getEbicsSubscriberDetailsInternal(subscriberEntity) workQueue.add(EbicsSubmission(subscriberDetails, pain001document)) + // FIXME: the payment must be flagger AFTER the submission happens. + it.submitted = true } } } diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt @@ -155,6 +155,9 @@ fun buildCamtString(type: Int, subscriberIban: String, history: MutableList<RawP */ val ret = mutableListOf<String>() history.forEach { + logger.debug( + "Building CAMT over payment: ${it.debitorIban} => ${it.creditorIban}, ${it.currency}:${it.amount}, ${it.subject}" + ) val dashedDate = expectNonNull(it.date) val now = LocalDateTime.now() val zonedDateTime = now.toZonedString()