taler-typescript-core

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

commit 9ac8c735d8883f3941471782645f6a1af62e1e2f
parent 1b2f3f4d078e3afb76d2efba2b2ce1d16d6b2d86
Author: Florian Dold <dold@taler.net>
Date:   Wed, 22 Jul 2026 00:32:28 +0200

wallet: check for a missing exchange reply on an insufficient-funds error

Reading the reply code straight off the merchant error raised a
TypeError when the field was absent, which surfaced as an unexpected
error and kept the payment retrying instead of failing it as a protocol
violation.

Diffstat:
Mpackages/taler-wallet-core/src/pay-merchant.ts | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts @@ -1769,6 +1769,13 @@ async function handleInsufficientFunds( err.code === TalerErrorCode.MERCHANT_POST_ORDERS_ID_PAY_INSUFFICIENT_FUNDS ) { const exchangeReply = (err as any).exchange_reply; + if (exchangeReply == null) { + await ctx.failTransaction(proposal.purchaseStatus, { + code: TalerErrorCode.WALLET_TRANSACTION_PROTOCOL_VIOLATION, + message: "merchant claimed insufficient funds without an exchange reply", + }); + return TaskRunResult.progress(); + } if ( exchangeReply.code !== TalerErrorCode.EXCHANGE_GENERIC_INSUFFICIENT_FUNDS ) {