diff options
| author | Adam Soltys <[email protected]> | 2018-03-22 09:50:38 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2018-03-22 09:50:42 -0700 |
| commit | bcf501e32ed47ac2920736530f45a93ccc0b339e (patch) | |
| tree | c9b94a51619ff055909e3a6552507a9c7b77922d | |
| parent | 28b58e4e3d737dd23820f8a05975205048c7eaca (diff) | |
| download | coinos-server-bcf501e32ed47ac2920736530f45a93ccc0b339e.tar.gz coinos-server-bcf501e32ed47ac2920736530f45a93ccc0b339e.zip | |
track tips and set received boolean for fulfilled payments
| -rw-r--r-- | index.js | 4 | ||||
| -rw-r--r-- | migrations/20180322163730-addTipToPayments.js | 11 |
2 files changed, 15 insertions, 0 deletions
@@ -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'); + } +}; |
