libeufin

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

commit 9c2443754c51686f6573a1922a34877869a19f78
parent c9516d41a4dfcb909c779849935976530e22e023
Author: Antoine A <>
Date:   Wed, 12 Jun 2024 10:17:44 +0200

bank: token api fix

Diffstat:
MAPI_CHANGES.md | 2++
Mbank/src/main/kotlin/tech/libeufin/bank/Constants.kt | 2+-
Mbank/src/main/kotlin/tech/libeufin/bank/api/CoreBankApi.kt | 2+-
Mbank/src/test/kotlin/CoreBankApiTest.kt | 6+++---
4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/API_CHANGES.md b/API_CHANGES.md @@ -59,6 +59,8 @@ This files contains all the API changes for the current release: - GET /config: new wire_transfer_fees field for transaction fees - POST /accounts/USERNAME/withdrawals: drop card_fees field - GET /withdrawals/WITHDRAWAL_ID: make amount optional and add suggested_amount +- POST /accounts/USERNAME/token: add optional description field +- Add GET /accounts/USERNAME/tokens ## bank cli diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Constants.kt b/bank/src/main/kotlin/tech/libeufin/bank/Constants.kt @@ -37,6 +37,6 @@ val RESERVED_ACCOUNTS = setOf("admin", "bank") const val IBAN_ALLOCATION_RETRY_COUNTER: Int = 5 // API version -const val COREBANK_API_VERSION: String = "4:10:1" +const val COREBANK_API_VERSION: String = "4:11:1" const val CONVERSION_API_VERSION: String = "0:1:0" const val INTEGRATION_API_VERSION: String = "2:0:3" diff --git a/bank/src/main/kotlin/tech/libeufin/bank/api/CoreBankApi.kt b/bank/src/main/kotlin/tech/libeufin/bank/api/CoreBankApi.kt @@ -140,7 +140,7 @@ private fun Routing.coreBankTokenApi(db: Database) { db.token.delete(token) call.respond(HttpStatusCode.NoContent) } - get("/accounts/{USERNAME}/token") { + get("/accounts/{USERNAME}/tokens") { val params = PageParams.extract(call.request.queryParameters) val tokens = db.token.page(params, username) if (tokens.isEmpty()) { diff --git a/bank/src/test/kotlin/CoreBankApiTest.kt b/bank/src/test/kotlin/CoreBankApiTest.kt @@ -201,7 +201,7 @@ class CoreBankTokenApiTest { fun get() = bankSetup { // Check OK for (account in listOf("merchant", "customer")) { - client.getA("/accounts/$account/token").assertNoContent() + client.getA("/accounts/$account/tokens").assertNoContent() } client.postA("/accounts/merchant/token") { json { "scope" to "readonly" } @@ -215,13 +215,13 @@ class CoreBankTokenApiTest { "description" to "description" } }.assertOk() - client.getA("/accounts/merchant/token").assertOkJson<TokenInfos> { + client.getA("/accounts/merchant/tokens").assertOkJson<TokenInfos> { assertEquals(2, it.tokens.size) for (token in it.tokens) { assertNull(token.description) } } - client.getA("/accounts/customer/token").assertOkJson<TokenInfos> { + client.getA("/accounts/customer/tokens").assertOkJson<TokenInfos> { assertEquals(1, it.tokens.size) assertEquals("description", it.tokens[0].description) }