Skip to content

Commit

Permalink
Correccion en cancelacion
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo3829l committed Apr 11, 2024
1 parent 407b0ce commit 7703dcf
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions arquitecture/Controllers/schedule.service.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,14 @@ export const cancelService = async (req, res) => {
});
}

if(existingService.quote !== 0){
if(existingService.pending !== 0){
return res.json({
success: false,
msg : 'No puedes cancelar tu servicio sin antes haber pagado su totalidad esto de acuerdo a las politicas'
})
}
}
// Actualiza el estado del servicio a 'canceled'
existingService.status = 'canceled';
await existingService.save();
Expand All @@ -457,7 +465,15 @@ export const cancelService = async (req, res) => {
await sendEmail(
process.env.USER,
'Servicio cancelado',
template,
catch (error) {
console.log("Error");
console.log(error);
return res.json({
success: false,
msg: req.t('schedule.cancelService.error'),
});
}
}; template,
'Servicio cancelado'
)

Expand All @@ -468,15 +484,7 @@ export const cancelService = async (req, res) => {
msg: req.t('schedule.cancelService.candeled')
});

} catch (error) {
console.log("Error");
console.log(error);
return res.json({
success: false,
msg: req.t('schedule.cancelService.error'),
});
}
};


export const rescheduleService = async (req, res) => {
Expand Down

0 comments on commit 7703dcf

Please sign in to comment.