From 1ae65a5a143d218e21828e297fd7d0ba9ab372bf Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 1 Feb 2023 11:07:37 -0800 Subject: classic invoices --- lib/payments.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/payments.js b/lib/payments.js index cc8747d7..47cb11f4 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -12,7 +12,8 @@ export const types = { internal: "internal", bitcoin: "bitcoin", lightning: "lightning", - pot: "pot" + pot: "pot", + classic: "classic" }; export let debit = async ( @@ -34,7 +35,10 @@ export let debit = async ( if (!amount || amount < 0) fail("Amount must be greater than zero"); - let ourfee = type === types.internal ? 0 : Math.round(amount * config.fee); + let ourfee = [types.bitcoin, types.lightning].includes(type) + ? 0 + : Math.round(amount * config.fee); + await t(`balance:${uid}`, async (balance, db) => { await t(`credit:${type}:${uid}`, async (credit, db) => { let covered = Math.min(credit, ourfee) || 0; -- cgit v1.2.3