Fecha cuota
This commit is contained in:
@ -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 ?? '',
|
||||
|
Reference in New Issue
Block a user