Pagos sin uf retornan 0
This commit is contained in:
@ -24,8 +24,15 @@ class Pago extends Model
|
||||
|
||||
public function valor(string $moneda = Pago::UF): float
|
||||
{
|
||||
$uf = $this->uf ?? ($this->uf > 0.0 ? $this->uf : 1);
|
||||
return $this->valor / (($moneda === Pago::UF) ? $uf : 1);
|
||||
$multiplier = 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
|
||||
|
Reference in New Issue
Block a user