FIX: Editar cuotas

This commit is contained in:
Juan Pablo Vial
2024-11-28 19:14:14 -03:00
parent 52de72b507
commit 8028b673fb
6 changed files with 130 additions and 38 deletions

View File

@ -100,12 +100,13 @@ class Pagos
'pago_id' => $pago_id,
'input' => $body,
'pago' => null,
'depositado' => false
'depositado' => false,
'success' => false
];
try {
$pago = $pagoService->getById($pago_id);
$fecha = new DateTimeImmutable($body['fecha']);
$output['depositado'] = $pagoService->depositar($pago, $fecha);
$output['depositado'] = $output['success'] = $pagoService->depositar($pago, $fecha);
$output['pago'] = json_decode(json_encode($pagoService->getById($pago_id)), JSON_OBJECT_AS_ARRAY);
$output['pago']['valor_uf'] = $formatService->ufs($output['pago']['valor_uf']);
} catch (EmptyResult) {}
@ -129,12 +130,13 @@ class Pagos
'pago_id' => $pago_id,
'input' => $body,
'pago' => null,
'abonado' => false
'abonado' => false,
'success' => false,
];
try {
$pago = $pagoService->getById($pago_id);
$fecha = new DateTimeImmutable($body['fecha']);
$output['abonado'] = $pagoService->abonar($pago, $fecha);
$output['abonado'] = $output['success'] = $pagoService->abonar($pago, $fecha);
$output['pago'] = json_decode(json_encode($pagoService->getById($pago_id)), JSON_OBJECT_AS_ARRAY);
$output['pago']['valor_uf'] = $formatService->ufs($output['pago']['valor_uf']);
$output['input']['fecha'] = $fecha->format('d-m-Y');