diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-05-15 16:39:40 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-05-15 16:39:40 +0530 |
commit | 79d0c2f928e3b9a73d07f30a9ab63468c5f3634b (patch) | |
tree | b1ab1e53231d0c15a4867984926df2755ad238a7 /src/operations/transactions.ts | |
parent | 3eb88574bcf327672c34120becfb511eac4e06cd (diff) |
include refund fees in effective refund amount calculation
Diffstat (limited to 'src/operations/transactions.ts')
-rw-r--r-- | src/operations/transactions.ts | 8 |
1 files changed, 8 insertions, 0 deletions
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)) { |