commit f0b8d057dd6308c2f0f43f54bdb1066623121755
parent 7abbdf16022f06178d4acd5c6142198a6e958c01
Author: Florian Dold <florian.dold@gmail.com>
Date: Tue, 16 Jun 2020 19:00:37 +0530
fetching
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
@@ -143,9 +143,13 @@ abstract class FetchSpecJson(
val bankConnection: String?
)
+@JsonTypeName("latest")
class FetchSpecLatestJson(level: FetchLevel, bankConnection: String?) : FetchSpecJson(level, bankConnection)
+@JsonTypeName("all")
class FetchSpecAllJson(level: FetchLevel, bankConnection: String?) : FetchSpecJson(level, bankConnection)
+@JsonTypeName("since-last")
class FetchSpecSinceLastJson(level: FetchLevel, bankConnection: String?) : FetchSpecJson(level, bankConnection)
+@JsonTypeName("previous-days")
class FetchSpecPreviousDaysJson(level: FetchLevel, bankConnection: String?, val number: Int) :
FetchSpecJson(level, bankConnection)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/EbicsNexus.kt
@@ -48,6 +48,7 @@ import tech.libeufin.util.*
import tech.libeufin.util.ebics_h004.HTDResponseOrderData
import java.io.ByteArrayOutputStream
import java.security.interfaces.RSAPrivateCrtKey
+import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.*
@@ -78,6 +79,21 @@ suspend fun fetchEbicsBySpec(fetchSpec: FetchSpecJson, client: HttpClient, bankC
}
}
}
+ is FetchSpecAllJson -> {
+ val p = EbicsStandardOrderParams(EbicsDateRange(LocalDate.EPOCH, LocalDate.now()))
+ when (fetchSpec.level) {
+ FetchLevel.ALL -> {
+ specs.add(EbicsFetchSpec("C52", p))
+ specs.add(EbicsFetchSpec("C53", p))
+ }
+ FetchLevel.REPORT -> {
+ specs.add(EbicsFetchSpec("C52", p))
+ }
+ FetchLevel.STATEMENT -> {
+ specs.add(EbicsFetchSpec("C53", p))
+ }
+ }
+ }
}
for (spec in specs) {
fetchEbicsC5x(spec.orderType, client, bankConnectionId, spec.orderParams, subscriberDetails)