Boleto.Net Component Generating Wrong Code

0

I'm working with the boleto.net library, I'm generating boletins from the brazilian bank and the following problem is occurring.

I am generating the right ticket but the ticket bar code is coming with the end, where would be the wrong ticket area + VALUE TICKET area.

Below code returned from property BoletoBancario.Boleto.CodigoBarra.Codigo 00196.88472 32677.473001 00000.085183 1 550000000002

Below code returned from the BoletoBancario.Boleto.CodigoBarra.LinhaDigitavelFormatada property 00190.00009 02688.473269 77473.0000000085187 1 67830000055000

If you analyze the above codes, if we take the final stretch ( 550000000002 ) of the first and insert the end of the second code ( 67830000055000 ), the ticket is generated correctly. / p>

string convenio = "2677473";

var contaBancaria = new ContaBancaria()
                {
                    Agencia = "4175",
                    DigitoAgencia = "2",
                    Conta = "6141",
                    DigitoConta = "5",
                    OperacaConta = "019"
                };

var cedente = new Cedente()
                {
                    Codigo = convenio, //ced.ID.ToString().PadLeft(7, '0'),
                    //Convenio = Convert.ToInt32(convenio),
                    CPFCNPJ = ced.CPF_CNPJ,
                    Nome = ced.RAZAO_SOCIAL.ToUpper(),
                    ContaBancaria = contaBancaria                  
                };

var sacado = new Sacado()
                {
                    CPFCNPJ = "",
                    Nome = "",
                    Endereco = new Endereco()
                    {
                        End = "",
                        Bairro = "",
                        Cidade = "",
                        UF = "",
                        CEP = ""
                    }
                };

var boleto = new Boleto()
                {                
                    ContaBancaria = contaBancaria,
                    DataVencimento = "2016-05-03",
                    ValorBoleto = "550.00",
                    NossoNumero = "26774730000000085",
                    NumeroDocumento = "0000000085",
                    Carteira = "18",
                    Cedente = cedente,
                    Sacado = sacado,
                    EspecieDocumento = new EspecieDocumento_BancoBrasil("4"),                    
                    LocalPagamento = "QUALQUER BANCO",
                    Instrucoes = new List<IInstrucao>() { new Instrucao_BancoBrasil() { Descricao = "" } },
                };

var boleto_bancario = new BoletoBancario()
                {
                    CodigoBanco = 001,
                    Boleto = boleto,
                    MostrarCodigoCarteira = false,
                    MostrarComprovanteEntrega = false
                };

boleto_bancario.Boleto.Valida();

boleto_bancario.MontaHtmlEmbedded();

Is this the data that is filled in, something wrong or missing?

    
asked by anonymous 04.05.2016 / 23:36

1 answer

1

I was looking here for the source code of the barcode ...

link

Apparently the free course is misinformed.

When you request the formatted line, it calculates without the free field. That's why it works. When you only ask for the Codigo property, it formats the string with the free field at the end.

Tip: Running with the most current BoletoNet source may be an already resolved bug. If you are sure that your code is all correct, put together a minimal case and open an issue .

    
05.05.2016 / 01:19