FormaPago Service

This commit is contained in:
Juan Pablo Vial
2024-03-13 14:38:44 -03:00
parent c7dd309185
commit 98953cce42
21 changed files with 261 additions and 71 deletions

View File

@ -6,7 +6,6 @@ use Incoviba\Common\Ideal\Service;
use Incoviba\Common\Implement;
use Incoviba\Repository;
use Incoviba\Model;
use PhpParser\Node\Expr\AssignOp\Mod;
use Psr\Log\LoggerInterface;
class Venta extends Service
@ -20,6 +19,7 @@ class Venta extends Service
protected Repository\Venta\Escritura $escrituraRepository,
protected Repository\Venta\Pago $pagoRepository,
protected Repository\Venta\EstadoPago $estadoPagoRepository,
protected Venta\FormaPago $formaPagoService,
protected Venta\Propietario $propietarioService,
protected Venta\Propiedad $propiedadService,
protected Venta\Pie $pieService,
@ -82,6 +82,9 @@ class Venta extends Service
protected function process(Model\Venta $venta): Model\Venta
{
$venta->addFactory('formaPago', (new Implement\Repository\Factory())
->setCallable([$this->formaPagoService, 'getByVenta'])
->setArgs(['venta_id' => $venta->id]));
$venta->addFactory('estados', (new Implement\Repository\Factory())
->setCallable([$this->estadoVentaRepository, 'fetchByVenta'])
->setArgs([$venta->id]));
@ -231,7 +234,8 @@ class Venta extends Service
}
protected function addFormaPago(array $data): Model\Venta\FormaPago
{
$fields = [
return $this->formaPagoService->add($data);
/*$fields = [
'pie',
'subsidio',
'credito',
@ -245,9 +249,9 @@ class Venta extends Service
$forma_pago->{$name} = $obj;
}
}
return $forma_pago;
return $forma_pago;*/
}
protected function addPie(array $data): Model\Venta\Pie
/*protected function addPie(array $data): Model\Venta\Pie
{
$fields = array_fill_keys([
'fecha_venta',
@ -309,7 +313,7 @@ class Venta extends Service
'valor'
], $filtered_data);
return $this->bonoPieService->add($mapped_data);
}
}*/
protected function addEstado(Model\Venta $venta, Model\Venta\TipoEstadoVenta $tipoEstadoVenta, array $data): void
{
$fecha = new DateTimeImmutable($data['fecha']);