Editar desistimiento venta

This commit is contained in:
2023-12-21 21:06:38 -03:00
parent d7d17a3051
commit ac52305002
7 changed files with 173 additions and 54 deletions

View File

@ -13,56 +13,4 @@ class Pagos
{
return $view->render($response, 'ventas.pagos.pendientes');
}
public function depositar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService): ResponseInterface
{
$body = $request->getBody();
$json = json_decode($body->getContents());
$date = new DateTimeImmutable($json->fecha);
$response->getBody()->write(json_encode(['fecha' => $date->format('d-m-Y'), 'message' => 'Not implemented']));
return $response->withHeader('Content-Type', 'application/json');
}
public function abonar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService): ResponseInterface
{
$body = $request->getBody();
$json = json_decode($body->getContents());
$date = new DateTimeImmutable($json->fecha);
$response->getBody()->write(json_encode(['fecha' => $date->format('d-m-Y'), 'message' => 'Not implemented']));
return $response->withHeader('Content-Type', 'application/json');
}
public function para_pendientes(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService): ResponseInterface
{
$pagos = $pagoService->getPendientes();
$pagos_pendientes = [];
foreach ($pagos as $pago) {
$pagos_pendientes []= [
'id' => $pago->id
];
}
$response->getBody()->write(json_encode(['pagos' => $pagos_pendientes, 'total' => count($pagos_pendientes)]));
return $response->withHeader('Content-Type', 'application/json');
}
public function para_abonar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService): ResponseInterface
{
$pagos = $pagoService->getDepositados();
$pagos_depositados = [];
foreach ($pagos as $pago) {
$pagos_depositados []= [
'id' => $pago->id
];
}
$response->getBody()->write(json_encode(['pagos' => $pagos_depositados, 'total' => count($pagos_depositados)]));
return $response->withHeader('Content-Type', 'application/json');
}
public function rebotes(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService): ResponseInterface
{
$pagos = $pagoService->getRebotes();
$rebotes = [];
foreach ($pagos as $pago) {
$rebotes []= [
'id' => $pago->id
];
}
$response->getBody()->write(json_encode(['pagos' => $rebotes, 'total' => count($rebotes)]));
return $response->withHeader('Content-Type', 'application/json');
}
}