summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine A <>2024-03-05 17:29:35 +0100
committerAntoine A <>2024-03-05 17:29:35 +0100
commitead096193d935633959c2e2442ace82fda4d9063 (patch)
treefa59a01a4cd9251db96fbd1d3599080aabef48ed
parent9a87e2c55d0ee50ff9aa5e1a26689f92172b4c72 (diff)
downloadlibeufin-ead096193d935633959c2e2442ace82fda4d9063.tar.gz
libeufin-ead096193d935633959c2e2442ace82fda4d9063.tar.bz2
libeufin-ead096193d935633959c2e2442ace82fda4d9063.zip
bank: add bank_name in config and in TAN messages
-rw-r--r--API_CHANGES.md1
-rw-r--r--bank/src/main/kotlin/tech/libeufin/bank/Config.kt4
-rw-r--r--bank/src/main/kotlin/tech/libeufin/bank/Constants.kt2
-rw-r--r--bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt3
-rw-r--r--bank/src/main/kotlin/tech/libeufin/bank/TalerMessage.kt1
-rw-r--r--contrib/bank.conf5
6 files changed, 12 insertions, 4 deletions
diff --git a/API_CHANGES.md b/API_CHANGES.md
index 4fa605c5..3440e24f 100644
--- a/API_CHANGES.md
+++ b/API_CHANGES.md
@@ -36,6 +36,7 @@ This files contains all the API changes for the current release:
- GET /config: new wire_type field for the bank supported payment target type
- GET /accounts: add row_id field
- GET /public-accounts: add row_id field
+- GET /config: new bank_name field for the bank name
## bank cli
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Config.kt b/bank/src/main/kotlin/tech/libeufin/bank/Config.kt
index 6400d5d6..9c252b8f 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/Config.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/Config.kt
@@ -31,6 +31,7 @@ private val logger: Logger = LoggerFactory.getLogger("libeufin-bank")
* Application the parsed configuration.
*/
data class BankConfig(
+ val name: String,
val regionalCurrency: String,
val regionalCurrencySpec: CurrencySpecification,
val allowRegistration: Boolean,
@@ -124,8 +125,9 @@ fun TalerConfig.loadBankConfig(): BankConfig {
}
}
return BankConfig(
+ name = lookupString("libeufin-bank", "name") ?: "Taler Bank",
regionalCurrency = regionalCurrency,
- regionalCurrencySpec = currencySpecificationFor(regionalCurrency),
+ regionalCurrencySpec = currencySpecificationFor(regionalCurrency),
allowRegistration = lookupBoolean("libeufin-bank", "allow_registration") ?: false,
allowAccountDeletion = lookupBoolean("libeufin-bank", "allow_account_deletion") ?: false,
allowEditName = lookupBoolean("libeufin-bank", "allow_edit_name") ?: false,
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Constants.kt b/bank/src/main/kotlin/tech/libeufin/bank/Constants.kt
index accb5052..48fc3992 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/Constants.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/Constants.kt
@@ -40,7 +40,7 @@ const val IBAN_ALLOCATION_RETRY_COUNTER: Int = 5
const val MAX_BODY_LENGTH: Long = 4 * 1024 // 4kB
// API version
-const val COREBANK_API_VERSION: String = "4:2:0"
+const val COREBANK_API_VERSION: String = "4:3:0"
const val CONVERSION_API_VERSION: String = "0:0:0"
const val INTEGRATION_API_VERSION: String = "2:0:2"
const val WIRE_GATEWAY_API_VERSION: String = "0:2:0"
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt b/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt
index e656bc7b..e584ee9b 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/CoreBankApi.kt
@@ -50,6 +50,7 @@ fun Routing.coreBankApi(db: Database, ctx: BankConfig) {
get("/config") {
call.respond(
Config(
+ bank_name = ctx.name,
currency = ctx.regionalCurrency,
currency_specification = ctx.regionalCurrencySpec,
allow_conversion = ctx.allowConversion,
@@ -663,7 +664,7 @@ private fun Routing.coreBankTanApi(db: Database, ctx: BankConfig) {
res.tanCode?.run {
val (tanScript, tanEnv) = ctx.tanChannels.get(res.tanChannel)
?: throw unsupportedTanChannel(res.tanChannel)
- val msg = "${res.tanCode} is your bank verification code"
+ val msg = "${res.tanCode} is your ${ctx.name} verification code"
val exitValue = withContext(Dispatchers.IO) {
val builder = ProcessBuilder(tanScript.toString(), res.tanInfo)
builder.redirectErrorStream(true)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/TalerMessage.kt b/bank/src/main/kotlin/tech/libeufin/bank/TalerMessage.kt
index d7ddcca0..0284266b 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/TalerMessage.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/TalerMessage.kt
@@ -277,6 +277,7 @@ data class BearerToken(
data class Config(
val currency: String,
val currency_specification: CurrencySpecification,
+ val bank_name: String,
val allow_conversion: Boolean,
val allow_registrations: Boolean,
val allow_deletions: Boolean,
diff --git a/contrib/bank.conf b/contrib/bank.conf
index af7fb252..29239e1e 100644
--- a/contrib/bank.conf
+++ b/contrib/bank.conf
@@ -12,7 +12,10 @@ WIRE_TYPE =
# Bank hostname used in generated x-taler-bank payto URI. Required if WIRE_TYPE = x-taler-bank
# X_TALER_BANK_PAYTO_HOSTNAME = bank.$FOO.taler.net
-# Default debt limit for newly created accounts Default is CURRENCY:0
+# Bank display name, used in webui and TAN messages. Default is "Taler Bank"
+# NAME = "Custom Bank"
+
+# Default debt limit for newly created accounts. Default is CURRENCY:0
# DEFAULT_DEBT_LIMIT = KUDOS:200
# Value of the registration bonus for new users. Default is CURRENCY:0