[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 03/04: Fixing C52 dates issue; request ends fine now.
From: |
gnunet |
Subject: |
[libeufin] 03/04: Fixing C52 dates issue; request ends fine now. |
Date: |
Wed, 22 Jan 2020 22:09:24 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
commit 5842398733922c14743772468a1240422fac4d36
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jan 22 20:54:48 2020 +0100
Fixing C52 dates issue; request ends fine now.
---
nexus/src/main/kotlin/JSON.kt | 8 +++++---
.../src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt | 6 ++++--
sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 5 ++++-
sandbox/src/main/python/libeufin-cli | 2 +-
4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/nexus/src/main/kotlin/JSON.kt b/nexus/src/main/kotlin/JSON.kt
index 857e0d1..0140661 100644
--- a/nexus/src/main/kotlin/JSON.kt
+++ b/nexus/src/main/kotlin/JSON.kt
@@ -9,10 +9,12 @@ data class EbicsBackupRequest(
val passphrase: String
)
-
data class EbicsDateRange(
- val start: String, // ISO 8601 calendar date
- val end: String // ISO 8601 calendar date
+ /**
+ * ISO 8601 calendar dates: YEAR-MONTH(01-12)-DAY(1-31)
+ */
+ val start: String,
+ val end: String
)
/**
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index fa6608c..3f74d06 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -128,13 +128,15 @@ private fun iterHistory(customerId: Int, header:
EbicsRequest.Header, base: XmlE
extractHistoryForEach(
customerId,
try {
- (header.static.orderDetails?.orderParams as
EbicsRequest.StandardOrderParams).dateRange?.start.toString()
+ (header.static.orderDetails?.orderParams as
EbicsRequest.StandardOrderParams).dateRange!!.start.toString()
} catch (e: Exception) {
+ LOGGER.debug("Asked to iterate over history with NO start date;
default to now")
getGregorianDate().toString()
},
try {
- (header.static.orderDetails?.orderParams as
EbicsRequest.StandardOrderParams).dateRange?.end.toString()
+ (header.static.orderDetails?.orderParams as
EbicsRequest.StandardOrderParams).dateRange!!.end.toString()
} catch (e: Exception) {
+ LOGGER.debug("Asked to iterate over history with NO end date;
default to now")
getGregorianDate().toString()
}
) {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 39f64ff..04bcb5d 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -170,13 +170,16 @@ fun sampleData() {
}
/**
- * Finds the history for a customer.
+ * Finds the history for a customer
*
* @param id the customer whose history must be returned. This
* id is local to the bank and is not reused/encoded into other
* EBICS id values.
+ * @param builder lambda function that will loop over all the results.
*/
fun extractHistoryForEach(id: Int, start: String?, end: String?, builder:
(BankTransactionEntity) -> Any) {
+
+ LOGGER.debug("Fetching history from $start to $end")
val s = if (start != null) DateTime.parse(start) else DateTime(0)
val e = if (end != null) DateTime.parse(end) else DateTime.now()
diff --git a/sandbox/src/main/python/libeufin-cli
b/sandbox/src/main/python/libeufin-cli
index b36d2cd..b4ec5a4 100755
--- a/sandbox/src/main/python/libeufin-cli
+++ b/sandbox/src/main/python/libeufin-cli
@@ -141,7 +141,7 @@ def c52(obj, customer_id):
url = urljoin(obj["base_url"],
"/ebics/subscribers/{}/sendC52".format(customer_id))
try:
- resp = post(url, json=dict(start="01-01-1970", end="31-12-2020"))
+ resp = post(url, json=dict(start="1970-01-01", end="2020-12-31"))
except Exception:
print("Could not reach the bank")
return
--
To stop receiving notification emails like this one, please contact
address@hidden.