From 4c9cc0ec8c3058077af3ad5aae0bf52a31e546eb Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 23 May 2023 23:28:37 -0700 Subject: add tips --- routes/payments.js | 11 +++++++++-- 1 file 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) } }), -- cgit v1.2.3