Skip to content

Commit cb43593

Browse files
✨ feat: Added new endpoints for batch cobV
1 parent fb56448 commit cb43593

File tree

5 files changed

+220
-0
lines changed

5 files changed

+220
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/cobrancas-com-vencimento#criaralterar-lote-de-cobranças-com-vencimento
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+
"id" => 1 // integer($int64)
25+
];
26+
27+
$body = [
28+
"descricao" => "Cobranças dos alunos do turno vespertino",
29+
"cobsv" => [
30+
[
31+
"calendario" => [
32+
"dataDeVencimento" => "2023-12-16",
33+
"validadeAposVencimento" => 5
34+
],
35+
"txid" => "00000000000000000000000000000000000",
36+
"devedor" => [
37+
"cpf" => "08577095428",
38+
"nome" => "João Souza"
39+
],
40+
"valor" => [
41+
"original" => "0.01"
42+
],
43+
"chave" => "00000000-0000-0000-0000-000000000000",
44+
"solicitacaoPagador" => "Informar matrícula"
45+
],
46+
[
47+
"calendario" => [
48+
"dataDeVencimento" => "2023-12-17",
49+
"validadeAposVencimento" => 6
50+
],
51+
"txid" => "00000000000000000000000000000000001",
52+
"devedor" => [
53+
"cpf" => "15311295449",
54+
"nome" => "Manoel Silva"
55+
],
56+
"valor" => [
57+
"original" => "0.02"
58+
],
59+
"chave" => "00000000-0000-0000-0000-000000000000",
60+
"solicitacaoPagador" => "Informar matrícula"
61+
]
62+
]
63+
];
64+
65+
try {
66+
$api = new EfiPay($options);
67+
$response = $api->pixCreateDueChargeBatch($params, $body);
68+
69+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
70+
} catch (EfiException $e) {
71+
print_r($e->code . "<br>");
72+
print_r($e->error . "<br>");
73+
print_r($e->errorDescription) . "<br>";
74+
} catch (Exception $e) {
75+
print_r($e->getMessage());
76+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/cobrancas-com-vencimento#consultar-lote-de-cobranças-com-vencimento
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+
"id" => 1 // integer($int64)
25+
];
26+
27+
try {
28+
$api = new EfiPay($options);
29+
$response = $api->pixDetailDueChargeBatch($params);
30+
31+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
32+
} catch (EfiException $e) {
33+
print_r($e->code . "<br>");
34+
print_r($e->error . "<br>");
35+
print_r($e->errorDescription) . "<br>";
36+
} catch (Exception $e) {
37+
print_r($e->getMessage());
38+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/cobrancas-com-vencimento#consultar-lista-de-lotes-de-cobranças-com-vencimento
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+
"inicio" => "2024-01-01T00:00:00Z",
25+
"fim" => "2024-12-31T23:59:59Z",
26+
// "paginacao.paginaAtual" => 1,
27+
// "paginacao.itensPorPagina" => 10
28+
];
29+
30+
try {
31+
$api = new EfiPay($options);
32+
$response = $api->pixListDueChargeBatch($params);
33+
34+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
35+
} catch (EfiException $e) {
36+
print_r($e->code . "<br>");
37+
print_r($e->error . "<br>");
38+
print_r($e->errorDescription) . "<br>";
39+
} catch (Exception $e) {
40+
print_r($e->getMessage());
41+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
/**
4+
* Detailed endpoint documentation
5+
* https://dev.efipay.com.br/docs/api-pix/cobrancas-com-vencimento#revisar-cobranças-específicas-de-um-lote
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+
"id" => 1 // integer($int64)
25+
];
26+
27+
$body = [
28+
"cobsv" => [
29+
[
30+
"calendario" => [
31+
"dataDeVencimento" => "2023-12-18",
32+
],
33+
"txid" => "00000000000000000000000000000000000",
34+
"valor" => [
35+
"original" => "0.02"
36+
]
37+
],
38+
[
39+
"calendario" => [
40+
"dataDeVencimento" => "2023-12-19",
41+
],
42+
"txid" => "00000000000000000000000000000000001",
43+
"valor" => [
44+
"original" => "0.03"
45+
]
46+
]
47+
]
48+
];
49+
50+
try {
51+
$api = new EfiPay($options);
52+
$response = $api->pixUpdateDueChargeBatch($params, $body);
53+
54+
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
55+
} catch (EfiException $e) {
56+
print_r($e->code . "<br>");
57+
print_r($e->error . "<br>");
58+
print_r($e->errorDescription) . "<br>";
59+
} catch (Exception $e) {
60+
print_r($e->getMessage());
61+
}

src/Efi/EfiPay.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@
9797
* @method string pixSplitConfig(array $params = [], array $body)
9898
* @method string pixSplitConfigId(array $params, array $body)
9999
* @method string pixSplitDetailConfig(array $params)
100+
* @method string pixCreateDueChargeBatch(array $params, array $body)
101+
* @method string pixUpdateDueChargeBatch(array $params, array $body)
102+
* @method string pixDetailDueChargeBatch(array $params)
103+
* @method string pixListDueChargeBatch(array $params)
100104
*
101105
* API OPEN FINANCE
102106
* @method array ofConfigUpdate(array $params = [], array $body)

0 commit comments

Comments
 (0)