var path = require('path'); var database = require(path.join(__dirname, '../../database.js')); var format = require(path.join(__dirname, '../../util/format.js')); 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(); }); } get paymentAdvice() { switch (this.payMethodId) { case 4: return `${this._.accountPaymentAdviceBefore} ${format.partialAccountAddress(this.accountAddress)} ${this._.accountPaymentAdviceAfter}`; case 5: return this._.cardPaymentAdvice; } } };