[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Adapting /admin/payments/camt (Camt qu
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Adapting /admin/payments/camt (Camt query) to read from database. |
Date: |
Tue, 31 Aug 2021 11:04:31 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 2e49f3b Adapting /admin/payments/camt (Camt query) to read from
database.
2e49f3b is described below
commit 2e49f3b90d43e5f10cc2b7c79bf5f6f5e64ddf2b
Author: MS <ms@taler.net>
AuthorDate: Mon Aug 30 22:03:05 2021 -1100
Adapting /admin/payments/camt (Camt query) to read from database.
It used to generate the statements on the fly.
---
.../src/main/kotlin/tech/libeufin/sandbox/JSON.kt | 3 ++-
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 30 +++++++++++-----------
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
index 792a174..938828b 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
@@ -68,5 +68,6 @@ data class BankAccountRequest(
data class CamtParams(
// name/label of the bank account to query.
val bankaccount: String,
- val type: Int
+ val type: Int,
+ // need range parameter
)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 4a0a638..43af9fe 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -587,27 +587,27 @@ fun serverMain(dbName: String, port: Int) {
val version = "0.0.0-dev.0"
})
}
-
- // only reason for a post is to hide the iban (to some degree.)
+ /**
+ * For now, only returns the last statement of the
+ * requesting account.
+ */
post("/admin/payments/camt") {
val body = call.receiveJson<CamtParams>()
val bankaccount = getAccountFromLabel(body.bankaccount)
- val history = historyForAccount(bankaccount)
- SandboxAssert(body.type == 53,
- "Only Camt.053 is implemented"
+ if(body.type != 53) throw SandboxError(
+ HttpStatusCode.NotFound,
+ "Only Camt.053 documents can be generated."
)
- val camtData = buildCamtString(
- body.type,
- bankaccount.iban,
- history,
- balancePrcd = BigDecimal.ZERO,
- balanceClbd = balanceForAccount(
- history,
- baseBalance = BigDecimal.ZERO
+ val camtMessage = transaction {
+ BankAccountStatementEntity.find {
+ BankAccountStatementsTable.bankAccount eq
bankaccount.id
+ }.lastOrNull()?.xmlMessage ?: throw SandboxError(
+ HttpStatusCode.NotFound,
+ "Could not find any statements; please wait next tick"
)
- )
+ }
call.respondText(
- camtData.camtMessage, ContentType.Text.Xml,
HttpStatusCode.OK
+ camtMessage, ContentType.Text.Xml, HttpStatusCode.OK
)
return@post
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Adapting /admin/payments/camt (Camt query) to read from database.,
gnunet <=