From a54586e8704acb5778aa6dfbd9253b87c938110d Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Fri, 30 May 2025 17:10:59 -0400 Subject: [PATCH] FIX: valor cuota cuando UF no existe. --- app/src/Service/Venta/MediosPago/Toku/Invoice.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/Service/Venta/MediosPago/Toku/Invoice.php b/app/src/Service/Venta/MediosPago/Toku/Invoice.php index d808516..c6b3000 100644 --- a/app/src/Service/Venta/MediosPago/Toku/Invoice.php +++ b/app/src/Service/Venta/MediosPago/Toku/Invoice.php @@ -3,6 +3,7 @@ namespace Incoviba\Service\Venta\MediosPago\Toku; use DateMalformedStringException; use DateTimeImmutable; +use DateTimeZone; use Psr\Http\Client\ClientInterface; use Incoviba\Common\Implement\Exception\EmptyResponse; use Incoviba\Common\Implement\Exception\EmptyResult; @@ -151,6 +152,8 @@ class Invoice extends AbstractEndPoint 'invoice_external_id' => 'cuota_id' ]; + $today = new DateTimeImmutable('now', new DateTimeZone('America/Santiago')); + $params = []; foreach ($paramsMap as $key => $ref) { if ($ref === null) { @@ -161,7 +164,10 @@ class Invoice extends AbstractEndPoint continue; } if ($ref === 'valor') { - $valor = $data['cuota']->pago->valor(); + $valor = 0; + if ($data['cuota']->pago->fecha <= $today) { + $valor = $data['cuota']->pago->valor(); + } if ($valor === 0) { $valor = $data['cuota']->pago->valor / $data['venta']->uf; }