aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/payments.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/routes/payments.js b/routes/payments.js
index 6ca9cc60..325f1df0 100644
--- a/routes/payments.js
+++ b/routes/payments.js
@@ -155,10 +155,17 @@ export default {
(a, b) => ({
...a,
[b.currency]: {
- sats: (a[b.currency] ? a[b.currency].sats : 0) + b.amount,
+ sats:
+ (a[b.currency] ? a[b.currency].sats : 0) +
+ (b.amount || 0) +
+ (b.tip || 0) -
+ (b.fee || 0) -
+ (b.ourfee || 0),
fiat: (
parseFloat(a[b.currency] ? a[b.currency].fiat : 0) +
- (b.amount * b.rate) / SATS
+ (((b.amount || 0) + (b.tip || 0) - (b.fee || 0) - (b.ourfee || 0)) *
+ b.rate) /
+ SATS
).toFixed(2)
}
}),