summaryrefslogtreecommitdiff
path: root/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-06-18 12:43:10 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-06-18 14:15:38 +0530
commit0cd1658bc6178a7154937268a66a34a58028492b (patch)
treea8d603a071b1f5d1daf7b2f50e4dd48a662b7d60 /nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
parent12c1a45ce0bb96b874d27629a7ac0ead227ac773 (diff)
downloadlibeufin-0cd1658bc6178a7154937268a66a34a58028492b.tar.gz
libeufin-0cd1658bc6178a7154937268a66a34a58028492b.tar.bz2
libeufin-0cd1658bc6178a7154937268a66a34a58028492b.zip
cleanup
Diffstat (limited to 'nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt')
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt59
1 files changed, 0 insertions, 59 deletions
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<EbicsSubmission>()
- 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