From fbf27aaeb56cabc004c30215832126c98e7e4c6a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 22 Dec 2023 12:57:02 -0800 Subject: return platform fee for ln --- lib/db.js | 2 +- lib/payments.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/db.js b/lib/db.js index ab88925f..d14e4962 100644 --- a/lib/db.js +++ b/lib/db.js @@ -18,7 +18,7 @@ local covered = math.min(credit, ourfee) ourfee = ourfee - covered if balance < amount + tip + fee + ourfee then - return {err = 'Insufficient funds'} + return {err = 'Insufficient funds ' .. balance .. ' vs ' .. amount + tip + fee + ourfee} end redis.call('decrby', creditKey, tostring(math.floor(covered))) diff --git a/lib/payments.js b/lib/payments.js index 9eeec99a..c76bea70 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -33,11 +33,11 @@ export let debit = async ({ user, type = types.internal, id = v4(), - rate + rate, }) => { let ref; let { id: uid, currency, username } = user; - if (!rate) rate = store.rates[currency] + if (!rate) rate = store.rates[currency]; let iid = await g(`invoice:${hash}`); if (iid && iid.hash) iid = iid.hash; @@ -73,7 +73,7 @@ export let debit = async ({ ourfee || 0, ); - if (r !== "ok") fail("Insufficient funds"); + if (r !== "ok") fail("Problem debiting account"); let p = { id, -- cgit v1.2.3