aboutsummaryrefslogtreecommitdiffstats
path: root/routes/lightning
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-08-01 22:17:58 -0700
committerAdam Soltys <[email protected]>2022-08-01 22:17:58 -0700
commit99b7b4fbeb64e2e4512211c9c2a4a085bacd96d8 (patch)
treeb2b6b97328cb9ea4b86d7b32e89aa805af29b04b /routes/lightning
parent82f9acc60b7edbdfee96f1553d0fb1dcc705b866 (diff)
downloadcoinos-server-99b7b4fbeb64e2e4512211c9c2a4a085bacd96d8.tar.gz
coinos-server-99b7b4fbeb64e2e4512211c9c2a4a085bacd96d8.zip
record invoice status
Diffstat (limited to 'routes/lightning')
-rw-r--r--routes/lightning/receive.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js
index 89ad4c29..c9e7dec7 100644
--- a/routes/lightning/receive.js
+++ b/routes/lightning/receive.js
@@ -61,6 +61,9 @@ const handlePayment = async (msg) => {
total = amount + tip;
invoice.received += total;
+ invoice.status = 'paid';
+ await invoice.save({ transaction });
+
await account.increment({ balance: total }, { transaction });
// get the # of fee credits you would need to pay off this amount of bitcoin
await account.increment({ lightning_credits: computeConversionFee(total) }, { transaction });
@@ -71,6 +74,7 @@ const handlePayment = async (msg) => {
payment = payment.get({ plain: true });
payment.account = account.get({ plain: true });
+ payment.invoice= invoice.get({ plain: true });
callWebhook(invoice, payment);