diff options
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 { |