From 79d0c2f928e3b9a73d07f30a9ab63468c5f3634b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 15 May 2020 16:39:40 +0530 Subject: include refund fees in effective refund amount calculation --- src/operations/transactions.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/operations/transactions.ts') diff --git a/src/operations/transactions.ts b/src/operations/transactions.ts index fd7679621..9e07d4ff5 100644 --- a/src/operations/transactions.ts +++ b/src/operations/transactions.ts @@ -63,6 +63,8 @@ function getRefundStats( .amount; } + // Subtract fees from effective refund amount + for (const rk of Object.keys(pr.refundsDone)) { const perm = pr.refundsDone[rk].perm; if (pr.refundsDone[rk].refundGroupId !== refundGroupId) { @@ -72,6 +74,12 @@ function getRefundStats( amountEffective, Amounts.parseOrThrow(perm.refund_fee), ).amount; + if (pr.refundsRefreshCost[rk]) { + amountEffective = Amounts.sub( + amountEffective, + pr.refundsRefreshCost[rk], + ).amount; + } } for (const rk of Object.keys(pr.refundsFailed)) { -- cgit v1.2.3