[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: TWG: finding the handler of outgoing h
From: |
gnunet |
Subject: |
[libeufin] branch master updated: TWG: finding the handler of outgoing history. |
Date: |
Thu, 28 May 2020 17:22:52 +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 729df3c TWG: finding the handler of outgoing history.
729df3c is described below
commit 729df3c1230b382bfeb26c8befce397cf1d29940
Author: MS <ms@taler.net>
AuthorDate: Thu May 28 17:21:52 2020 +0200
TWG: finding the handler of outgoing history.
---
nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt | 38 ++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
index 09dbc80..3dc91fe 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
@@ -408,6 +408,43 @@ fun ingestTransactions() {
}
}
+suspend fun historyOutgoing(call: ApplicationCall): Unit {
+ /* sanitize URL arguments */
+ val subscriberId = authenticateRequest(call.request)
+ val delta: Int = expectInt(call.expectUrlParameter("delta"))
+ val start: Long =
handleStartArgument(call.request.queryParameters["start"], delta)
+ val startCmpOp = getComparisonOperator(delta, start,
TalerRequestedPayments)
+ /* retrieve database elements */
+ val history = TalerOutgoingHistory()
+ transaction {
+ /** Retrieve all the outgoing payments from the _clean Taler outgoing
table_ */
+ val subscriberBankAccount = NexusBankAccountEntity.new { /* FIXME;
exchange should communicate this value */ }
+ val reqPayments = TalerRequestedPaymentEntity.find {
+ TalerRequestedPayments.rawConfirmed.isNotNull() and startCmpOp
+ }.orderTaler(delta)
+ if (reqPayments.isNotEmpty()) {
+ reqPayments.subList(0, min(abs(delta), reqPayments.size)).forEach {
+ history.outgoing_transactions.add(
+ TalerOutgoingBankTransaction(
+ row_id = it.id.value,
+ amount = it.amount,
+ wtid = it.wtid,
+ date =
GnunetTimestamp(it.rawConfirmed?.bookingDate?.div(1000) ?: throw NexusError(
+ HttpStatusCode.InternalServerError, "Null value
met after check, VERY strange.")),
+ credit_account = it.creditAccount,
+ debit_account =
buildPaytoUri(subscriberBankAccount.iban, subscriberBankAccount.bankCode),
+ exchange_base_url =
"FIXME-to-request-along-subscriber-registration"
+ )
+ )
+ }
+ }
+ }
+ call.respond(
+ HttpStatusCode.OK,
+ TextContent(customConverter(history), ContentType.Application.Json)
+ )
+}
+
// /taler/history/incoming
suspend fun historyIncoming(call: ApplicationCall): Unit {
val exchangeUser = authenticateRequest(call.request)
@@ -455,6 +492,7 @@ fun talerFacadeRoutes(route: Route) {
return@post
}
route.get("/history/outgoing") {
+ historyOutgoing(call)
return@get
}
route.get("/history/incoming") {
--
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: TWG: finding the handler of outgoing history.,
gnunet <=