Editar estado cuota

This commit is contained in:
Juan Pablo Vial
2024-11-06 21:28:36 -03:00
parent d154212732
commit 37c28c3080
6 changed files with 155 additions and 10 deletions

View File

@ -57,6 +57,31 @@ class Pagos
} catch (EmptyResult) {}
return $this->withJson($response, $output);
}
public function estado(ServerRequestInterface $request, ResponseInterface $response,
Service\Venta\Pago $pagoService,
Repository\Venta\EstadoPago $estadoPagoRepository,
int $pago_id): ResponseInterface
{
$body = $request->getParsedBody();
$output = [
'pago_id' => $pago_id,
'input' => $body,
'pago' => null,
'editado' => false
];
try {
$pago = $pagoService->getById($pago_id);
$output['pago'] = $pago;
$estado = $estadoPagoRepository->create([
'pago' => $pago->id,
'estado' => $body['estado'],
'fecha' => $body['fecha']
]);
$estadoPagoRepository->save($estado);
$output['editado'] = true;
} catch (EmptyResult) {}
return $this->withJson($response, $output);
}
/**
* @param ServerRequestInterface $request