feature/porcentajes-pie-y-bono #22

Merged
aldarien merged 6 commits from feature/porcentajes-pie-y-bono into develop 2025-04-03 13:51:16 -03:00
Showing only changes of commit 4d6a1827a3 - Show all commits

View File

@ -24,8 +24,15 @@ class Pago extends Model
public function valor(string $moneda = Pago::UF): float public function valor(string $moneda = Pago::UF): float
{ {
$uf = $this->uf ?? ($this->uf > 0.0 ? $this->uf : 1); $multiplier = 1;
return $this->valor / (($moneda === Pago::UF) ? $uf : 1); if ($moneda === Pago::UF) {
if ($this->uf === null or $this->uf === 0.0) {
return 0;
}
$uf = $this->uf;
$multiplier = 1 / $uf;
}
return $this->valor * $multiplier;
} }
public function estado(?string $tipoEstado = null): ?EstadoPago public function estado(?string $tipoEstado = null): ?EstadoPago