Skip to content

Commit 158490b

Browse files
✨feat: New examples of Pix automatic solicRec endpoints
1 parent 3b47373 commit 158490b

File tree

5 files changed

+174
-0
lines changed

5 files changed

+174
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/pix-automatico#criar-solicitação-de-confirmação-de-recorrência-de-pix-automático
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+
$params = [
24+
"idRec" => "R00000000000000000000001",
25+
];
26+
27+
$body = [
28+
"idRec" => "R00000000000000000000001",
29+
"calendario" => [
30+
"dataExpiracaoSolicitacao" => "2026-12-31T12:17:11.926Z"
31+
],
32+
"destinatario" => [
33+
"agencia" => "0001",
34+
"conta" => "00000",
35+
"cpf" => "11122233344",
36+
// "cnpj" => "11122233344444",
37+
"ispbParticipante" => "09089356"
38+
]
39+
];
40+
41+
try {
42+
$api = new EfiPay($options);
43+
$response = $api->pixCreateRequestRecurrenceAutomatic($params, $body);
44+
45+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
46+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
47+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
48+
} else {
49+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
50+
}
51+
} catch (EfiException $e) {
52+
print_r($e->code . "<br>");
53+
print_r($e->error . "<br>");
54+
print_r($e->errorDescription) . "<br>";
55+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
56+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
57+
}
58+
} catch (Exception $e) {
59+
print_r($e->getMessage());
60+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/pix-automatico#consultar-solicitação-de-confirmação-de-recorrência-de-pix-automático
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+
$params = [
24+
"idSolicRec" => "SC0000000000000000000001"
25+
];
26+
27+
try {
28+
$api = new EfiPay($options);
29+
$response = $api->pixDetailRequestRecurrenceAutomatic($params);
30+
31+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
32+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
33+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
34+
} else {
35+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
36+
}
37+
} catch (EfiException $e) {
38+
print_r($e->code . "<br>");
39+
print_r($e->error . "<br>");
40+
print_r($e->errorDescription) . "<br>";
41+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
42+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
43+
}
44+
} catch (Exception $e) {
45+
print_r($e->getMessage());
46+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/pix-automatico#revisar-solicitação-de-confirmação-de-recorrência-de-pix-automático
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+
$params = [
24+
"idSolicRec" => "SC00000000000000000000001",
25+
];
26+
27+
$body = [
28+
"status" => "CANCELADA"
29+
];
30+
31+
try {
32+
$api = new EfiPay($options);
33+
$response = $api->pixUpdateRequestRecurrenceAutomatic($params, $body);
34+
35+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
36+
print_r("<pre>" . json_encode($response->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
37+
print_r("<pre>" . json_encode($response->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
38+
} else {
39+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
40+
}
41+
} catch (EfiException $e) {
42+
print_r($e->code . "<br>");
43+
print_r($e->error . "<br>");
44+
print_r($e->errorDescription) . "<br>";
45+
if (isset($options["responseHeaders"]) && $options["responseHeaders"]) {
46+
print_r("<pre>" . json_encode($e->headers, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
47+
}
48+
} catch (Exception $e) {
49+
print_r($e->getMessage());
50+
}

src/Efi/EfiPay.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@
123123
* @method object pixUpdateRecurrenceAutomatic($params, $body)
124124
* @method object pixListRecurrenceAutomatic($params, $body)
125125
* @method object pixCreateRecurrenceAutomatic($params = [], $body)
126+
* @method object pixCreateRequestRecurrenceAutomatic($params, $body)
127+
* @method object pixDetailRequestRecurrenceAutomatic($params)
128+
* @method object pixUpdateRequestRecurrenceAutomatic($params, $body)
126129
*
127130
* API OPEN FINANCE
128131
* @method object ofConfigUpdate(array $params = [], array $body)

src/Efi/Endpoints/Pix.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,21 @@
344344
"route" => "/v2/rec",
345345
"method" => "post",
346346
"scope" => "rec.write"
347+
],
348+
"pixCreateRequestRecurrenceAutomatic" => [
349+
"route" => "/v2/solicrec",
350+
"method" => "post",
351+
"scope" => "solicrec.write"
352+
],
353+
"pixDetailRequestRecurrenceAutomatic" => [
354+
"route" => "/v2/solicrec/:idSolicRec",
355+
"method" => "get",
356+
"scope" => "solicrec.read"
357+
],
358+
"pixUpdateRequestRecurrenceAutomatic" => [
359+
"route" => "/v2/solicrec/:idSolicRec",
360+
"method" => "patch",
361+
"scope" => "solicrec.write"
347362
]
348363
]
349364
];

0 commit comments

Comments
 (0)