Fecha cuota

This commit is contained in:
Juan Pablo Vial
2024-03-26 16:41:33 -03:00
parent 7b8d44e8c8
commit 86406bf027
6 changed files with 65 additions and 18 deletions

View File

@ -28,10 +28,27 @@ class Pago extends Model
return $this->valor / (($moneda === Pago::UF) ? $uf : 1);
}
public function estado(?string $tipoEstado = null): ?EstadoPago
{
if (!isset($this->estados)) {
return null;
}
if ($tipoEstado === null) {
return $this->currentEstado;
}
foreach ($this->estados as $estado) {
if ($estado->tipoEstado->descripcion === $tipoEstado) {
return $estado;
}
}
return null;
}
public function jsonSerialize(): mixed
{
return array_merge(parent::jsonSerialize(), [
'valor' => $this->valor,
'valor_uf' => $this->valor(),
'banco' => $this->banco ?? '',
'tipo_pago' => $this->tipoPago ?? '',
'identificador' => $this->identificador ?? '',