libeufin

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

commit 01d0acf19a84fa10d97b2df533c4b7ea1151ad82
parent 297db5d984e36b3c44a72b9a8d627fe0b38e3c27
Author: MS <ms@taler.net>
Date:   Tue, 17 Aug 2021 03:50:29 -1100

enable Anastasis facade and offer API.

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/Anastasis.kt | 9+++++++++
Mnexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt | 8++++++--
2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Anastasis.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Anastasis.kt @@ -1,6 +1,7 @@ package tech.libeufin.nexus import io.ktor.application.* +import io.ktor.client.* import io.ktor.http.* import io.ktor.response.* import org.jetbrains.exposed.sql.transactions.transaction @@ -12,6 +13,7 @@ import tech.libeufin.util.EbicsProtocolError import kotlin.math.abs import kotlin.math.min import io.ktor.content.TextContent +import io.ktor.routing.* data class AnastasisIncomingBankTransaction( val row_id: Long, @@ -103,4 +105,11 @@ private suspend fun historyIncoming(call: ApplicationCall) { } } return call.respond(TextContent(customConverter(history), ContentType.Application.Json)) +} + +fun anastasisFacadeRoutes(route: Route, httpClient: HttpClient) { + route.get("/history/incoming") { + historyIncoming(call) + return@get + } } \ No newline at end of file diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt @@ -61,7 +61,7 @@ import kotlin.system.exitProcess fun getFacadeState(type: String, facade: FacadeEntity): JsonNode { return transaction { when (type) { - "taler-wire-gateway" -> { + "taler-wire-gateway", "anastasis" -> { val state = FacadeStateEntity.find { FacadeStateTable.facade eq facade.id }.firstOrNull() @@ -959,7 +959,8 @@ fun serverMain(host: String, port: Int) { requireSuperuser(call.request) val body = call.receive<FacadeInfo>() requireValidResourceName(body.name) - if (body.type != "taler-wire-gateway") throw NexusError( + if (!listOf("taler-wire-gateway", "anastasis").contains(body.type)) + throw NexusError( HttpStatusCode.NotImplemented, "Facade type '${body.type}' is not implemented" ) @@ -1048,6 +1049,9 @@ fun serverMain(host: String, port: Int) { route("/facades/{fcid}/taler-wire-gateway") { talerFacadeRoutes(this, client) } + route("/facades/{fcid}/anastasis") { + anastasisFacadeRoutes(this, client) + } // Hello endpoint. get("/") {