From 7510123626b2dc478839622897a867b009132add Mon Sep 17 00:00:00 2001 From: Juan Felipe Zapata Moreno Date: Thu, 12 Mar 2026 15:33:25 -0600 Subject: [PATCH] =?UTF-8?q?feat:=20mejora=20la=20construcci=C3=B3n=20de=20?= =?UTF-8?q?cadenas=20para=20las=20solicitudes=20de=20verificaci=C3=B3n=20y?= =?UTF-8?q?=20consulta=20de=20veh=C3=ADculos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/RepuveService.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/app/Services/RepuveService.php b/app/Services/RepuveService.php index dfda03d..a3c44f9 100644 --- a/app/Services/RepuveService.php +++ b/app/Services/RepuveService.php @@ -118,7 +118,11 @@ public function consultarPadron(string $niv) $this->asegurarCargaCredenciales(); $url = $this->baseUrl . $this->roboEndpoint; - $arg2 = $niv . '|||||||'; + + // 8 posiciones: [0]=NIV, [1]=vacío, [2]=placa, [3-7]=vacíos + $campos = array_fill(0, 8, ''); + $campos[0] = $niv; + $arg2 = implode('|', $campos); $soapBody = << @@ -278,14 +282,12 @@ public function verificarRobo(?string $niv = null, ?string $placa = null): array $url = $this->baseUrl . $this->roboEndpoint; - // Construir arg2 según los parámetros enviados - if (!empty($niv) && !empty($placa)) { - $arg2 = $niv . '|' . $placa . str_repeat('|', 5); - } elseif (!empty($niv)) { - $arg2 = $niv . str_repeat('|', 7); - } else { - $arg2 = '||' . $placa . str_repeat('|', 5); - } + // 8 posiciones: [0]=NIV, [1]=vacío, [2]=placa, [3-7]=vacíos + // Ejemplo: LSGHD52H0ND032457||WNU700B||||| + $campos = array_fill(0, 8, ''); + $campos[0] = $niv ?? ''; + $campos[2] = $placa ?? ''; + $arg2 = implode('|', $campos); Log::channel('repuve_nacional')->info('REPUVE verificarRobo: Cadena construida', [ 'niv' => $niv, @@ -384,12 +386,12 @@ public function consultarVehiculo(?string $niv = null, ?string $placa = null) $url = $this->baseUrl . '/jaxws-consultarpv/ConsultaRpv'; - // Construir arg2: NIV|||||||| - if ($placa) { - $arg2 = ($niv ?? '') . '|' . $placa . str_repeat('|', 5); - } else { - $arg2 = ($niv ?? '') . str_repeat('|', 7); - } + // 8 posiciones: [0]=NIV, [1]=vacío, [2]=placa, [3-7]=vacíos + // Ejemplo: LSGHD52H0ND032457||WNU700B||||| + $campos = array_fill(0, 8, ''); + $campos[0] = $niv ?? ''; + $campos[2] = $placa ?? ''; + $arg2 = implode('|', $campos); $soapBody = <<