libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 11bed004ab69a5f3d065fe636cb39d2cd9fca6ef
parent 3e0b77584f87b402c4e85a286b65a49c8828374f
Author: Antoine A <>
Date:   Mon,  4 Dec 2023 22:46:31 +0000

Add working default config

Diffstat:
Mbank/conf/test.conf | 1-
Mbank/conf/test_bonus.conf | 1-
Mbank/conf/test_no_conversion.conf | 1-
Mbank/conf/test_no_tan.conf | 1-
Mbank/conf/test_restrict.conf | 1-
Mcontrib/bank.conf | 10+++++-----
Mintegration/conf/integration.conf | 4+---
Mintegration/conf/mini.conf | 5-----
Mintegration/test/IntegrationTest.kt | 20++++++++++----------
Mutil/src/main/kotlin/Client.kt | 2+-
10 files changed, 17 insertions(+), 29 deletions(-)

diff --git a/bank/conf/test.conf b/bank/conf/test.conf @@ -1,5 +1,4 @@ [libeufin-bank] -CURRENCY = KUDOS DEFAULT_DEBT_LIMIT = KUDOS:100 SUGGESTED_WITHDRAWAL_EXCHANGE = https://exchange.example.com ALLOW_REGISTRATION = yes diff --git a/bank/conf/test_bonus.conf b/bank/conf/test_bonus.conf @@ -1,5 +1,4 @@ [libeufin-bank] -CURRENCY = KUDOS REGISTRATION_BONUS = KUDOS:100 ALLOW_REGISTRATION = yes ALLOW_ACCOUNT_DELETION = yes diff --git a/bank/conf/test_no_conversion.conf b/bank/conf/test_no_conversion.conf @@ -1,5 +1,4 @@ [libeufin-bank] -CURRENCY = KUDOS ALLOW_REGISTRATION = yes ALLOW_ACCOUNT_DELETION = yes diff --git a/bank/conf/test_no_tan.conf b/bank/conf/test_no_tan.conf @@ -1,5 +1,4 @@ [libeufin-bank] -CURRENCY = KUDOS DEFAULT_DEBT_LIMIT = KUDOS:100 SUGGESTED_WITHDRAWAL_EXCHANGE = https://exchange.example.com allow_conversion = YES diff --git a/bank/conf/test_restrict.conf b/bank/conf/test_restrict.conf @@ -1,5 +1,4 @@ [libeufin-bank] -CURRENCY = KUDOS DEFAULT_DEBT_LIMIT = KUDOS:100 allow_conversion = YES FIAT_CURRENCY = EUR diff --git a/contrib/bank.conf b/contrib/bank.conf @@ -1,7 +1,7 @@ [libeufin-bank] # Internal currency of the libeufin-bank -# CURRENCY = KUDOS +CURRENCY = KUDOS # Default debt limit for newly created accounts Default is CURRENCY:0 # DEFAULT_DEBT_LIMIT = KUDOS:200 @@ -28,10 +28,10 @@ # TAN_EMAIL = # How "libeufin-bank serve" serves its API, this can either be tcp or unix -# SERVE = tcp +SERVE = tcp # Port on which the HTTP server listens, e.g. 9967. Only used if SERVE is tcp. -# PORT = 8080 +PORT = 8080 # Which unix domain path should we bind to? Only used if SERVE is unix. # UNIXPATH = libeufin-bank.sock @@ -58,4 +58,4 @@ SPA = $DATADIR/spa/ SQL_DIR = $DATADIR/sql/ # DB connection string -#CONFIG = postgresql:///libeufinbank -\ No newline at end of file +CONFIG = postgresql:///libeufin +\ No newline at end of file diff --git a/integration/conf/integration.conf b/integration/conf/integration.conf @@ -1,5 +1,4 @@ [libeufin-bank] -CURRENCY = KUDOS SUGGESTED_WITHDRAWAL_EXCHANGE = https://exchange.example.com ALLOW_REGISTRATION = yes ALLOW_ACCOUNT_DELETION = yes @@ -7,8 +6,7 @@ allow_conversion = YES FIAT_CURRENCY = EUR tan_sms = libeufin-tan-file.sh tan_email = libeufin-tan-fail.sh -SERVE = tcp -PORT = 8080 +PORT = 8090 [libeufin-bankdb-postgres] CONFIG = postgresql:///libeufincheck diff --git a/integration/conf/mini.conf b/integration/conf/mini.conf @@ -1,7 +1,2 @@ -[libeufin-bank] -CURRENCY = KUDOS -SERVE = tcp -PORT = 8090 - [libeufin-bankdb-postgres] CONFIG = postgresql:///libeufincheck \ No newline at end of file diff --git a/integration/test/IntegrationTest.kt b/integration/test/IntegrationTest.kt @@ -76,7 +76,7 @@ class IntegrationTest { runBlocking { // Check bank is running - client.get("http://0.0.0.0:8090/public-accounts").assertNoContent() + client.get("http://0.0.0.0:8080/public-accounts").assertNoContent() } } @@ -96,7 +96,7 @@ class IntegrationTest { val fiatPayTo = IbanPayTo(genIbanPaytoUri()) // Create user - client.post("http://0.0.0.0:8080/accounts") { + client.post("http://0.0.0.0:8090/accounts") { basicAuth("admin", "password") json { "username" to "customer" @@ -112,7 +112,7 @@ class IntegrationTest { }.assertOkJson<RegisterAccountResponse>() // Set conversion rates - client.post("http://0.0.0.0:8080/conversion-info/conversion-rate") { + client.post("http://0.0.0.0:8090/conversion-info/conversion-rate") { basicAuth("admin", "password") json { "cashin_ratio" to "0.8" @@ -129,7 +129,7 @@ class IntegrationTest { }.assertNoContent() // Set admin debit threshold - client.patch("http://0.0.0.0:8080/accounts/admin") { + client.patch("http://0.0.0.0:8090/accounts/admin") { basicAuth("admin", "password") json { "debit_threshold" to "KUDOS:1000" @@ -147,16 +147,16 @@ class IntegrationTest { executionTime = Instant.now(), bankTransferId = "entropic"), reservePub) - val converted = client.get("http://0.0.0.0:8080/conversion-info/cashin-rate?amount_debit=EUR:${20 + i}") + val converted = client.get("http://0.0.0.0:8090/conversion-info/cashin-rate?amount_debit=EUR:${20 + i}") .assertOkJson<ConversionResponse>().amount_credit - client.get("http://0.0.0.0:8080/accounts/exchange/transactions") { + client.get("http://0.0.0.0:8090/accounts/exchange/transactions") { basicAuth("exchange", "password") }.assertOkJson<BankAccountTransactionsResponse> { val tx = it.transactions.first() assertEquals("cashin test $i", tx.subject) assertEquals(converted, tx.amount) } - client.get("http://0.0.0.0:8080/accounts/exchange/taler-wire-gateway/history/incoming") { + client.get("http://0.0.0.0:8090/accounts/exchange/taler-wire-gateway/history/incoming") { basicAuth("exchange", "password") }.assertOkJson<IncomingHistory> { val tx = it.incoming_transactions.first() @@ -169,9 +169,9 @@ class IntegrationTest { repeat(3) { i -> val requestUid = randBytes(32); val amount = BankAmount("KUDOS:${10+i}") - val convert = client.get("http://0.0.0.0:8080/conversion-info/cashout-rate?amount_debit=$amount") + val convert = client.get("http://0.0.0.0:8090/conversion-info/cashout-rate?amount_debit=$amount") .assertOkJson<ConversionResponse>().amount_credit; - client.post("http://0.0.0.0:8080/accounts/customer/cashouts") { + client.post("http://0.0.0.0:8090/accounts/customer/cashouts") { basicAuth("customer", "password") json { "request_uid" to ShortHashCode(requestUid) @@ -180,7 +180,7 @@ class IntegrationTest { } }.assertOkJson<CashoutPending> { val code = File("/tmp/tan-+99.txt").readText() - client.post("http://0.0.0.0:8080/accounts/customer/cashouts/${it.cashout_id}/confirm") { + client.post("http://0.0.0.0:8090/accounts/customer/cashouts/${it.cashout_id}/confirm") { basicAuth("customer", "password") json { "tan" to code } }.assertNoContent() diff --git a/util/src/main/kotlin/Client.kt b/util/src/main/kotlin/Client.kt @@ -74,7 +74,7 @@ inline suspend fun <reified B> HttpResponse.json(): B = Json.decodeFromString(kotlinx.serialization.serializer<B>(), bodyAsText()) inline suspend fun <reified B> HttpResponse.assertOkJson(lambda: (B) -> Unit = {}): B { - assertEquals(status, HttpStatusCode.OK) + assertEquals(HttpStatusCode.OK, status) val body = json<B>() lambda(body) return body