Skip to content

Commit

Permalink
Merge pull request #6 from thegreenter/feature/guzzle-7
Browse files Browse the repository at this point in the history
Suppport Guzzle v7
  • Loading branch information
giansalex authored Jul 21, 2021
2 parents 150df00 + 500c10d commit 9366668
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ $apiInstance = new \Greenter\Sunat\ConsultaCpe\Api\ConsultaApi(
$config->setHost($config->getHostFromSettings(1))
);
$ruc = '20000000001'; // RUC de quién realiza la consulta

$cpeFilter = (new \Greenter\Sunat\ConsultaCpe\Model\CpeFilter())
->setNumRuc($ruc)
->setNumRuc('20000000001') // RUC del emisor
->setCodComp('01') // Tipo de comprobante
->setNumeroSerie('F001')
->setNumero('1')
Expand Down Expand Up @@ -140,6 +141,10 @@ Código | Descripción |
12 | NO HABIDO
20 | NO HALLADO

## FAQ
- *¿Puedo consultar los comprobantes de cualquier RUC con el mismo `client_id`?*
Solo se pueden consultar los comprobantes en donde el RUC que generó el `client_id`, fue emisor o receptor.

## Docs Models

- [ApiToken](docs/Model/ApiToken.md)
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"php": ">=7.1",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"guzzlehttp/guzzle": "^6.2"
"guzzlehttp/guzzle": "^6.2 || ^7.3"
},
"require-dev": {
"phpunit/phpunit": "^7.4",
Expand All @@ -30,5 +29,8 @@
},
"autoload-dev": {
"psr-4": { "Tests\\Greenter\\Sunat\\ConsultaCpe\\" : "tests/" }
},
"suggest": {
"ext-mbstring": "guzzle ^6, phpunit required"
}
}
6 changes: 3 additions & 3 deletions tests/Api/ConsultaApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function testConsultarCpe()
$client = new Client();
$apiInstance = new AuthApi($client);

$rucAuth = '20123456789';
$result = $apiInstance->getToken(
'client_credentials',
'https://api.sunat.gob.pe/v1/contribuyente/contribuyentes',
Expand All @@ -41,17 +42,16 @@ public function testConsultarCpe()
$config->setHost($config->getHostFromSettings(1))
);

$ruc = '20123456789';
$filter = new CpeFilter();
$filter
->setNumRuc($ruc)
->setNumRuc('20123456789')
->setCodComp('01')
->setNumeroSerie('E001')
->setNumero('5')
->setFechaEmision('20/10/2020')
->setMonto('100.00');

$result = $cpeInstance->consultarCpe($ruc, $filter);
$result = $cpeInstance->consultarCpe($rucAuth, $filter);

$this->assertTrue($result->getSuccess());

Expand Down

0 comments on commit 9366668

Please sign in to comment.