aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2023-08-02 12:50:00 +0200
committerMS <ms@taler.net>2023-08-02 12:50:00 +0200
commitf8c9db87e4165493b97f95a4fafac70105985075 (patch)
treee1820df4e81fb8e7cf388bf5c815149d919b95da
parent4130342d91be14504b7dabd9c156333155828a8f (diff)
downloadlibeufin-f8c9db87e4165493b97f95a4fafac70105985075.tar.gz
libeufin-f8c9db87e4165493b97f95a4fafac70105985075.tar.bz2
libeufin-f8c9db87e4165493b97f95a4fafac70105985075.zip
Time-framed query.
Fixing how Nexus defines the 'start' and 'end' URI parameters along x-libeufin-bank requests.
-rw-r--r--nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt4
-rw-r--r--util/src/main/kotlin/time.kt5
2 files changed, 7 insertions, 2 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
index b6f025bf..6fbc8ca6 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
@@ -268,8 +268,8 @@ class XlibeufinBankConnectionProtocol : BankConnectionProtocol {
// the parse() method defaults to the YYYY-MM-DD format.
val start: LocalDate = LocalDate.parse(fetchSpec.start)
val end: LocalDate = LocalDate.parse(fetchSpec.end)
- this.parameters["from_ms"] = start.toString()
- this.parameters["to_ms"] = end.toString()
+ this.parameters["from_ms"] = start.millis().toString()
+ this.parameters["to_ms"] = end.millis().toString()
}
// Gets the last 5 transactions
is FetchSpecLatestJson -> {
diff --git a/util/src/main/kotlin/time.kt b/util/src/main/kotlin/time.kt
index 867d1950..13394537 100644
--- a/util/src/main/kotlin/time.kt
+++ b/util/src/main/kotlin/time.kt
@@ -54,6 +54,11 @@ fun LocalDateTime.millis(): Long {
return instant.toEpochMilli()
}
+fun LocalDate.millis(): Long {
+ val instant = Instant.from(this)
+ return instant.toEpochMilli()
+}
+
fun parseDashedDate(maybeDashedDate: String?): LocalDate {
if (maybeDashedDate == null)
throw badRequest("dashed date found as null")