gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: Improving the "get all the transaction


From: gnunet
Subject: [libeufin] branch master updated: Improving the "get all the transactions" query.
Date: Mon, 04 Sep 2023 11:18:00 +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 26ffdc3a Improving the "get all the transactions" query.
26ffdc3a is described below

commit 26ffdc3a51b6b9c8544e28ee07e4a04382dd5698
Author: MS <ms@taler.net>
AuthorDate: Mon Sep 4 11:15:01 2023 +0200

    Improving the "get all the transactions" query.
    
    Only used in tests, the improvement comes from extending
    the latest point in time where Nexus expects bank transactions
    to be returned.  This lets also the very latest transactions
    to appear in the history.
---
 .../main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt   | 15 ++++++++++++++-
 .../main/kotlin/tech/libeufin/nexus/server/NexusServer.kt |  1 +
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt |  3 ---
 .../kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt  |  1 +
 util/src/main/kotlin/Ebics.kt                             | 11 ++++++++++-
 5 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
index 7af1db69..1548efce 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
@@ -695,12 +695,25 @@ class EbicsBankConnectionProtocol: BankConnectionProtocol 
{
                 val p = EbicsStandardOrderParams()
                 addForLevel(fetchSpec.level, p)
             }
+            /**
+             * This spec wants _all_ the records, therefore the
+             * largest time frame possible needs to be specified.
+             * Rarely employed in production, but useful for tests.
+             */
             is FetchSpecAllJson -> {
                 val start = ZonedDateTime.ofInstant(
                     Instant.EPOCH,
                     ZoneOffset.UTC
                 )
-                val end = ZonedDateTime.ofInstant(Instant.now(), 
ZoneOffset.systemDefault())
+                val end = ZonedDateTime.ofInstant(
+                    /**
+                     * XML date sets the time to 'start of the day'.  By
+                     * adding 24 hours, we make sure today's transactions
+                     * are included in the response.
+                     */
+                    Instant.now().plusSeconds(60 * 60 * 24),
+                    ZoneOffset.systemDefault()
+                )
                 val p = EbicsStandardOrderParams(
                     EbicsDateRange(start, end)
                 )
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index a9d31e63..ef5ff781 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -767,6 +767,7 @@ val nexusApp: Application.() -> Unit = {
             val fetchSpec = if (call.request.hasBody()) {
                 call.receive<FetchSpecJson>()
             } else {
+                logger.warn("fetch-transactions wants statements (they aren't 
implemented at the bank)")
                 FetchSpecLatestJson(
                     FetchLevel.STATEMENT,
                     null
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt
index 243efe2c..79f7a404 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Database.kt
@@ -662,7 +662,4 @@ class Database(private val dbConfig: String) {
             )
         }
     }
-
-    // NOTE: EBICS not needed for BFH and NB.
-
 }
diff --git 
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 98564553..57a61f50 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -481,6 +481,7 @@ private fun constructCamtResponse(
     val history = mutableListOf<XLibeufinBankTransaction>()
     if (type == 52) {
         if (dateRange != null) {
+            logger.debug("Finding date-ranged transactions for account: 
${bankAccount.label}, range: ${dateRange.first}, ${dateRange.second}")
             transaction {
                 BankAccountTransactionEntity.find {
                     BankAccountTransactionsTable.account eq bankAccount.id and
diff --git a/util/src/main/kotlin/Ebics.kt b/util/src/main/kotlin/Ebics.kt
index 036e1c54..8b78932d 100644
--- a/util/src/main/kotlin/Ebics.kt
+++ b/util/src/main/kotlin/Ebics.kt
@@ -110,7 +110,16 @@ private fun getNonce(size: Int): ByteArray {
 
 private fun getXmlDate(d: ZonedDateTime): XMLGregorianCalendar {
     return DatatypeFactory.newInstance()
-        .newXMLGregorianCalendar(d.year, d.monthValue, d.dayOfMonth, 0, 0, 0, 
0, d.offset.totalSeconds / 60)
+        .newXMLGregorianCalendar(
+            d.year,
+            d.monthValue,
+            d.dayOfMonth,
+            0,
+            0,
+            0,
+            0,
+            d.offset.totalSeconds / 60
+        )
 }
 
 private fun makeOrderParams(orderParams: EbicsOrderParams): 
EbicsRequest.OrderParams {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]