diff options
| author | Adam Soltys <[email protected]> | 2019-03-09 18:04:46 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2019-03-09 18:04:51 +0000 |
| commit | 55fbfeab90f40c6d9458d2d9be7bead948219224 (patch) | |
| tree | c63580df11abd3c2ba563a1c90e4984e302e12ef /index.js | |
| parent | 8332aff7ad3d1d2654d9e9d6a0a38fb757f0f2c6 (diff) | |
| download | coinos-server-55fbfeab90f40c6d9458d2d9be7bead948219224.tar.gz coinos-server-55fbfeab90f40c6d9458d2d9be7bead948219224.zip | |
use sats
Diffstat (limited to 'index.js')
| -rw-r--r-- | index.js | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -748,7 +748,7 @@ const authy = new Client({ key: config.authy.key }) app.post('/buy', auth, async (req, res) => { const stripe = require('stripe')(config.stripe); - const { token, amount, sats } = req.body + const { token, amount, sat } = req.body let dollarAmount = parseInt(amount / 100) if (dollarAmount > req.user.limit) return res.status(401).end() @@ -761,7 +761,7 @@ const authy = new Client({ key: config.authy.key }) source: token, }) - req.user.balance += parseInt(sats) + req.user.balance += parseInt(sat) req.user.limit -= dollarAmount await req.user.save() emit(req.user.username, 'user', req.user) @@ -769,7 +769,7 @@ const authy = new Client({ key: config.authy.key }) await db.Payment.create({ user_id: req.user.id, hash: charge.balance_transaction, - amount: parseInt(sats), + amount: parseInt(sat), currency: 'CAD', rate: app.get('rates').ask, received: true, @@ -778,6 +778,7 @@ const authy = new Client({ key: config.authy.key }) res.send(`Bought ${amount}`) } catch (e) { + console.log(e); res.status(500).send(e) } }) |
