commit 82542fb69b48a35d2f6d45fdab43ce208652cf29
parent 766e2b804402f7ffc1e1d9df8229af358c14c0b1
Author: Florian Dold <dold@taler.net>
Date: Thu, 3 Sep 2026 15:47:38 +0200
wallet-core: leave failed refunds out of the payment refund totals
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -5952,17 +5952,24 @@ export function getRefundTotals(
refundGroups: WalletRefundGroup[],
currency: string,
): { raw: AmountString; effective: AmountString } {
+ // Only refunds that went through, or are still going through, count;
+ // a failed or aborted group refunded nothing.
+ const counted = refundGroups.filter(
+ (x) =>
+ x.status === RefundGroupStatus.Done ||
+ x.status === RefundGroupStatus.Pending,
+ );
return {
raw: Amounts.stringify(
Amounts.sumOrZero(
currency,
- refundGroups.map((x) => x.amountRaw),
+ counted.map((x) => x.amountRaw),
).amount,
),
effective: Amounts.stringify(
Amounts.sumOrZero(
currency,
- refundGroups.map((x) => x.amountEffective),
+ counted.map((x) => x.amountEffective),
).amount,
),
};