commit 7d3d0f8e95ff3fe9185cd78bcaa2fa7ca1d33ec1 parent 0f22d20b38e0c5233388b57ad7842d07065e8bcc Author: MS <ms@taler.net> Date: Sat, 21 Aug 2021 22:57:22 -1100 sanity checks Diffstat:
| M | sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -566,6 +566,13 @@ fun serverMain(dbName: String, port: Int) { body.subscriber.partnerID, body.subscriber.hostID ) + val check = BankAccountEntity.find { + BankAccountsTable.iban eq body.iban or(BankAccountsTable.label eq body.label) + }.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