aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2016-09-18 15:55:47 -0700
committerAdam Soltys <[email protected]>2016-09-18 15:55:47 -0700
commit11d8decbb3b444561ee51daa0f0d2a609da13e47 (patch)
tree27176229e447f47dad06689e7d96dd3bc6012cda /src/routes
parent90da658fe477005ad8ab140d205b0d0e1dce00ea (diff)
downloadcoinos-server-11d8decbb3b444561ee51daa0f0d2a609da13e47.tar.gz
coinos-server-11d8decbb3b444561ee51daa0f0d2a609da13e47.zip
Send basic notification on transaction receipt
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/transactions.coffee17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/routes/transactions.coffee b/src/routes/transactions.coffee
index 25ccbbc9..cadb73b1 100644
--- a/src/routes/transactions.coffee
+++ b/src/routes/transactions.coffee
@@ -46,6 +46,23 @@ module.exports =
db.exists(req.body.txid, (err, result) ->
return finish() if result
+ res.render('notification',
+ layout: 'mail',
+ js: (-> global.js),
+ css: (-> global.css),
+ (err, html) ->
+ sendgrid = require('sendgrid')(config.sendgrid_user, config.sendgrid_password)
+
+ email = new sendgrid.Email(
+ subject: 'Transaction Sent'
+ html: html
+ )
+
+ sendgrid.send(email)
+ )
+
multi = db.multi()
multi.hmset(req.body.txid, req.body)
multi.rpush("#{req.params.user}:transactions", req.body.txid)