File tree Expand file tree Collapse file tree 1 file changed +22
-21
lines changed Expand file tree Collapse file tree 1 file changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ Primero es necesario obtener el client_id, client_secret desde el portal de SUNA
21
21
22
22
``` php
23
23
<?php
24
-
25
24
$apiInstance = new Greenter\Sunat\GRE\Api\AuthApi(
26
25
new GuzzleHttp\Client()
27
26
);
41
40
42
41
```
43
42
44
- ## Models
43
+ Enviar comprobante
44
+ ``` php
45
+ $config = Greenter\Sunat\GRE\Configuration::getDefaultConfiguration()
46
+ ->setAccessToken($token);
47
+
48
+ $cpeApi = new Greenter\Sunat\GRE\Api\CpeApi(
49
+ new GuzzleHttp\Client(),
50
+ $config->setHost('https://api.sunat.gob.pe/v1')
51
+ );
52
+
53
+ $greZip = file_get_contents('20161515648-09-T001-124.zip');
54
+ $doc = (new Greenter\Sunat\GRE\Model\CpeDocument())
55
+ ->setArchivo((new Greenter\Sunat\GRE\Model\CpeDocumentArchivo())
56
+ ->setNomArchivo('20161515648-09-T001-124.zip')
57
+ ->setArcGreZip(base64_encode($greZip))
58
+ ->setHashZip(hash('sha256', $greZip))
59
+ );
60
+ $result = $cpeApi->enviarCpe('20161515648-09-T001-124', $doc);
61
+ $ticket = $result->getNumTicket();
62
+ ```
63
+
64
+ ## Doc Models
45
65
46
66
- [ ApiToken] ( docs/Model/ApiToken.md )
47
67
- [ CpeDocument] ( docs/Model/CpeDocument.md )
51
71
- [ CpeResponse] ( docs/Model/CpeResponse.md )
52
72
- [ StatusResponse] ( docs/Model/StatusResponse.md )
53
73
- [ StatusResponseError] ( docs/Model/StatusResponseError.md )
54
-
55
- ## Authorization
56
-
57
- ### sunat_auth
58
-
59
- - ** Type** : Bearer authentication
60
-
61
- ## Tests
62
-
63
- To run the tests, use:
64
-
65
- ``` bash
66
- composer install
67
- vendor/bin/phpunit
68
- ```
69
-
70
- ## Author
71
-
72
- me@giansalex.dev
You can’t perform that action at this time.
0 commit comments