2017-05-30 06:06:14 +00:00
|
|
|
var express = require('express');
|
|
|
|
var router = new express.Router();
|
|
|
|
var mail = require('../mail.js');
|
2017-10-19 10:47:05 +00:00
|
|
|
var template = require('../template.js');
|
2017-05-30 06:06:14 +00:00
|
|
|
|
2017-08-31 14:11:37 +00:00
|
|
|
// Payment method changes
|
2017-10-17 06:22:59 +00:00
|
|
|
router.post('/payment-update/:clientId', function(request, response, next) {
|
|
|
|
mail.sendWithTemplate('payment-update', {recipient: request.params.clientId}, error => {
|
|
|
|
if (error)
|
|
|
|
return response.status(400).json({message: error.message});
|
|
|
|
|
|
|
|
return response.json();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Printer setup
|
|
|
|
router.post('/printer-setup/:clientId', function(request, response, next) {
|
|
|
|
mail.sendWithTemplate('printer-setup', {recipient: request.params.clientId}, error => {
|
|
|
|
if (error)
|
|
|
|
return response.status(400).json({message: error.message});
|
|
|
|
|
|
|
|
return response.json();
|
2017-05-30 06:06:14 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-10-19 10:47:05 +00:00
|
|
|
// Printer setup preview
|
|
|
|
router.get('/printer-setup/:clientId', function(request, response, next) {
|
|
|
|
template.get('printer-setup', {recipient: request.params.clientId}, true, (error, result) => {
|
|
|
|
if (error)
|
|
|
|
return response.status(400).json({message: error.message});
|
|
|
|
|
|
|
|
response.send(result.body);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-10-20 12:03:25 +00:00
|
|
|
// Client welcome
|
|
|
|
router.post('/client-welcome/:clientId', function(request, response, next) {
|
|
|
|
mail.sendWithTemplate('client-welcome', {recipient: request.params.clientId}, error => {
|
|
|
|
if (error)
|
|
|
|
return response.status(400).json({message: error.message});
|
|
|
|
|
|
|
|
return response.json();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-05-30 06:06:14 +00:00
|
|
|
module.exports = router;
|