FIX: valor cuota cuando UF no existe.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user