Envio de estado de cuotas.

This commit is contained in:
Juan Pablo Vial
2025-05-13 20:17:53 -04:00
parent 8b6516241d
commit 134588c96d
3 changed files with 16 additions and 2 deletions

View File

@ -27,6 +27,10 @@ class Cuota extends Model
{
return $this->pago->isAbonado();
}
public function isRechazada(): bool
{
return $this->pago->isRechazado();
}
public function jsonSerialize(): mixed
{

View File

@ -59,6 +59,10 @@ class Pago extends Model
{
return $this->currentEstado->tipoEstadoPago->descripcion === 'abonado';
}
public function isRechazado(): bool
{
return in_array($this->currentEstado->tipoEstadoPago->descripcion, ['devuelto', 'reemplazado', 'anulado']);
}
public function jsonSerialize(): mixed
{

View File

@ -95,8 +95,8 @@ class Invoice extends AbstractEndPoint
'due_date' => 'fecha',
'subscription' => 'subscription',
'amount' => 'valor',
'is_paid' => null,
'is_void' => null,
'is_paid' => 'isPagada',
'is_void' => 'isRechazada',
'link_payment' => null,
'metadata' => 'datosCuota',
'receipt_type' => null,
@ -123,6 +123,12 @@ class Invoice extends AbstractEndPoint
$params[$key] = $this->datosCuota($data['cuota']);
continue;
}
if ($ref === 'isPagada') {
$params[$key] = $data['cuota']->isPagada();
}
if ($ref === 'isRechazada') {
$params[$key] = $data['cuota']->isRechazada();
}
if ($ref === 'cuota_id') {
$params[$key] = $data['cuota']->id;
continue;