feature/cierres #30

Merged
aldarien merged 460 commits from feature/cierres into develop 2025-09-11 15:16:17 -03:00
188 changed files with 677 additions and 6679 deletions
Showing only changes of commit a54586e870 - Show all commits

View File

@ -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;
}