Eliminar desistimiento y loading en editar desistimiento

This commit is contained in:
2023-12-22 12:52:04 -03:00
parent afbadd520b
commit 8492d1df2b
5 changed files with 96 additions and 18 deletions

View File

@ -3,6 +3,7 @@ namespace Incoviba\Service\Venta;
use DateTimeInterface;
use DateTimeImmutable;
use Incoviba\Common\Implement\Exception\EmptyResult;
use Incoviba\Service\Money;
use PDOException;
use Incoviba\Repository;
@ -66,8 +67,11 @@ class Pago
return false;
}
}
public function getById(int $pago_id): Model\Venta\Pago
public function getById(?int $pago_id): ?Model\Venta\Pago
{
if ($pago_id === null) {
return null;
}
$pago = $this->pagoRepository->fetchById($pago_id);
return $this->process($pago);
}
@ -118,6 +122,15 @@ class Pago
$pago->currentEstado = $estado;
return $pago;
}
public function delete(Model\Venta\Pago $pago): bool
{
try {
$this->pagoRepository->remove($pago);
return true;
} catch (EmptyResult|PDOException) {
return false;
}
}
protected function process($pago): Model\Venta\Pago
{