aboutsummaryrefslogtreecommitdiffstats
path: root/lib/send.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-07-09 00:56:50 -0400
committerAdam Soltys <[email protected]>2020-07-09 00:56:50 -0400
commit6b00db46ec0f75d08c3fff77bcef45b9af891553 (patch)
tree68865500f28f907edf218b8b90b89be60719b1b9 /lib/send.js
parentc405440c832f54c98bae34b3f10506905199d5ce (diff)
downloadcoinos-server-6b00db46ec0f75d08c3fff77bcef45b9af891553.tar.gz
coinos-server-6b00db46ec0f75d08c3fff77bcef45b9af891553.zip
return payment
Diffstat (limited to 'lib/send.js')
-rw-r--r--lib/send.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/send.js b/lib/send.js
index 2e04c5d4..71209456 100644
--- a/lib/send.js
+++ b/lib/send.js
@@ -12,6 +12,8 @@ send = async (amount, hash, user) => {
throw new Error("Invoice has been paid, can't pay again");
}
+ let payment;
+
await db.transaction(async (transaction) => {
let account = await db.Account.findOne({
where: {
@@ -85,7 +87,7 @@ send = async (amount, hash, user) => {
account.balance -= total;
await account.save({ transaction });
- let payment = await db.Payment.create(
+ payment = await db.Payment.create(
{
amount: -total,
account_id: account.id,
@@ -111,5 +113,8 @@ send = async (amount, hash, user) => {
seen.push(hash);
l.info("sent lightning", user.username, total);
+
});
+
+ return payment;
};