libeufin

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

commit 5842398733922c14743772468a1240422fac4d36
parent 1d3c9aa738e8801750bc899efe968500aaaeb6ba
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Wed, 22 Jan 2020 20:54:48 +0100

Fixing C52 dates issue; request ends fine now.

Diffstat:
Mnexus/src/main/kotlin/JSON.kt | 8+++++---
Msandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt | 6++++--
Msandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 5++++-
Msandbox/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 @@ -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 @@ -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 @@ -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 @@ -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