gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 01/02: Fixing tests.


From: gnunet
Subject: [libeufin] 01/02: Fixing tests.
Date: Wed, 07 Jun 2023 17:04:03 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

commit 939840d0082588075ea68bb6c58562558e80e3dc
Author: MS <ms@taler.net>
AuthorDate: Wed Jun 7 16:50:03 2023 +0200

    Fixing tests.
    
    Addressing libeufin-tutorial TypeScript test failure.
---
 .../src/main/kotlin/tech/libeufin/sandbox/Main.kt  | 57 +++++++---------------
 1 file changed, 17 insertions(+), 40 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index dfb20ffc..1f16da78 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -852,48 +852,25 @@ val sandboxApp: Application.() -> Unit = {
         post("/admin/ebics/bank-accounts") {
             call.request.basicAuth(onlyAdmin = true)
             val body = call.receive<EbicsBankAccountRequest>()
-            if (!validateBic(body.bic)) {
-                throw SandboxError(HttpStatusCode.BadRequest, "invalid BIC 
(${body.bic})")
-            }
-            transaction {
-                val subscriber = getEbicsSubscriberFromDetails(
-                    body.subscriber.userID,
-                    body.subscriber.partnerID,
-                    body.subscriber.hostID
-                )
-                if (subscriber.bankAccount != null)
-                    throw conflict("subscriber has already a bank account: 
${subscriber.bankAccount?.label}")
-                val demobank = getDefaultDemobank()
-                // Forbid institutional names for bank account.
-                if (body.label == "admin" || body.label == "bank") throw 
forbidden(
-                    "Requested bank account label '${body.label}' not allowed."
-                )
+            val subscriber = getEbicsSubscriberFromDetails(
+                body.subscriber.userID,
+                body.subscriber.partnerID,
+                body.subscriber.hostID
+            )
+            val res = insertNewAccount(
+                username = body.label,
                 /**
-                 * Checking that the default demobank doesn't have already the
-                 * requested IBAN and bank account label.
+                 * This value makes only happy the account creator helper.
+                 * Logic using this OBSOLETE HTTP handler would NOT expect
+                 * to use this password anyway.  The reason is that such 
obsolete
+                 * tests access their banking data always through the EBICS
+                 * subscriber, needing therefore no HTTP basic password to 
operate.
                  */
-                val check = BankAccountEntity.find {
-                    BankAccountsTable.iban eq body.iban or (
-                            (BankAccountsTable.label eq body.label) and (
-                                    BankAccountsTable.demoBank eq demobank.id
-                                    )
-                            )
-                }.count()
-                if (check > 0) throw SandboxError(
-                    HttpStatusCode.BadRequest,
-                    "Either IBAN or account label were already taken; please 
choose fresh ones"
-                )
-                subscriber.bankAccount = BankAccountEntity.new {
-                    iban = body.iban
-                    bic = body.bic
-                    label = body.label
-                    /* Current version invariant:
-                       owner's username == bank account label. */
-                    owner = body.label
-                    demoBank = demobank
-                }
-            }
-            call.respondText("Bank account created")
+                password = "not-used",
+                iban = body.iban
+            )
+            transaction { subscriber.bankAccount = res.bankAccount }
+            call.respond({})
             return@post
         }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]