From 17a2a698de2a522f05d9ec813411b5a01b95234d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 3 Feb 2023 09:58:47 -0800 Subject: contacts --- lib/payments.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/payments.js') diff --git a/lib/payments.js b/lib/payments.js index 47cb11f4..6fd595d4 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -36,8 +36,8 @@ export let debit = async ( if (!amount || amount < 0) fail("Amount must be greater than zero"); let ourfee = [types.bitcoin, types.lightning].includes(type) - ? 0 - : Math.round(amount * config.fee); + ? Math.round(amount * config.fee) + : 0; await t(`balance:${uid}`, async (balance, db) => { await t(`credit:${type}:${uid}`, async (credit, db) => { @@ -85,6 +85,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { amount = parseInt(amount); let invoice = await g(`invoice:${hash}`); if (!invoice) return; + if (!memo) ({ memo } = invoice); let user = await g(`user:${invoice.uid}`); -- cgit v1.2.3