[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 02/08: EBICS subscriber creation.
From: |
gnunet |
Subject: |
[libeufin] 02/08: EBICS subscriber creation. |
Date: |
Wed, 08 Feb 2023 14:32:18 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit 2fa10d5f5a5eeacb1b4407ed9479dd2cb5cff4f9
Author: MS <ms@taler.net>
AuthorDate: Fri Feb 3 17:50:42 2023 +0100
EBICS subscriber creation.
Checking whether the EBICS host exists
before adding the new subscriber.
---
sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 072a5acc..56e2ddb1 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -132,11 +132,11 @@ class Config : CliktCommand("Insert one configuration
(a.k.a. demobank) into the
private val usersDebtLimitOption by
option("--users-debt-limit").int().default(1000)
private val allowRegistrationsOption by option(
"--with-registrations",
- help = "(default: true)" /* mentioning here as help message did not.
*/
+ help = "(defaults to allow registrations)" /* mentioning here as help
message did not. */
).flag("--without-registrations", default = true)
private val withSignupBonusOption by option(
"--with-signup-bonus",
- help = "Award new customers with 100 units of currency! (default:
false)"
+ help = "Award new customers with 100 units of currency! (defaults to
NO bonus)"
).flag("--without-signup-bonus", default = false)
override fun run() {
@@ -937,13 +937,16 @@ val sandboxApp: Application.() -> Unit = {
call.request.basicAuth(onlyAdmin = true)
val body = call.receive<EbicsSubscriberObsoleteApi>()
transaction {
+ // Check the host ID exists.
+ val maybeHostId = EbicsHostEntity.find {
+ EbicsHostsTable.hostID eq body.hostID
+ }.firstOrNull() ?: throw notFound("Host ID ${body.hostID} not
found.")
// Check it exists first.
val maybeSubscriber = EbicsSubscriberEntity.find {
EbicsSubscribersTable.userId eq body.userID and (
EbicsSubscribersTable.partnerId eq body.partnerID
- ) and (
- EbicsSubscribersTable.systemId eq body.systemID
- )
+ ) and (EbicsSubscribersTable.systemId eq
body.systemID) and
+ (EbicsSubscribersTable.hostId eq body.hostID)
}.firstOrNull()
if (maybeSubscriber != null) throw conflict("EBICS subscriber
exists already")
EbicsSubscriberEntity.new {
@@ -1581,6 +1584,10 @@ val sandboxApp: Application.() -> Unit = {
val body = call.receive<EbicsSubscriberInfo>()
// Create or get the Ebics subscriber that is found.
transaction {
+ // Check that host ID exists
+ EbicsHostEntity.find {
+ EbicsHostsTable.hostID eq body.hostID
+ }.firstOrNull() ?: throw notFound("Host ID
${body.hostID} not found.")
val subscriber: EbicsSubscriberEntity =
EbicsSubscriberEntity.find {
(EbicsSubscribersTable.partnerId eq
body.partnerID).and(
EbicsSubscribersTable.userId eq body.userID
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libeufin] branch master updated (64c2d251 -> 6726bb63), gnunet, 2023/02/08
- [libeufin] 05/08: background jobs, gnunet, 2023/02/08
- [libeufin] 02/08: EBICS subscriber creation.,
gnunet <=
- [libeufin] 01/08: help message, gnunet, 2023/02/08
- [libeufin] 03/08: comments, gnunet, 2023/02/08
- [libeufin] 04/08: Tests environment., gnunet, 2023/02/08
- [libeufin] 06/08: implementing #7521, gnunet, 2023/02/08
- [libeufin] 07/08: tests: needed to specify a correct EBICS host ID., gnunet, 2023/02/08
- [libeufin] 08/08: testing the implementation of #7521, gnunet, 2023/02/08