diff --git a/src/Peru/Jne/Async/Dni.php b/src/Peru/Jne/Async/Dni.php index 56daee7..448b3a7 100644 --- a/src/Peru/Jne/Async/Dni.php +++ b/src/Peru/Jne/Async/Dni.php @@ -50,10 +50,10 @@ public function setRequestToken(string $requestToken): void */ public function get(string $dni): PromiseInterface { - $url = sprintf(Endpoints::CONSULT, $dni); + $params = '{"tipDocu": "1", "numDocu": "'.$dni.'", "tipPers":"1"}'; return $this->client - ->postAsync($url, null) + ->postAsync(Endpoints::CONSULT, $params, ['Content-Type' => 'application/json']) ->then(function ($json) use ($dni) { if ($json === false || !($result = json_decode($json)) || !isset($result->nombreSoli)) { return null; diff --git a/src/Peru/Jne/Dni.php b/src/Peru/Jne/Dni.php index 3460d25..306e855 100644 --- a/src/Peru/Jne/Dni.php +++ b/src/Peru/Jne/Dni.php @@ -56,8 +56,8 @@ public function setRequestToken(string $requestToken): void */ public function get(string $dni): ?Person { - $url = sprintf(Endpoints::CONSULT, $dni); - $json = $this->client->post($url, []); + $params = '{"tipDocu": "1", "numDocu": "'.$dni.'", "tipPers":"1"}'; + $json = $this->client->post(Endpoints::CONSULT, $params, ['Content-Type' => 'application/json']); if ($json === false || !($result = json_decode($json)) || !isset($result->nombreSoli)) { return null; diff --git a/src/Peru/Jne/Endpoints.php b/src/Peru/Jne/Endpoints.php index 28d0807..721ee7c 100644 --- a/src/Peru/Jne/Endpoints.php +++ b/src/Peru/Jne/Endpoints.php @@ -6,5 +6,5 @@ final class Endpoints { - public const CONSULT = 'https://ww1.sunat.gob.pe/ol-ti-itatencionf5030/registro/solicitante?tipDocu=1&numDocu=%s&tipPers=1'; + public const CONSULT = 'https://ww1.sunat.gob.pe/ol-ti-itatencionf5030/registro/solicitante'; }