libeufin

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

commit a602577777f2345dd60ef499defde7c08e786d24
parent a36f42a1ebfd2ea3e4ff325742fa9b1020852266
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Fri,  8 Nov 2019 13:36:00 +0100

implement GET nexus/ebics/subscribers/{id}

Diffstat:
Mnexus/src/main/kotlin/JSON.kt | 7++++++-
Mnexus/src/main/kotlin/Main.kt | 17+++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/nexus/src/main/kotlin/JSON.kt b/nexus/src/main/kotlin/JSON.kt @@ -16,7 +16,12 @@ data class EbicsSubscriberInfoRequest( * Contain the ID that identifies the new user in the Nexus system. */ data class EbicsSubscriberInfoResponse( - val accountID: Number + val accountID: Number, + val ebicsURL: String, + val hostID: String, + val partnerID: String, + val userID: String, + val systemID: String? ) /** diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt @@ -217,6 +217,23 @@ fun main() { return@get } + get("/ebics/subscribers/{id}") { + val id = expectId(call.parameters["id"]) + val response = transaction { + val tmp = EbicsSubscriberEntity.findById(id) ?: throw SubscriberNotFoundError(HttpStatusCode.NotFound) + EbicsSubscriberInfoResponse( + accountID = tmp.id.value, + hostID = tmp.hostID, + partnerID = tmp.partnerID, + systemID = tmp.systemID, + ebicsURL = tmp.ebicsURL, + userID = tmp.userID + ) + } + call.respond(HttpStatusCode.OK, response) + return@get + } + post("/ebics/subscribers") { val body = try { call.receive<EbicsSubscriberInfoRequest>()