taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 766e2b804402f7ffc1e1d9df8229af358c14c0b1
parent e5af9b9dde8b665de212fec99d49e1ce72956a7d
Author: Florian Dold <dold@taler.net>
Date:   Thu,  3 Sep 2026 15:47:38 +0200

wallet-core: settle a refund query the merchant answers with 204

The merchant sends 204 when the paid order has no refund; treating it
as an unknown failure retried the query forever.

Diffstat:
Mpackages/taler-util/src/http-client/merchant.ts | 4++++
Mpackages/taler-wallet-core/src/pay-merchant.ts | 9+++++----
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/packages/taler-util/src/http-client/merchant.ts b/packages/taler-util/src/http-client/merchant.ts @@ -94,6 +94,7 @@ import { opEmptySuccess, opFixedSuccess, opKnownAlternativeHttpFailure, + opKnownFailure, opKnownFailureWithBody, opKnownHttpFailure, opKnownTalerFailure, @@ -767,6 +768,9 @@ export class TalerMerchantInstanceHttpClient { ); return opSuccessFromHttp(resp, codecForWalletRefundResponse()); } + // The order is paid but has no refund; the body is empty. + case HttpStatusCode.NoContent: + return opKnownFailure(resp, HttpStatusCode.NoContent); case HttpStatusCode.BadRequest: return opKnownHttpFailure(resp.status, resp); case HttpStatusCode.Forbidden: diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts @@ -5807,9 +5807,10 @@ async function processPurchaseAcceptRefund( h_contract: download.contractTermsHash, }, ); - if (isOrderUnknown(request)) { - // The merchant deleted the order, so the refund it announced can never be - // collected anymore. The payment itself stays valid. + if (isOrderUnknown(request) || request.case === HttpStatusCode.NoContent) { + // The merchant deleted the order, or has no refund for this payment + // after all, so nothing can be collected. The payment itself stays + // valid. const ctx = new PayMerchantTransactionContext(wex, purchase.proposalId); await wex.runWalletDbTx(async (tx) => { const [p, h] = await ctx.getRecordHandle(tx); @@ -5818,7 +5819,7 @@ async function processPurchaseAcceptRefund( } p.purchaseStatus = PurchaseStatus.Done; p.refundAmountAwaiting = undefined; - await h.update(p, "accept-refund-order-gone"); + await h.update(p, "accept-refund-none"); }); return TaskRunResult.progress(); }