From 3a3e14564264c03eabfd3f5a39acf5ca42411a15 Mon Sep 17 00:00:00 2001 From: IO420 <320154041@pcpuma.acatlan.unam.mx> Date: Wed, 29 Oct 2025 08:16:36 -0600 Subject: [PATCH] modified newSaldo --- src/modules/Monedero/persona/persona.service.ts | 4 ++++ src/operations/operations.service.ts | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/Monedero/persona/persona.service.ts b/src/modules/Monedero/persona/persona.service.ts index 1505d13..b6b86c2 100644 --- a/src/modules/Monedero/persona/persona.service.ts +++ b/src/modules/Monedero/persona/persona.service.ts @@ -112,6 +112,10 @@ export class PersonaService { select: { cantidadCuenta: true }, }); + if (!persona) { + throw new NotFoundException('user not found'); + } + return persona?.cantidadCuenta; } diff --git a/src/operations/operations.service.ts b/src/operations/operations.service.ts index 323bbb6..e591a78 100644 --- a/src/operations/operations.service.ts +++ b/src/operations/operations.service.ts @@ -33,7 +33,12 @@ export class OperationsService { this.pagoKioscoService.create(pagoKiosco); - const newSaldo = this.personaService.updateSaldo(idPersona, cantidad); + let newSaldo: number; + if (transaccion === 'Inscripcion') { + newSaldo = await this.personaService.saldo(idPersona); + } else { + newSaldo = await this.personaService.updateSaldo(idPersona, cantidad); + } return newSaldo; }