commit 592980fbde5d47aa2847c2237482042c85c37f57 parent c05b51ff10c8ef4b82f6f22b7b1a1c7a79407d56 Author: Florian Dold <dold@taler.net> Date: Tue, 21 Jul 2026 11:13:18 +0200 util: align corebank status and parameter handling with the spec An unknown account was reported as a successful empty token list, the monitor timeframe dropped its first enum member, and the cash-out rate mapped the documented Taler error codes back onto a plain 400. Diffstat:
5 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/packages/libeufin-bank-webui/src/pages/ConversionRateClassDetails.tsx b/packages/libeufin-bank-webui/src/pages/ConversionRateClassDetails.tsx @@ -897,8 +897,6 @@ function TestConversionClass({ i18n.str`Failed to calculate the cashout fee.`, (fail) => { switch (fail.case) { - case HttpStatusCode.BadRequest: - return i18n.str`The server didn't understand the request.`; case HttpStatusCode.Conflict: return i18n.str`The amount is too small`; case HttpStatusCode.NotImplemented: diff --git a/packages/libeufin-bank-webui/src/pages/regional/ConversionConfig.tsx b/packages/libeufin-bank-webui/src/pages/regional/ConversionConfig.tsx @@ -204,8 +204,6 @@ function useComponentState({ i18n.str`Failed to calculate cashout fee.`, (fail) => { switch (fail.case) { - case HttpStatusCode.BadRequest: - return i18n.str`The server didn't understand the request.`; case HttpStatusCode.Conflict: return i18n.str`The amount is too small`; case HttpStatusCode.NotImplemented: diff --git a/packages/libeufin-bank-webui/src/pages/regional/CreateCashout.tsx b/packages/libeufin-bank-webui/src/pages/regional/CreateCashout.tsx @@ -299,8 +299,6 @@ function CreateCashoutInternal({ i18n.str`Failed to calculate the conversion fee.`, (fail) => { switch (fail.case) { - case HttpStatusCode.BadRequest: - return i18n.str`The server didn't understand the request.`; case HttpStatusCode.Conflict: return i18n.str`The amount is too small`; case HttpStatusCode.NotImplemented: diff --git a/packages/taler-util/src/http-client/bank-conversion.ts b/packages/taler-util/src/http-client/bank-conversion.ts @@ -208,11 +208,11 @@ export class TalerBankConversionHttpClient { const details = codecForTalerErrorDetail().decode(body); switch (details.code) { case TalerErrorCode.GENERIC_PARAMETER_MISSING: - return opKnownHttpFailure(resp.status, resp); + return opKnownTalerFailure(resp, details.code, details); case TalerErrorCode.GENERIC_PARAMETER_MALFORMED: - return opKnownHttpFailure(resp.status, resp); + return opKnownTalerFailure(resp, details.code, details); case TalerErrorCode.GENERIC_CURRENCY_MISMATCH: - return opKnownHttpFailure(resp.status, resp); + return opKnownTalerFailure(resp, details.code, details); default: return opUnknownHttpFailure(resp, details); } diff --git a/packages/taler-util/src/http-client/bank-core.ts b/packages/taler-util/src/http-client/bank-core.ts @@ -249,7 +249,11 @@ export class TalerCoreBankHttpClient { pagination?: PaginationParams, ): Promise< | OperationOk<TokenInfos> - | OperationFail<HttpStatusCode.Unauthorized | HttpStatusCode.Forbidden> + | OperationFail< + | HttpStatusCode.Unauthorized + | HttpStatusCode.Forbidden + | HttpStatusCode.NotFound + > > { const url = new URL(`accounts/${pathSegment(user)}/tokens`, this.baseUrl); addPaginationParams(url, pagination); @@ -269,7 +273,7 @@ export class TalerCoreBankHttpClient { case HttpStatusCode.Forbidden: return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.NotFound: - return opFixedSuccess(resp, { tokens: [] }); + return opKnownHttpFailure(resp.status, resp); default: return opUnknownHttpFailure(resp); } @@ -1439,7 +1443,8 @@ export class TalerCoreBankHttpClient { } = {}, ) { const url = new URL(`monitor`, this.baseUrl); - if (params.timeframe) { + // The first member of the enum is 0, so a truthiness test would drop it. + if (params.timeframe !== undefined) { url.searchParams.set( "timeframe", MonitorTimeframeParam[params.timeframe],