Skip to content

Commit

Permalink
1.x: 1.x: Add new endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipeMata committed Jul 10, 2018
1 parent c9e99ea commit aa359d9
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.0.16

- Added: new endpoint (create charge balance sheet)

# 1.0.15

- Added: new endpoint (update plan)
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gerencianet/gerencianet-sdk-php",
"description": "GN API SDK PHP",
"version": "1.0.15",
"version": "1.0.16",
"require": {
"guzzlehttp/guzzle": "5.3.0",
"php": ">=5.4.0"
Expand Down Expand Up @@ -29,4 +29,4 @@
"Gerencianet": "src/"
}
}
}
}
99 changes: 99 additions & 0 deletions examples/charge/createChargeBalanceSheet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php
require __DIR__.'/../../vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$file = file_get_contents(__DIR__.'/../config.json');
$options = json_decode($file, true);
$params = ['id' => 1];
$body = [
'title' => 'Balancete Demonstrativo',
'body' =>
[
0 =>
[
'header' => 'Demonstrativo de Consumo',
'tables' =>
[
0 =>
[
'rows' =>
[
0 =>
[
0 =>
[
'align' => 'left',
'color' => '#000000',
'style' => 'bold',
'text' => 'Exemplo de despesa',
'colspan' => 2,
],
1 =>
[
'align' => 'left',
'color' => '#000000',
'style' => 'bold',
'text' => 'Total lançado',
'colspan' => 2,
],
],
1 =>
[
0 =>
[
'align' => 'left',
'color' => '#000000',
'style' => 'normal',
'text' => 'Instalação',
'colspan' => 2,
],
1 =>
[
'align' => 'left',
'color' => '#000000',
'style' => 'normal',
'text' => 'R$ 100,00',
'colspan' => 2,
],
],
],
],
],
],
1 =>
[
'header' => 'Balancete Geral',
'tables' =>
[
0 =>
[
'rows' =>
[
0 =>
[
0 =>
[
'align' => 'left',
'color' => '#000000',
'style' => 'normal',
'text' => 'Confira na documentação da Gerencianet todas as configurações possíveis de um boleto balancete.',
'colspan' => 4,
],
],
],
],
],
],
],
];
try {
$api = new Gerencianet($options);
$response = $api->createChargeBalanceSheet($params, $body);
print_r($response);
} catch (GerencianetException $e) {
print_r($e->code);
print_r($e->error);
print_r($e->errorDescription);
} catch (Exception $e) {
print_r($e->getMessage());
}
6 changes: 5 additions & 1 deletion src/Gerencianet/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
"createSubscriptionHistory": {
"route": "/v1/subscription/:id/history",
"method": "post"
},
"createChargeBalanceSheet": {
"route": "/v1/charge/:id/balance-sheet",
"method": "post"
}
}
}
}

0 comments on commit aa359d9

Please sign in to comment.