diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/payments.js b/lib/payments.js index 20429864..d257ed77 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -25,7 +25,7 @@ export const types = { classic: "classic", }; -export let debit = async ( +export let debit = async ({ hash, amount, fee = 0, @@ -33,12 +33,11 @@ export let debit = async ( user, type = types.internal, id = v4(), -) => { + rate = store.rates[currency] +}) => { let ref; let { id: uid, currency, username } = user; - let rate = store.rates[currency]; - let iid = await g(`invoice:${hash}`); if (iid && iid.hash) iid = iid.hash; let invoice = await g(`invoice:${iid}`); @@ -259,7 +258,14 @@ export let payLightning = async (user, payreq, amount, maxfee, memo) => { if (pays.find((p) => p.status === "pending")) fail("Payment is already underway"); - p = await debit(payreq, total, maxfee, memo, user, types.lightning); + p = await debit({ + hash: payreq, + amount: total, + fee: maxfee, + memo, + user, + type: types.lightning, + }); let check = async () => { try { |
