diff --git a/app/setup/setups/services.php b/app/setup/setups/services.php index 1e9acc8..e5cf4de 100644 --- a/app/setup/setups/services.php +++ b/app/setup/setups/services.php @@ -125,6 +125,7 @@ return [ 'headers' => $request->getHeaders(), 'body' => $request->getBody()->getContents(), ]); + return $request; })); return new GuzzleHttp\Client([ 'handler' => $stack, diff --git a/app/src/Service/Venta/MediosPago/Toku/Invoice.php b/app/src/Service/Venta/MediosPago/Toku/Invoice.php index ef275c8..914659f 100644 --- a/app/src/Service/Venta/MediosPago/Toku/Invoice.php +++ b/app/src/Service/Venta/MediosPago/Toku/Invoice.php @@ -251,7 +251,7 @@ class Invoice extends AbstractEndPoint { $paramsMap = [ 'customer' => 'customer', - 'product_id' => 'cuota_id', + 'product_id' => 'venta_id', 'due_date' => 'fecha', 'subscription' => 'subscription', 'amount' => 'valor', @@ -266,8 +266,6 @@ 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) { @@ -278,14 +276,6 @@ class Invoice extends AbstractEndPoint continue; } if ($ref === '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; - } - $params[$key] = $valor;*/ $params[$key] = $data['cuota']->pago->valor; continue; } @@ -303,6 +293,10 @@ class Invoice extends AbstractEndPoint $params[$key] = $data['cuota']->id; continue; } + if ($ref === 'product_id') { + $params[$key] = $data['venta']->id; + continue; + } if (array_key_exists($ref, $data) and $data[$ref] !== '' and $data[$ref] !== null) { $params[$key] = $data[$ref]; }