Skip to content

Commit 82e1a7d

Browse files
committed
diversas correções enviadas
1 parent 797b99f commit 82e1a7d

File tree

4 files changed

+23
-42
lines changed

4 files changed

+23
-42
lines changed

exemplos/sicredi_retorno.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require 'autoload.php';
33

4-
$retorno = \Eduardokum\LaravelBoleto\Cnab\Retorno\Factory::make(__DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'itau.ret');
4+
$retorno = \Eduardokum\LaravelBoleto\Cnab\Retorno\Factory::make(__DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'sicredi.ret');
55
$retorno->processar();
66

77
echo $retorno->getBancoNome();

src/Boleto/Banco/Bradesco.php

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,16 @@ class Bradesco extends AbstractBoleto implements BoletoContract
4545
* @var string
4646
*/
4747
protected $especiesCodigo240 = [
48-
'CH' => '01', // Cheque
49-
'DM' => '02', // Duplicata Mercantil
50-
'DMI' => '03', // Duplicata Mercantil p/ Indicação
51-
'DS' => '04', // Duplicata de Serviço
52-
'DSI' => '05', // Duplicata de Serviço p/ Indicação
53-
'DR' => '06', // Duplicata Rural
54-
'LC' => '07', // Letra de Câmbio
55-
'NCC' => '08', // Nota de Crédito Comercial
56-
'NCE' => '09', // Nota de Crédito a Exportação
57-
'NCI' => '10', // Nota de Crédito Industrial
58-
'NCR' => '11', // Nota de Crédito Rural
59-
'NP' => '12', // Nota Promissória
60-
'NPR' => '13', // Nota Promissória Rural
61-
'TM' => '14', // Triplicata Mercantil
62-
'TS' => '15', // Triplicata de Serviço
63-
'NS' => '16', // Nota de Seguro
64-
'RC' => '17', // Recibo
65-
'FAT' => '18', // Fatura
66-
'ND' => '19', // Nota de Débito
67-
'AP' => '20', // Apólice de Seguro
68-
'ME' => '21', // Mensalidade Escolar
69-
'PC' => '22', // Parcela de Consórcio
70-
'NF' => '23', // Nota Fiscal
71-
'DD' => '24', // Documento de Dívida
72-
'CPR' => '25', // Cédula de Produto Rural
73-
'WAR' => '26', // Warrant
74-
'DAE' => '27', // Dívida Ativa do Estado
75-
'DAM' => '28', // Dívida Ativa do Município
76-
'DAU' => '29', // Dívida Ativa da União
77-
'EC' => '30', // Encargos condominiais
78-
'CC' => '31', // Cartão de Crédito
79-
'BDP' => '32', // Boleto de Proposta
80-
'O' => '99', // Outros
48+
'DM' => '01', //Duplicata
49+
'NP' => '02', //Nota Promissória
50+
'NS' => '03', //Nota de Seguro
51+
'CS' => '04', //Cobrança Seriada
52+
'RC' => '05', //Recibo
53+
'LC' => '10', //Letras de Câmbio
54+
'ND' => '11', //Nota de Débito
55+
'DS' => '12', //Duplicata de Serv.
56+
'BP' => '30', //Boleto de Proposta
57+
'O' => '99', //Outros,
8158
];
8259
/**
8360
* Espécie do documento, coódigo para remessa

src/Cnab/Remessa/Cnab240/Banco/Caixa.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ protected function segmentoP(BoletoContract $boleto)
140140
}
141141
$this->add(18, 22, Util::formatCnab('9', $this->getAgencia(), 5));
142142
$this->add(23, 23, CalculoDV::cefAgencia($this->getAgencia()));
143-
$this->add(24, 29, Util::formatCnab('9', $this->getCodigoCliente(), 6));
144-
$this->add(30, 37, '00000000');
143+
$this->add(24, 30, Util::formatCnab('9', $this->getCodigoCliente(), 7));
144+
$this->add(31, 37, '0000000');
145145
$this->add(38, 39, '00');
146146
$this->add(40, 57, Util::formatCnab('9', $boleto->getNossoNumero(), 18));
147147
$this->add(58, 58, '1'); //'1' = Cobrança Simples
@@ -290,8 +290,8 @@ protected function header()
290290
$this->add(33, 52, Util::formatCnab('9', 0, 20));
291291
$this->add(53, 57, Util::formatCnab('9', $this->getAgencia(), 5));
292292
$this->add(58, 58, CalculoDV::cefAgencia($this->getAgencia()));
293-
$this->add(59, 64, Util::formatCnab('9', $this->getCodigoCliente(), 6));
294-
$this->add(65, 72, '00000000');
293+
$this->add(59, 65, Util::formatCnab('9', $this->getCodigoCliente(), 7));
294+
$this->add(66, 72, '0000000');
295295
$this->add(73, 102, Util::formatCnab('X', $this->getBeneficiario()->getNome(), 30));
296296
$this->add(103, 132, Util::formatCnab('X', 'CAIXA ECONOMICA FEDERAL', 30));
297297
$this->add(133, 142, '');
@@ -329,11 +329,15 @@ protected function headerLote()
329329
$this->add(17, 17, '');
330330
$this->add(18, 18, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? 2 : 1);
331331
$this->add(19, 33, Util::formatCnab('9', Util::onlyNumbers($this->getBeneficiario()->getDocumento()), 15));
332-
$this->add(34, 39, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 6));
333-
$this->add(40, 53, Util::formatCnab('9', 0, 14));
332+
$this->add(34, 40, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 7));
333+
$this->add(41, 53, Util::formatCnab('9', 0, 13));
334334
$this->add(54, 58, Util::formatCnab('9', $this->getAgencia(), 5));
335335
$this->add(59, 59, CalculoDV::cefAgencia($this->getAgencia()));
336-
$this->add(60, 65, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 6));
336+
if(strlen($this->getCodigoCliente()) == 7) {
337+
$this->add(60, 65, '000000');
338+
} else {
339+
$this->add(60, 65, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 6));
340+
}
337341
$this->add(66, 72, '0000000');
338342
$this->add(73, 73, '0');
339343
$this->add(74, 103, Util::formatCnab('X', $this->getBeneficiario()->getNome(), 30));

src/Cnab/Remessa/Cnab400/Banco/Bb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public function addBoleto(BoletoContract $boleto)
277277
$this->add(157, 158, $boleto->getStatus() == $boleto::STATUS_BAIXA ? self::INSTRUCAO_BAIXAR : self::INSTRUCAO_SEM);
278278
$this->add(159, 160, self::INSTRUCAO_SEM);
279279
$diasProtesto = '00';
280-
$const = sprintf('self::INSTRUCAO_PROTESTAR_VENC_%02s', $boleto->getDiasProtesto());
280+
$const = $boleto->getDiasProtesto() > 0 ? sprintf('self::INSTRUCAO_PROTESTAR_VENC_%02s', $boleto->getDiasProtesto()) : 'self::INSTRUCAO_NAO_PROTESTAR';
281281
if ($boleto->getStatus() != $boleto::STATUS_BAIXA) {
282282
if (defined($const)) {
283283
$this->add(157, 158, constant($const));

0 commit comments

Comments
 (0)