taler-typescript-core

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

commit a462642a7c375e0efa47c59b0ba7e61b63799414
parent bca992a5c5e64581e868a6bd610f46ba0bdc8f61
Author: Florian Dold <dold@taler.net>
Date:   Tue, 24 Nov 2026 13:22:27 +0100

wallet-core: reject zero amounts when initiating a peer push payment

Issue: https://bugs.taler.net/n/12114

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-peer-push.ts | 12++++++++++++
Mpackages/taler-wallet-core/src/pay-peer-push-debit.ts | 1+
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-peer-push.ts b/packages/taler-harness/src/integrationtests/test-peer-push.ts @@ -143,6 +143,18 @@ export async function runPeerPushTest(t: GlobalTestState) { t.logStep("P2P push errors"); { + const zeroAmountError = await t.assertThrowsTalerErrorAsync(() => + wallet1.call(WalletApiOperation.InitiatePeerPushDebit, { + partialContractTerms: { summary: "zero amount", amount: "TESTKUDOS:0" }, + }), + ); + t.assertDeepEqual( + zeroAmountError.errorDetail.code, + TalerErrorCode.WALLET_CORE_API_BAD_REQUEST, + ); + t.assertDeepEqual(zeroAmountError.errorDetail.parameter, "amount"); + t.assertDeepEqual(zeroAmountError.errorDetail.stack, undefined); + for (const invalidExpiration of [ TalerProtocolTimestamp.fromSeconds(1), TalerProtocolTimestamp.never(), diff --git a/packages/taler-wallet-core/src/pay-peer-push-debit.ts b/packages/taler-wallet-core/src/pay-peer-push-debit.ts @@ -1485,6 +1485,7 @@ export async function initiatePeerPushDebit( const instructedAmount = Amounts.parseOrThrow( req.partialContractTerms.amount, ); + requirePositivePeerPushDebitAmount(instructedAmount); const currency = Amounts.currencyOf(instructedAmount); const requestedExpiration = req.partialContractTerms.purse_expiration;