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; }