From 0cd1658bc6178a7154937268a66a34a58028492b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 18 Jun 2020 12:43:10 +0530 Subject: cleanup --- nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt | 59 ---------------------- 1 file changed, 59 deletions(-) (limited to 'nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt') diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt index 3d7c056d..3f2470fe 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt @@ -379,65 +379,6 @@ private suspend fun talerAddIncoming(call: ApplicationCall, httpClient: HttpClie ) } -/** - * submits ALL the prepared payments from ALL the Taler facades. - * FIXME(dold): This should not be done here. - * -> why? It crawls the *taler* facade to find payment to submit. - */ -suspend fun submitPreparedPaymentsViaEbics(httpClient: HttpClient) { - data class EbicsSubmission( - val subscriberDetails: EbicsClientSubscriberDetails, - val pain001document: String - ) - logger.debug("auto-submitter started") - val workQueue = mutableListOf() - transaction { - TalerFacadeStateEntity.all().forEach { - val bankConnection = NexusBankConnectionEntity.findById(it.bankConnection) ?: throw NexusError( - HttpStatusCode.InternalServerError, - "Such facade '${it.facade.id.value}' doesn't map to any bank connection (named '${it.bankConnection}')" - ) - if (bankConnection.type != "ebics") { - logger.info("Skipping non-implemented bank connection '${bankConnection.type}'") - return@forEach - } - - val subscriberEntity = EbicsSubscriberEntity.find { - EbicsSubscribersTable.nexusBankConnection eq it.bankConnection - }.firstOrNull() ?: throw NexusError( - HttpStatusCode.InternalServerError, - "Such facade '${it.facade.id.value}' doesn't map to any Ebics subscriber" - ) - val bankAccount: NexusBankAccountEntity = - NexusBankAccountEntity.findById(it.bankAccount) ?: throw NexusError( - HttpStatusCode.InternalServerError, - "Bank account '${it.bankAccount}' not found for facade '${it.id.value}'" - ) - InitiatedPaymentEntity.find { - InitiatedPaymentsTable.debitorIban eq bankAccount.iban and - not(InitiatedPaymentsTable.submitted) - }.forEach { - val pain001document = createPain001document(it) - logger.debug("Preparing payment: ${pain001document}") - val subscriberDetails = getEbicsSubscriberDetailsInternal(subscriberEntity) - workQueue.add(EbicsSubmission(subscriberDetails, pain001document)) - // FIXME: the payment must be flagged AFTER the submission happens. - // -> this is an open question: see #6367. - it.submitted = true - } - } - } - workQueue.forEach { - println("submitting prepared payment via EBICS") - doEbicsUploadTransaction( - httpClient, - it.subscriberDetails, - "CCT", - it.pain001document.toByteArray(Charsets.UTF_8), - EbicsStandardOrderParams() - ) - } -} private fun ingestIncoming(payment: RawBankTransactionEntity, txDtls: TransactionDetails) { val subject = txDtls.unstructuredRemittanceInformation -- cgit v1.2.3