2017-06-07 17:29:16 +00:00
|
|
|
let database = require('../database.js');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Devuelve el iban
|
|
|
|
* @param {String} addressNumber - Dirección de cuenta bancaria
|
|
|
|
* @param {Object} cb - Callback
|
|
|
|
*/
|
|
|
|
accountAddressIban: function(addressNumber, cb) {
|
|
|
|
database.pool.query('SELECT vn2008.cc_to_iban(?) AS iban', [addressNumber], function(error, result) {
|
|
|
|
cb(result[0].iban);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtiene el numero de cuenta completo incluyendo iban
|
|
|
|
* @param {String} addressNumber - Dirección de cuenta bancaria
|
|
|
|
* @return {String} Cuenta bancaria formateada
|
|
|
|
*/
|
|
|
|
accountAddress: function(addressNumber) {
|
2018-07-16 07:28:32 +00:00
|
|
|
if (!addressNumber) return;
|
2017-06-07 17:29:16 +00:00
|
|
|
var formattedAccountAddress = addressNumber.replace(/(.{4})/g, '$1-');
|
|
|
|
return formattedAccountAddress.substring(0, formattedAccountAddress.length - 1);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Devuelve el numero de cuenta mostrando únicamente los últimos 4 dígitos.
|
|
|
|
* @param {String} addressNumber - Dirección de cuenta bancaria
|
|
|
|
* @return {String} Cuenta bancaria formateada
|
|
|
|
*/
|
|
|
|
partialAccountAddress: function(addressNumber) {
|
2018-07-16 07:28:32 +00:00
|
|
|
if (!addressNumber) return;
|
2017-06-07 17:29:16 +00:00
|
|
|
let address = this.accountAddress(addressNumber);
|
|
|
|
return address.substring(0, 19).replace(/[0-9]/g, 'X') + address.substring(19, 24);
|
2017-10-20 12:03:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
phone: function(number) {
|
|
|
|
return number;
|
2017-06-07 17:29:16 +00:00
|
|
|
}
|
|
|
|
};
|