diff options
| author | Adam Soltys <[email protected]> | 2023-02-01 11:07:37 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-02-01 11:07:37 -0800 |
| commit | 1ae65a5a143d218e21828e297fd7d0ba9ab372bf (patch) | |
| tree | 6e425803038c575f87e14ae3392abae16d7ccf40 /lib | |
| parent | 2eb199b8609b0976b4800815edcf73aa3da4b464 (diff) | |
| download | coinos-server-1ae65a5a143d218e21828e297fd7d0ba9ab372bf.tar.gz coinos-server-1ae65a5a143d218e21828e297fd7d0ba9ab372bf.zip | |
classic invoices
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.js | 8 |
1 files changed, 6 insertions, 2 deletions
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; |
