From dcc4a11c162b34f47eddedd1c6d28b1b4376403e Mon Sep 17 00:00:00 2001 From: MS Date: Fri, 23 Sep 2022 16:35:47 +0200 Subject: close Zip file + DCE --- .../kotlin/tech/libeufin/sandbox/bankAccount.kt | 41 ---------------------- util/src/main/kotlin/zip.kt | 1 + 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt index 873371d0..2175ab0d 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt @@ -55,45 +55,4 @@ fun balanceForAccount(bankAccount: BankAccountEntity): BigDecimal { } } return balance -} - -// For now, returns everything. -fun historyForAccount(bankAccount: BankAccountEntity): MutableList { - val history = mutableListOf() - transaction { - /** - FIXME: add the following condition too: - and (BankAccountTransactionsTable.date.between(start.millis, end.millis)) - */ - /** - FIXME: add the following condition too: - and (BankAccountTransactionsTable.date.between(start.millis, end.millis)) - */ - BankAccountTransactionEntity.find { - BankAccountTransactionsTable.account eq bankAccount.id - }.forEach { - history.add( - RawPayment( - subject = it.subject, - creditorIban = it.creditorIban, - creditorBic = it.creditorBic, - creditorName = it.creditorName, - debtorIban = it.debtorIban, - debtorBic = it.debtorBic, - debtorName = it.debtorName, - date = importDateFromMillis(it.date).toDashedDate(), - amount = it.amount, - currency = it.currency, - // The line below produces a value too long (>35 chars), - // and it makes the document invalid! - // uid = "${it.pmtInfId}-${it.msgId}" - uid = it.accountServicerReference, - direction = it.direction, - pmtInfId = it.pmtInfId - ) - ) - - } - } - return history } \ No newline at end of file diff --git a/util/src/main/kotlin/zip.kt b/util/src/main/kotlin/zip.kt index e22571b3..3f6f94a9 100644 --- a/util/src/main/kotlin/zip.kt +++ b/util/src/main/kotlin/zip.kt @@ -66,4 +66,5 @@ fun ByteArray.unzipWithLambda(process: (Pair) -> Unit) { Pair(it.name, zipFile.getInputStream(it).readAllBytes().toString(Charsets.UTF_8)) ) } + zipFile.close() } \ No newline at end of file -- cgit v1.2.3