libeufin

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

commit f24e223a17be232485bed5696f1a3800d023f4ef
parent 96898782fa6809d9b680cbbc74086aaf036ee9c5
Author: MS <ms@taler.net>
Date:   Thu, 14 May 2020 20:34:33 +0200

fix db query

Diffstat:
Mintegration-tests/test-ebics-new.py | 15++++++++-------
Mnexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 7+++++--
2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/integration-tests/test-ebics-new.py b/integration-tests/test-ebics-new.py @@ -258,17 +258,18 @@ assertResponse( ) ) -nexus.terminate() -sandbox.terminate() -exit(44) - -#4 +#4, make sure history is empty resp = assertResponse( get( - "http://localhost:5001/users/{}/history".format(USERNAME) + "http://localhost:5001/bank-accounts/{}/collected-transactions".format(BANK_ACCOUNT_LABEL), + headers=dict(Authorization=USER_AUTHORIZATION_HEADER) ) ) -assert(len(resp.json().get("payments")) == 0) +assert(len(resp.json().get("transactions")) == 0) + +nexus.terminate() +sandbox.terminate() +exit(44) #5.a assertResponse( diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt @@ -414,15 +414,17 @@ fun main() { */ get("/bank-accounts/{accountid}/collected-transactions") { val userId = authenticateRequest(call.request.headers["Authorization"]) + val bankAccount = expectNonNull(call.parameters["accountid"]) val start = call.request.queryParameters["start"] val end = call.request.queryParameters["end"] val ret = Transactions() transaction { RawBankTransactionEntity.find { RawBankTransactionsTable.nexusUser eq userId and + (RawBankTransactionsTable.bankAccount eq bankAccount) and RawBankTransactionsTable.bookingDate.between( - parseDashedDate(start ?: "1970-01-01"), - parseDashedDate(end ?: DateTime.now().toDashedDate()) + parseDashedDate(start ?: "1970-01-01").millis, + parseDashedDate(end ?: DateTime.now().toDashedDate()).millis ) }.forEach { ret.transactions.add( @@ -438,6 +440,7 @@ fun main() { ) } } + call.respond(ret) return@get } /**