From 134588c96d06933714bfb7be450a17377db82aa0 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 13 May 2025 20:17:53 -0400 Subject: [PATCH] Envio de estado de cuotas. --- app/src/Model/Venta/Cuota.php | 4 ++++ app/src/Model/Venta/Pago.php | 4 ++++ app/src/Service/Venta/MediosPago/Toku/Invoice.php | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) 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;