salix/services/mailer/application/template/payment-update/payment-update.js

25 lines
911 B
JavaScript
Raw Normal View History

2017-06-07 13:28:42 +00:00
var path = require('path');
var database = require(path.join(__dirname, '../../database.js'));
var format = require(path.join(__dirname, '../../util/format.js'));
2017-06-07 13:28:42 +00:00
module.exports = class PaymentUpdate {
getData(params, cb) {
let query = `SELECT pm.name AS payMethod, pm.id AS payMethodId, c.vencimiento AS paymentDay, c.CC AS accountAddress
FROM Clientes AS c JOIN pay_met AS pm ON pm.id = c.pay_met_id WHERE Id_Cliente = ?`;
database.pool.query(query, [params.userId], (error, result) => {
Object.assign(this, result[0]);
cb();
2017-06-07 13:28:42 +00:00
});
}
get paymentAdvice() {
switch (this.payMethodId) {
case 4:
return `${this._.accountPaymentAdviceBefore} ${format.partialAccountAddress(this.accountAddress)} ${this._.accountPaymentAdviceAfter}`;
case 5:
return this._.cardPaymentAdvice;
2017-06-07 13:28:42 +00:00
}
}
};