validacion folio
This commit is contained in:
@@ -9,8 +9,8 @@ const actualizarTicket = async (body) => {
|
||||
'id Inscripcion',
|
||||
true
|
||||
);
|
||||
|
||||
const monto = validarNumeroEntero(body.monto, 'monto', true);
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: {
|
||||
@@ -21,9 +21,9 @@ const actualizarTicket = async (body) => {
|
||||
if (!res) throw new Error('No pudimos encontrar este ticket.');
|
||||
return Inscripcion.findOne({
|
||||
where: {
|
||||
folio: body.folio,
|
||||
folio,
|
||||
cancelacion: 0,
|
||||
idInscripcion: {[Op.ne]: idInscripcion}
|
||||
idInscripcion: { [Op.ne]: idInscripcion },
|
||||
},
|
||||
});
|
||||
})
|
||||
@@ -34,7 +34,7 @@ const actualizarTicket = async (body) => {
|
||||
.then((res) => {
|
||||
return Inscripcion.update(
|
||||
{
|
||||
folio: body.folio,
|
||||
folio,
|
||||
monto,
|
||||
fechaTicket: body.fechaTicket,
|
||||
},
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const motivo = async (body) => {
|
||||
const folio = body.folio;
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { folio },
|
||||
})
|
||||
|
||||
@@ -38,7 +38,7 @@ const reporte = async (body) => {
|
||||
hizoPago: res[i].hizoPago,
|
||||
fechaInscripcion: moment(res[i].fechaInscripcion).format('L'),
|
||||
validacion: res[i].validacion,
|
||||
motivoCancelacion: res[i].motivo,
|
||||
motivoDeclinacion: res[i].motivo,
|
||||
});
|
||||
}
|
||||
await helper.eliminarArchivo(path).catch((err) => {});
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const ticket = async (body) => {
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { folio: body.folio },
|
||||
attributes: ['rutaTicket', 'extension', 'motivo'],
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
const {
|
||||
validarNumeroCuenta,
|
||||
validarNumeroEntero,
|
||||
} = require('../../helper/validar');
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const { Op } = require('sequelize');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
const { validarNumeroEntero } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const validarTicket = async (body) => {
|
||||
const validacion = validarNumeroEntero(body.validacion, 'validacion', true);
|
||||
const folio = validarNumeroEntero(body.folio, 'folio', true);
|
||||
|
||||
return Inscripcion.findOne({
|
||||
where: { folio: body.folio },
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res) throw new Error('Este folio no existe');
|
||||
idUsuario = res.idUsuario;
|
||||
if (body.validacion == 1) {
|
||||
if (validacion == 1) {
|
||||
return Inscripcion.findOne({
|
||||
where: { folio: body.folio, validacion: 1 },
|
||||
where: { folio, validacion: 1 },
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -18,11 +22,11 @@ const validarTicket = async (body) => {
|
||||
if (res) throw new Error('Este folio ya fue validado');
|
||||
return Inscripcion.update(
|
||||
{
|
||||
validacion: body.validacion,
|
||||
validacion,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
folio: body.folio,
|
||||
folio,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user