Skip to content

Commit

Permalink
Boleto Inter e API
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardokum committed Dec 6, 2021
1 parent 3d9a03e commit f7bf190
Show file tree
Hide file tree
Showing 22 changed files with 1,307 additions and 10 deletions.
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
}
],
"require": {
"php": ">5.5.0",
"ext-intl": "*",
"ext-mbstring": "*",
"laravel/framework": "^5.0||^6.0||^7.0||^8.0",
"php": ">5.5.0",
"ext-intl": "*",
"ext-mbstring": "*",
"laravel/framework": "^5.0||^6.0||^7.0||^8.0",
"neitanod/forceutf8": "^2.0",
"setasign/fpdf": "^1.8"
"setasign/fpdf": "^1.8",
"ext-curl": "*",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": ">=6.0||^8.0||^9.0",
Expand Down
3 changes: 3 additions & 0 deletions exemplos/arquivos/inter.ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
02RETORNO01COBRANCA 000000000000000000000000000000077INTER 061221 000001
10 11200010100000000 0 00000000000 112020612210000000001000000000000712210000000001000077000101 00000000000000 00000000000000 000002
9201077 00000001 00001000000000000 00000 00000000000000000 000003
2 changes: 2 additions & 0 deletions exemplos/certs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
48 changes: 48 additions & 0 deletions exemplos/inter_boleto.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
require 'autoload.php';

$beneficiario = new \Eduardokum\LaravelBoleto\Pessoa(
[
'nome' => 'ACME',
'endereco' => 'Rua um, 123',
'cep' => '99999-999',
'uf' => 'UF',
'cidade' => 'CIDADE',
'documento' => '99.999.999/9999-99',
]
);

$pagador = new \Eduardokum\LaravelBoleto\Pessoa(
[
'nome' => 'Cliente',
'endereco' => 'Rua um, 123',
'bairro' => 'Bairro',
'cep' => '99999-999',
'uf' => 'UF',
'cidade' => 'CIDADE',
'documento' => '999.999.999-99',
]
);

$boleto = new Eduardokum\LaravelBoleto\Boleto\Banco\Inter(
[
'logo' => realpath(__DIR__ . '/../logos/') . DIRECTORY_SEPARATOR . '077.png',
'dataVencimento' => (new \Carbon\Carbon())->addDays(),
'valor' => 10,
'multa' => false,
'juros' => false,
'numero' => 1,
'numeroDocumento' => 1,
'nossoNumero' => '00757713765',
'pagador' => $pagador,
'beneficiario' => $beneficiario,
'conta' => '173699880',
'operacao' => '0587891',
'aceite' => 'S',
'especieDoc' => 'DM'
]
);

$pdf = new Eduardokum\LaravelBoleto\Boleto\Render\Pdf();
$pdf->addBoleto($boleto);
$pdf->gerarBoleto($pdf::OUTPUT_SAVE, __DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'inter.pdf');
55 changes: 55 additions & 0 deletions exemplos/inter_boleto_api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
require 'autoload.php';

$beneficiario = new \Eduardokum\LaravelBoleto\Pessoa(
[
'nome' => 'INTRA-SIS DESENVOLVIMENTO DE SISTEMAS',
'endereco' => 'Av. Engenheiro Caetano Alvares, 3536 - Sala 3',
'cep' => '02546-000',
'uf' => 'SP',
'cidade' => 'São Paulo',
'documento' => '10.228.511/0001-19',
]
);

$pagador = new \Eduardokum\LaravelBoleto\Pessoa(
[
'nome' => 'Eduardo Gusmão',
'endereco' => 'Rua Sete de Abril, 1294 - AP 503',
'bairro' => 'Juveve',
'cep' => '80040-120',
'uf' => 'PR',
'cidade' => 'Curitiba',
'documento' => '33532256843',
]
);

$boleto = new Eduardokum\LaravelBoleto\Boleto\Banco\Inter(
[
'logo' => realpath(__DIR__ . '/../logos/') . DIRECTORY_SEPARATOR . '077.png',
'dataVencimento' => (new \Carbon\Carbon())->addDays(),
'valor' => 10,
'multa' => false,
'juros' => false,
'numero' => 1,
'numeroDocumento' => 1,
'pagador' => $pagador,
'beneficiario' => $beneficiario,
'conta' => '173699880',
'operacao' => '0587891',
'aceite' => 'S',
'especieDoc' => 'DM'
]
);

$api = new Eduardokum\LaravelBoleto\Api\Banco\Inter(
'173699880',
realpath(__DIR__ . '/certs/') . DIRECTORY_SEPARATOR . 'cert.crt',
realpath(__DIR__ . '/certs/') . DIRECTORY_SEPARATOR . 'key.key'
);

$boleto = $api->createBoleto($boleto);

$pdf = new Eduardokum\LaravelBoleto\Boleto\Render\Pdf();
$pdf->addBoleto($boleto);
$pdf->gerarBoleto($pdf::OUTPUT_SAVE, __DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'inter.pdf');
37 changes: 37 additions & 0 deletions exemplos/inter_boleto_lista_api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Eduardokum\LaravelBoleto\Boleto\Banco\Inter;

require 'autoload.php';

$beneficiario = new \Eduardokum\LaravelBoleto\Pessoa(
[
'nome' => 'ACME',
'endereco' => 'Rua um, 123',
'cep' => '99999-999',
'uf' => 'UF',
'cidade' => 'CIDADE',
'documento' => '99.999.999/9999-99',
]
);

$api = new Eduardokum\LaravelBoleto\Api\Banco\Inter(
'173699880',
realpath(__DIR__ . '/certs/') . DIRECTORY_SEPARATOR . 'cert.crt',
realpath(__DIR__ . '/certs/') . DIRECTORY_SEPARATOR . 'key.key'
);

$retorno = $api->retrieveList();
$boletos = [];
if ($list = $retorno->body->content) {
foreach ($list as $boleto) {
$boletos[] = Inter::createFromAPI($boleto, [
'conta' => '173699880',
'beneficiario' => $beneficiario,
]);
}
}

$pdf = new Eduardokum\LaravelBoleto\Boleto\Render\Pdf();
$pdf->addBoletos($boletos);
$pdf->gerarBoleto($pdf::OUTPUT_SAVE, __DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'inter_lista.pdf');
59 changes: 59 additions & 0 deletions exemplos/inter_remessa.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

use Eduardokum\LaravelBoleto\Util;

require 'autoload.php';

$beneficiario = new \Eduardokum\LaravelBoleto\Pessoa(
[
'nome' => 'INTRA-SIS DESENVOLVIMENTO DE SISTEMAS',
'endereco' => 'Av. Engenheiro Caetano Alvares, 3536 - Sala 3',
'cep' => '02546-000',
'uf' => 'SP',
'cidade' => 'São Paulo',
'documento' => '10.228.511/0001-19',
]
);

$pagador = new \Eduardokum\LaravelBoleto\Pessoa(
[
'nome' => 'Eduardo Gusmão',
'endereco' => 'Rua Sete de Abril, 1294 - AP 503',
'bairro' => 'Juveve',
'cep' => '80040-120',
'uf' => 'PR',
'cidade' => 'Curitiba',
'documento' => '33532256843',
]
);

$boleto = new Eduardokum\LaravelBoleto\Boleto\Banco\Inter(
[
'logo' => realpath(__DIR__ . '/../logos/') . DIRECTORY_SEPARATOR . '077.png',
'dataVencimento' => (new \Carbon\Carbon())->addDays(),
'valor' => 10,
'multa' => false,
'juros' => false,
'numero' => 1,
'numeroDocumento' => 1,
'pagador' => $pagador,
'beneficiario' => $beneficiario,
'conta' => '173699880',
'operacao' => '0587891',
'aceite' => 'S',
'especieDoc' => 'DM'
]
);

$remessa = new \Eduardokum\LaravelBoleto\Cnab\Remessa\Cnab400\Banco\Inter(
[
'idRemessa' => 1,
'agencia' => '0001',
'conta' => '173699880',
'carteira' => 112,
'beneficiario' => $beneficiario,
]
);
$remessa->addBoleto($boleto);

echo $remessa->save(__DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'inter.txt', true);
7 changes: 7 additions & 0 deletions exemplos/inter_retorno.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
require 'autoload.php';
$retorno = \Eduardokum\LaravelBoleto\Cnab\Retorno\Factory::make(__DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'inter.ret');
$retorno->processar();

echo $retorno->getBancoNome();
dd($retorno->getDetalhes());
Binary file added logos/077.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added manuais/INTER/manual-remessa-inter.pdf
Binary file not shown.
Loading

0 comments on commit f7bf190

Please sign in to comment.