From d6e60efcaf2bc3c0b415bcb815da4489a5d90ce6 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Tue, 13 May 2025 20:12:26 -0400 Subject: [PATCH] Parametros correctos --- app/src/Service/Venta/MediosPago/Toku/Customer.php | 2 +- app/src/Service/Venta/MediosPago/Toku/Invoice.php | 8 ++++---- app/src/Service/Venta/MediosPago/Toku/Subscription.php | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/Service/Venta/MediosPago/Toku/Customer.php b/app/src/Service/Venta/MediosPago/Toku/Customer.php index 6ab8b0a..75c1a0b 100644 --- a/app/src/Service/Venta/MediosPago/Toku/Customer.php +++ b/app/src/Service/Venta/MediosPago/Toku/Customer.php @@ -72,7 +72,7 @@ class Customer extends AbstractEndPoint if ($ref === null) { continue; } - if (array_key_exists($ref, $data)) { + if (array_key_exists($ref, $data) and $data[$ref] !== '' and $data[$ref] !== null) { $params[$key] = $data[$ref]; } } diff --git a/app/src/Service/Venta/MediosPago/Toku/Invoice.php b/app/src/Service/Venta/MediosPago/Toku/Invoice.php index eac203c..c781736 100644 --- a/app/src/Service/Venta/MediosPago/Toku/Invoice.php +++ b/app/src/Service/Venta/MediosPago/Toku/Invoice.php @@ -127,7 +127,7 @@ class Invoice extends AbstractEndPoint $params[$key] = $data['cuota']->id; continue; } - if (array_key_exists($ref, $data)) { + if (array_key_exists($ref, $data) and $data[$ref] !== '' and $data[$ref] !== null) { $params[$key] = $data[$ref]; } } @@ -149,11 +149,11 @@ class Invoice extends AbstractEndPoint return $mappedData; } - protected function datosCuota(Model\Venta\Cuota $cuota): string + protected function datosCuota(Model\Venta\Cuota $cuota): array { - return json_encode([ + return [ 'numero' => $cuota->numero, 'monto_clp' => $cuota->pago->valor - ]); + ]; } } diff --git a/app/src/Service/Venta/MediosPago/Toku/Subscription.php b/app/src/Service/Venta/MediosPago/Toku/Subscription.php index d70a7d6..9b41b7c 100644 --- a/app/src/Service/Venta/MediosPago/Toku/Subscription.php +++ b/app/src/Service/Venta/MediosPago/Toku/Subscription.php @@ -73,7 +73,7 @@ class Subscription extends AbstractEndPoint $params[$key] = $this->datosVenta($data['venta']); continue; } - if (array_key_exists($ref, $data)) { + if (array_key_exists($ref, $data) and $data[$ref] !== '' and $data[$ref] !== null) { $params[$key] = $data[$ref]; } } @@ -94,12 +94,11 @@ class Subscription extends AbstractEndPoint } return $mappedData; } - protected function datosVenta(Venta $venta): string + protected function datosVenta(Venta $venta): array { - $datos = [ + return [ 'proyecto' => $venta->proyecto()->descripcion, 'unidades' => $venta->propiedad()->summary() ]; - return json_encode($datos); } }