Compare commits

...

3 Commits

Author SHA1 Message Date
74c6347367 Merge branch 'develop' into feature/cierres 2025-10-17 12:28:27 -03:00
5ea300837e FIX: exceptions list 2025-10-17 12:27:43 -03:00
71309e13a0 Correct exceptions 2025-10-17 12:26:46 -03:00
3 changed files with 14 additions and 3 deletions

View File

@ -4,8 +4,11 @@ namespace Incoviba\Controller\API\Ventas;
use DateTimeImmutable;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Log\LoggerInterface;
use Incoviba\Common\Implement\Exception\EmptyResult;
use Incoviba\Controller\API\withJson;
use Incoviba\Exception\ServiceAction\Read;
use Incoviba\Exception\ServiceAction\Update;
use Incoviba\Repository;
use Incoviba\Service;
@ -42,7 +45,7 @@ class Escrituras
try {
$escrituraService->edit($venta_id, $body);
$output['success'] = true;
} catch (EmptyResult) {}
} catch (Read|Update|EmptyResult) {}
return $this->withJson($response, $output);
}
}

View File

@ -239,7 +239,11 @@ class Reservation extends Common\Ideal\Repository
$exceptions[] = new Common\Implement\Exception\EmptyResult('No cancelled reservations', $exception);
}
if (count($reservations) === 0) {
throw new Common\Implement\Exception\EmptyResult('No rejected nor cancelled reservations', last($exceptions));
$exception = null;
if (count($exceptions) > 0) {
$exception = last($exceptions);
}
throw new Common\Implement\Exception\EmptyResult('No rejected nor cancelled reservations', $exception);
}
return $reservations;
}

View File

@ -4,6 +4,8 @@ namespace Incoviba\Service\Venta;
use Exception;
use DateTimeImmutable;
use DateMalformedStringException;
use Incoviba\Exception\ServiceAction\Read;
use Incoviba\Exception\ServiceAction\Update;
use Psr\Log\LoggerInterface;
use Incoviba\Common\Ideal;
use Incoviba\Common\Implement\Exception\EmptyResult;
@ -56,13 +58,15 @@ class Escritura extends Ideal\Service
/**
* @throws EmptyResult
* @throws Read
* @throws Update
*/
public function edit(int $venta_id, array $data): Model\Venta\Escritura
{
$venta = $this->ventaService->getById($venta_id);
$estado = $venta->currentEstado();
if (!in_array($estado->tipoEstadoVenta->descripcion, ['escriturando', 'firmado por inmobiliaria'])) {
throw new EmptyResult('');
throw new Update(__CLASS__);
}
try {
$data['fecha'] = (new DateTimeImmutable($data['fecha']))->format('Y-m-d');