actualizacion de funciones

This commit is contained in:
Andres2908
2022-07-29 13:51:48 -05:00
parent 28fd26a5e4
commit cf4562fb13
2 changed files with 9 additions and 19 deletions
+2 -16
View File
@@ -1,13 +1,8 @@
const moment = require('moment');
const {
validarNumeroEntero,
validarNumeroCuenta,
} = require('../../helper/validar');
const {
usuarioInscrito,
agregarRecibo,
agregarDetalleServicio,
} = require('../../config/mariadb.conf');
const { usuarioInscrito } = require('../../config/mariadb.conf');
const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
const gmail = require('../../helper/gmail');
@@ -17,8 +12,6 @@ const correoInscripcion = require('../../helper/correo');
const validarTicket = async (body) => {
const folio = validarNumeroEntero(body.folio, 'folio', true);
const idArea = validarNumeroEntero(body.idArea, 'IDAREA', true);
const monto = validarNumeroEntero(body.monto, 'monto', true);
const fechaTicket = body.fechaTicket;
const numeroCuenta = validarNumeroCuenta(
body.numeroCuenta,
@@ -59,14 +52,7 @@ const validarTicket = async (body) => {
email = `${numeroCuenta}@pcpuma.acatlan.unam.mx`;
if (body.validacion === 1) {
correo = correoInscripcion();
// usuarioInscrito(numeroCuenta, idArea);
// agregarRecibo(
// folio,
// monto,
// moment(fechaTicket).format('L'),
// numeroCuenta
// );
// agregarDetalleServicio(monto, numeroCuenta);
usuarioInscrito(numeroCuenta, idArea);
} else {
correo = correoDeclinar();
return Inscripcion.update(
@@ -22,9 +22,6 @@ const inscripcion = async (body, file) => {
const folio = validarNumero(body.folio, 'folio', true, 6);
const fechaTicket = body.fechaTicket;
let correo = {};
let email = '';
return Inscripcion.findOne({
where: { folio, cancelacion: 0 },
})
@@ -60,6 +57,13 @@ const inscripcion = async (body, file) => {
.then((res) => {
if (file)
fs.renameSync(file.path, file.path + '.' + file.mimetype.split('/')[1]);
agregarRecibo(
folio,
monto,
moment(fechaTicket).format('L'),
numeroCuenta
);
agregarDetalleServicio(monto, numeroCuenta);
})
.then((res) => ({
message: `Tu inscripción está sujeta a validación por parte de un operador de CEDETEC, en caso de no ser correcta o veraz el servicio será suspendido. Por favor ingresa a <a href="https://kalinga.acatlan.unam.mx/cedetec/" target="_blank">Kalinga</a> para confirmar tu inscripción`,