aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-05-23 23:28:37 -0700
committerAdam Soltys <[email protected]>2023-05-23 23:28:37 -0700
commit4c9cc0ec8c3058077af3ad5aae0bf52a31e546eb (patch)
tree1047d88e9f4cc440b7b6163012d5c03c8e0f770b
parentdf1b1711e2f7b437128993a97efc9249f41efc95 (diff)
downloadcoinos-server-4c9cc0ec8c3058077af3ad5aae0bf52a31e546eb.tar.gz
coinos-server-4c9cc0ec8c3058077af3ad5aae0bf52a31e546eb.zip
add tips
-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)
}
}),