Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #68 from giansalex/fix-dni-consult
Browse files Browse the repository at this point in the history
Fix consulta DNI
  • Loading branch information
giansalex authored Oct 17, 2023
2 parents 9d31477 + 014c74d commit 0befc97
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Peru/Jne/Async/Dni.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Peru/Jne/Dni.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Peru/Jne/Endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

0 comments on commit 0befc97

Please sign in to comment.