diff --git a/app/src/Model/Venta/Cuota.php b/app/src/Model/Venta/Cuota.php index 56bcee3..2d7d73b 100644 --- a/app/src/Model/Venta/Cuota.php +++ b/app/src/Model/Venta/Cuota.php @@ -27,6 +27,10 @@ class Cuota extends Model { return $this->pago->isAbonado(); } + public function isRechazada(): bool + { + return $this->pago->isRechazado(); + } public function jsonSerialize(): mixed { diff --git a/app/src/Model/Venta/Pago.php b/app/src/Model/Venta/Pago.php index d380f96..5aab688 100644 --- a/app/src/Model/Venta/Pago.php +++ b/app/src/Model/Venta/Pago.php @@ -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 { diff --git a/app/src/Service/Venta/MediosPago/Toku/Invoice.php b/app/src/Service/Venta/MediosPago/Toku/Invoice.php index c781736..f3684bf 100644 --- a/app/src/Service/Venta/MediosPago/Toku/Invoice.php +++ b/app/src/Service/Venta/MediosPago/Toku/Invoice.php @@ -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;