aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-01 11:07:37 -0800
committerAdam Soltys <[email protected]>2023-02-01 11:07:37 -0800
commit1ae65a5a143d218e21828e297fd7d0ba9ab372bf (patch)
tree6e425803038c575f87e14ae3392abae16d7ccf40 /lib
parent2eb199b8609b0976b4800815edcf73aa3da4b464 (diff)
downloadcoinos-server-1ae65a5a143d218e21828e297fd7d0ba9ab372bf.tar.gz
coinos-server-1ae65a5a143d218e21828e297fd7d0ba9ab372bf.zip
classic invoices
Diffstat (limited to 'lib')
-rw-r--r--lib/payments.js8
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;