commit 8e198543423b6bd5e90b5d96ac73676ea5070b57
parent a4055896afb9672b1b5505877f255b8c0380aa99
Author: ms <ms@taler.net>
Date: Wed, 4 May 2022 11:59:54 +0200
remove last transparent demobank creation
Diffstat:
2 files changed, 7 insertions(+), 31 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
@@ -173,30 +173,6 @@ fun getDefaultDemobank(): DemobankConfigEntity {
)
}
-fun maybeCreateDefaultDemobank(withSignupBonus: Boolean = false) {
- transaction {
- if (DemobankConfigEntity.all().empty()) {
- DemobankConfigEntity.new {
- currency = "CHF"
- bankDebtLimit = 1000000
- usersDebtLimit = 10000
- allowRegistrations = true
- name = "default"
- this.withSignupBonus = withSignupBonus
- }
- // Give one demobank a own bank account, mainly to award
- // customer upon registration.
- BankAccountEntity.new {
- iban = getIban()
- label = "bank" // used by the wire helper
- owner = "bank" // used by the person name finder
- // For now, the model assumes always one demobank
- demoBank = getFirstDemobank()
- }
- }
- }
-}
-
fun wireTransfer(
debitAccount: String,
creditAccount: String,
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -247,13 +247,13 @@ class MakeTransaction : CliktCommand("Wire-transfer money between Sandbox bank a
override fun run() {
val dbConnString = getDbConnFromEnv(SANDBOX_DB_ENV_VAR_NAME)
Database.connect(dbConnString)
- /**
- * The function below create a default demobank
- * if the 'config' command was never run before this point.
- *
- * This helps porting current tests to the "demobank model".
- */
- maybeCreateDefaultDemobank()
+ // Refuse to operate without a default demobank.
+ val demobank = getDemobank("default")
+ if (demobank == null) {
+ println("Sandbox cannot operate without a 'default' demobank.")
+ println("Please make one with the 'libeufin-cli config' command.")
+ exitProcess(1)
+ }
try {
wireTransfer(debitAccount, creditAccount, demobankArg, subjectArg, amount)
} catch (e: SandboxError) {