taler-typescript-core

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

commit 0d555b6a5ddb95309bfef1a2884bde405fb6e59a
parent f384e3996bbe2e88b07ec5ffe11f42a238fa9d6d
Author: Florian Dold <dold@taler.net>
Date:   Wed, 22 Jul 2026 10:46:31 +0200

wallet: group donation receipts by currency as well

Receipts of a group are summed up, so a group holding more than one currency
made the summation throw.

Diffstat:
Mpackages/taler-wallet-core/src/donau.ts | 8+++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/packages/taler-wallet-core/src/donau.ts b/packages/taler-wallet-core/src/donau.ts @@ -231,7 +231,8 @@ function groupDonauReceipts( if (receipt.donauBaseUrl != donauUrl) { continue; } - const key = `${receipt.donorTaxIdHash}-${receipt.donationYear}`; + // The receipts of a group are summed up, so they must share a currency. + const key = `${receipt.donorTaxIdHash}-${receipt.donationYear}-${Amounts.currencyOf(receipt.value)}`; let bucket: WalletDonationReceipt[] | undefined; bucket = buckets.get(key); if (!bucket) { @@ -241,7 +242,7 @@ function groupDonauReceipts( bucket.push(receipt); } - for (const [key, value] of buckets) { + for (const value of buckets.values()) { const r0 = value[0]; if (!r0) { continue; @@ -256,9 +257,6 @@ function groupDonauReceipts( year: r0.donationYear, currency: Amounts.currencyOf(r0.value), }); - const year = r0.donationYear; - const donauBaseUrl = r0.donauBaseUrl; - const currency = Amounts.currencyOf(r0.value); } }