Editar estado cuota
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user