aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.js4
-rw-r--r--migrations/20180322163730-addTipToPayments.js11
2 files changed, 15 insertions, 0 deletions
diff --git a/index.js b/index.js
index bd1f9183..c9af0479 100644
--- a/index.js
+++ b/index.js
@@ -89,7 +89,10 @@ const l = console.log
if (!payment) return
+ payment.received = true
payment.user.channelbalance += parseInt(msg.value)
+
+ await payment.save()
await payment.user.save()
payments.push(msg.payment_request)
@@ -353,6 +356,7 @@ const l = console.log
amount: req.body.amount,
currency: 'CAD',
rate: app.get('rates').ask,
+ tip: req.body.tip,
})
res.send(invoice)
diff --git a/migrations/20180322163730-addTipToPayments.js b/migrations/20180322163730-addTipToPayments.js
new file mode 100644
index 00000000..a482c7d4
--- /dev/null
+++ b/migrations/20180322163730-addTipToPayments.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = {
+ up: (queryInterface, Sequelize) => {
+ return queryInterface.addColumn('payments', 'tip', { type: Sequelize.DOUBLE })
+ },
+
+ down: (queryInterface, Sequelize) => {
+ return queryInterface.removeColumn('payments', 'tip');
+ }
+};