taler-typescript-core

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

commit 69220e06d04da55bf62f5245a651146df0edb73e
parent 8c486806206f02e46c820933bb93718778aa51ed
Author: Florian Dold <dold@taler.net>
Date:   Tue, 24 Nov 2026 16:44:55 +0100

wallet web UI: show the uncollected amount when a refund stops

Collection can stop after some coins have been refunded. Show the
confirmed and uncollected amounts separately in the transaction details.

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

Diffstat:
Mpackages/wallet-webui/src/routes/transaction-model.ts | 12++++++++++++
Mpackages/wallet-webui/test/transaction-model.test.ts | 29+++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/packages/wallet-webui/src/routes/transaction-model.ts b/packages/wallet-webui/src/routes/transaction-model.ts @@ -308,6 +308,13 @@ export function transactionStateView(transaction: ObservedTransaction): { tone: "warning", }; case TransactionMajorState.Aborted: + if (transaction.type === TransactionType.Refund) { + return { + label: i18n.str`Refund collection stopped`, + detail: i18n.str`Any confirmed refund is shown below.`, + tone: "neutral", + }; + } return { label: minor ?? @@ -432,6 +439,11 @@ function fieldsFor(transaction: ObservedTransaction): TransactionDetailField[] { value: transaction.amountEffective, }, ); + if (transaction.amountUncollected) + fields.push({ + label: i18n.str`Uncollected refund amount`, + value: transaction.amountUncollected, + }); fields.push({ label: /* Translators: The earlier wallet transaction to which this refund belongs. */ i18n.str`Original payment`, value: transaction.refundedTransactionId, diff --git a/packages/wallet-webui/test/transaction-model.test.ts b/packages/wallet-webui/test/transaction-model.test.ts @@ -10,6 +10,8 @@ import { internalSetStrings, setupI18n, type TransactionPayment, + type TransactionRefund, + type TransactionIdStr, type TransactionDeposit, type TransactionPeerPushDebit, type TransactionWithdrawal, @@ -185,6 +187,33 @@ test("history maps payment identity, direction and DD37 progress", () => { assert.equal(view.pending, true); }); +test("stopped refunds distinguish confirmed and uncollected amounts", () => { + const refund: TransactionRefund = { + ...payment(), + type: TransactionType.Refund, + transactionId: "txn:refund:partial" as TransactionIdStr, + refundedTransactionId: "txn:payment:sample", + paymentInfo: undefined, + txState: { major: TransactionMajorState.Aborted }, + amountRaw: "CHF:3", + amountEffective: "CHF:2.90", + amountEffectiveFinal: "CHF:2.90", + amountUncollected: "CHF:2", + txActions: [TransactionAction.Delete], + }; + const view = transactionDetailView(refund); + assert.equal(view.state, "Refund collection stopped"); + assert.equal(view.pending, false); + assert.ok( + view.fields.some((f) => f.label === "Refund amount" && f.value === "CHF:3"), + ); + assert.ok( + view.fields.some( + (f) => f.label === "Uncollected refund amount" && f.value === "CHF:2", + ), + ); +}); + test("transaction presentations follow runtime language changes", () => { internalSetStrings({ locale_data: {