libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit bafc34599d430d11e0b18d22fac1e5654cc39ec8
parent bc1b7a3ee37698bcac5979b180062886feeb626d
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Tue, 17 Mar 2020 17:15:57 +0100

Fix data access.

Need transaction{} block to access data
contained into a "entity" object.

Diffstat:
Msandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -231,22 +231,22 @@ fun main() { routing { post("/{id}/history") { - val req = call.receive<CustomerHistoryRequest>() val customer = findCustomer(call.parameters["id"]) val ret = CustomerHistoryResponse() val history = extractHistory(customer.id.value, req.start, req.end) - - history.forEach { - ret.history.add( - CustomerHistoryResponseElement( - subject = it.subject, - amount = "${it.amount.signToString()}${it.amount} EUR", - counterpart = it.counterpart, - operationDate = DateTime(it.operationDate).toString("Y-M-d"), - valueDate = DateTime(it.valueDate).toString("Y-M-d") + transaction { + history.forEach { + ret.history.add( + CustomerHistoryResponseElement( + subject = it.subject, + amount = "${it.amount.signToString()}${it.amount} EUR", + counterpart = it.counterpart, + operationDate = DateTime(it.operationDate).toString("Y-M-d"), + valueDate = DateTime(it.valueDate).toString("Y-M-d") + ) ) - ) + } } call.respond(ret) return@post