commit f5e670cc0bb8dc8424eb1aa891fc0161064395ca
parent 3a6f61da1d111313b0bf74ccc1ce0f43eec00e52
Author: Florian Dold <florian@dold.me>
Date: Mon, 25 Sep 2023 00:41:35 +0200
get is_public properly from DB
Diffstat:
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/CorebankApiHandlers.kt b/bank/src/main/kotlin/tech/libeufin/bank/CorebankApiHandlers.kt
@@ -118,8 +118,8 @@ fun Routing.accountsMgmtHandlers(db: Database, ctx: BankApplicationContext) {
maybeCustomerExists.email == req.challenge_contact_data?.email &&
maybeCustomerExists.phone == req.challenge_contact_data?.phone &&
maybeCustomerExists.cashoutPayto == req.cashout_payto_uri &&
- CryptoUtil.checkpw(req.password, maybeCustomerExists.passwordHash)
- && maybeHasBankAccount.isPublic == req.is_public &&
+ CryptoUtil.checkpw(req.password, maybeCustomerExists.passwordHash) &&
+ maybeHasBankAccount.isPublic == req.is_public &&
maybeHasBankAccount.isTalerExchange == req.is_taler_exchange &&
maybeHasBankAccount.internalPaytoUri == internalPayto
if (isIdentic) {
@@ -132,7 +132,9 @@ fun Routing.accountsMgmtHandlers(db: Database, ctx: BankApplicationContext) {
hint = "Idempotency check failed."
)
)
- } // From here: fresh user being added.
+ }
+
+ // From here: fresh user being added.
val newCustomer = Customer(
login = req.username,
name = req.name,
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Database.kt b/bank/src/main/kotlin/tech/libeufin/bank/Database.kt
@@ -427,6 +427,7 @@ class Database(private val dbConfig: String, private val bankCurrency: String) {
owningCustomerId = it.getLong("owning_customer_id"),
hasDebt = it.getBoolean("has_debt"),
isTalerExchange = it.getBoolean("is_taler_exchange"),
+ isPublic = it.getBoolean("is_public"),
maxDebt = TalerAmount(
value = it.getLong("max_debt_val"),
frac = it.getInt("max_debt_frac"),
diff --git a/bank/src/test/kotlin/LibeuFinApiTest.kt b/bank/src/test/kotlin/LibeuFinApiTest.kt
@@ -270,6 +270,7 @@ class LibeuFinApiTest {
"username": "foo",
"password": "bar",
"name": "Jane",
+ "is_public": true,
"internal_payto_uri": "$ibanPayto"
}""".trimIndent()
)
@@ -284,6 +285,7 @@ class LibeuFinApiTest {
"username": "foo",
"password": "bar",
"name": "Jane",
+ "is_public": true,
"internal_payto_uri": "$ibanPayto"
}""".trimIndent()
)