libeufin

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

commit 92c99c46046a58982aa9c874e2f9af6e70037f65
parent d8bb66f402e4aebf3c091bd31dcbadd6cb1995b9
Author: MS <ms@taler.net>
Date:   Thu, 28 May 2020 15:17:44 +0200

facade config table

Diffstat:
Mnexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 18+++++++++++++++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt | 9++++++++-
Mnexus/src/main/kotlin/tech/libeufin/nexus/taler.kt | 6+++---
3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt @@ -280,7 +280,7 @@ object FacadesTable : IdTable<String>() { val bankAccountsWrite = text("bankAccountsWrite") val bankConnectionsRead = text("bankConnectionsRead") val bankConnectionsWrite = text("bankConnectionsWrite") - val config = blob("config").nullable() /* what's the best format to store Any? */ + val config = reference("config", TalerFacadeConfigsTable) } class FacadeEntity(id: EntityID<String>) : Entity<String>(id) { @@ -295,6 +295,22 @@ class FacadeEntity(id: EntityID<String>) : Entity<String>(id) { var config by FacadesTable.config } +object TalerFacadeConfigsTable : IntIdTable() { + val bankAccount = text("bankAccount") + val bankConnection = text("bankConnection") + /* "statement", "report", "notification" */ + val reserveTransferLevel = text("reserveTransferLevel") + val intervalIncrement = text("intervalIncrement") +} + +class TalerFacadeConfigEntity(id: EntityID<Int>) : IntEntity(id) { + companion object : IntEntityClass<TalerFacadeConfigEntity>(TalerFacadeConfigsTable) + var bankAccount by TalerFacadeConfigsTable.bankAccount + var bankConnection by TalerFacadeConfigsTable.bankConnection + /* "statement", "report", "notification" */ + var reserveTransferLevel by TalerFacadeConfigsTable.reserveTransferLevel + var intervalIncrement by TalerFacadeConfigsTable.intervalIncrement +} fun dbCreateTables(dbName: String) { Database.connect("jdbc:sqlite:${dbName}", "org.sqlite.JDBC") diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt @@ -261,7 +261,14 @@ data class FacadeInfo( val bankAccountsWrite: MutableList<String> = mutableListOf(), val bankConnectionsRead: MutableList<String> = mutableListOf(), val bankConnectionsWrite: MutableList<String> = mutableListOf(), - val config: Any + val config: TalerWireGatewayFacadeConfig /* To be abstracted to Any! */ +) + +data class TalerWireGatewayFacadeConfig( + val bankAccount: String, + val bankConnection: String, + val reserveTransferLevel: MutableList<String> = mutableListOf(), + val intervalIncremental: String ) /********************************************************************** diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt @@ -374,7 +374,7 @@ class Taler(app: Route) { * that will soon be refunded.) Recently, the examination of raw OUTGOING * payment was added as well. */ - app.post("/ebics/taler/{id}/crunch-raw-transactions") { + app.post("/{fcid}/taler/{id}/crunch-raw-transactions") { val id = ensureNonNull(call.parameters["id"]) // first find highest ID value of already processed rows. transaction { @@ -463,7 +463,7 @@ class Taler(app: Route) { * merchants but possibly to refund invalid incoming payments. A payment is * counted only if was once confirmed by the bank. */ - app.get("/taler/history/outgoing") { + app.get("/{fcid}/taler/history/outgoing") { /* sanitize URL arguments */ val subscriberId = authenticateRequest(call.request) val delta: Int = expectInt(call.expectUrlParameter("delta")) @@ -501,7 +501,7 @@ class Taler(app: Route) { return@get } /** Responds only with the valid incoming payments */ - app.get("/taler/history/incoming") { + app.get("/{fcid}/taler/history/incoming") { val exchangeUser = authenticateRequest(call.request) val delta: Int = expectInt(call.expectUrlParameter("delta")) val start: Long = handleStartArgument(call.request.queryParameters["start"], delta)