47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
var express = require('express');
|
|
var router = new express.Router();
|
|
var mail = require('../mail.js');
|
|
var template = require('../template.js');
|
|
|
|
// Payment method changes
|
|
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();
|
|
});
|
|
});
|
|
|
|
// 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);
|
|
});
|
|
});
|
|
|
|
// 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();
|
|
});
|
|
});
|
|
|
|
module.exports = router;
|