Skip to content

Commit 7cf20a7

Browse files
✨feat: New example of get Pix bucket
1 parent bfc43fa commit 7cf20a7

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/endpoints-exclusivos-efi#consultar-baldes-de-fichas
6+
*/
7+
8+
$autoload = realpath(__DIR__ . "/../../../vendor/autoload.php");
9+
if (!file_exists($autoload)) {
10+
die("Autoload file not found or on path <code>$autoload</code>.");
11+
}
12+
require_once $autoload;
13+
14+
use Efi\Exception\EfiException;
15+
use Efi\EfiPay;
16+
17+
$optionsFile = __DIR__ . "/../../credentials/options.php";
18+
if (!file_exists($optionsFile)) {
19+
die("Options file not found or on path <code>$options</code>.");
20+
}
21+
$options = include $optionsFile;
22+
23+
try {
24+
$api = new EfiPay($options);
25+
$response = $api->pixKeysBucket();
26+
27+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
28+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
29+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
30+
} else {
31+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
32+
}
33+
} catch (EfiException $e) {
34+
print_r($e->code . "<br>");
35+
print_r($e->error . "<br>");
36+
print_r($e->errorDescription) . "<br>";
37+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
38+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
39+
}
40+
} catch (Exception $e) {
41+
print_r($e->getMessage());
42+
}

src/Efi/EfiPay.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
* @method mixed medList(array $params)
9090
* @method mixed medDefense(array $params, array $body)
9191
* @method mixed pixGetReceipt(array $params)
92+
* @method mixed pixKeysBucket()
9293
* @method mixed pixCreateDueCharge(array $params, array $body)
9394
* @method mixed pixUpdateDueCharge(array $params, array $body)
9495
* @method mixed pixDetailDueCharge(array $params)

src/Efi/Endpoints/Pix.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@
280280
"method" => "get",
281281
"scope" => "gn.receipts.read"
282282
],
283+
"pixKeysBucket" => [
284+
"route" => "/v2/gn/chaves/balde",
285+
"method" => "get",
286+
"scope" => "gn.keys.bucket.read"
287+
],
283288
"pixConfigWebhookRecurrenceAutomatic" => [
284289
"route" => "/v2/webhookrec",
285290
"method" => "put",

0 commit comments

Comments
 (0)