Billet generation in . NET

Asked

Viewed 2,969 times

14

Until today I often imagined situations in which a system might need to generate boletos, although until now I have never developed anything like this, and so I decided to search how to do it in .NET. I researched a little and all I found was a library called Boleto.NET.

I’ve been going through this library a little bit, but I’m looking for alternatives. First because I’m working with ASP.NET 5 and I haven’t been able to make this library work even with Full CLR (at this point I think it’s some minor mistake I made). Secondly, because looking at the Github page I didn’t understand the proposal very well. It seems that has a site mixed with the library and another MVC application also, Anyway, I did not understand very well if it is just a library or an application built to generate boletos.

That way I continued researching on the subject but I did not find much and decided to ask here.

  • How can I generate billets in . NET in a fairly simple way within the application I am developing?
  • If I don’t want to use this library I found just doing manually? And in this case how is it done in . NET?
  • 2

    I think the question is very broad. This library is half-baked, but it is what you have ready. You can take the idea there, or look at other implementations in different languages and try to port. Although most who have available is well half-hearted as well. They do not solve certain issues well and adopt unnecessary complications for most.

  • 5

    I don’t find this simple problem. Boleto.NET is very poorly structured and would need some rework to be good. As ASP.NET 5 is not yet stable, I don’t know if it’s worth going to now.

  • Do you really need this implemented within the application? He studied the possibility of using a service for generating, managing and notifying billets such as cobregratis.com.br?

  • If you have an sql server with report service, I believe it is the best alternative to use the report service. Create the boleto there in the SRSS and make the boleto call by . net passing the parameters.

2 answers

6

Almost a year after your question, I can say that the Boleto.Net has come a long way.

The ticket without registration as we know it will cease to exist at the end of 2016. If your company works with this sport, it is good to be aware of what is happening and prepare for change. That is, now all billets will be registered and companies will have to generate a shipping file and send it to the bank.

To Boleto.Net is already being suitable for this change and generates the shipment file.

I am currently working with her. Including the errors I found, I reported to the project contributors. How the project is open source, you can also make the change and send to them.

Her downside is not having documentation. I, for example, work with her and the bank documentation together to understand the fields.

The positive point is that it is evolving and currently has the following functionalities:

  • Issuance and Printing of Bank Slips
  • Generation of Shipment File of layouts
    • CNAB 240
    • CNAB 400
  • Reading the Return File of the layouts
    • CNAB240
    • CNAB400
    • CBR643

You can check the list of banks implemented and of homologated and other information on github.

1

As stated in the comments, there is no simple way to do this.

If you have full control of the server, to install a software on it I suggest you make an integration with the software Acbrmonitorplus. With this software you can send commands via TCP-IP using the Socket(System.Net.Sockets class).

You can send some commands like generate the boleto in PDF and deliver the PDF in the Browser and have other commands. In the installation folder comes a file . chm with the available commands.

You can download for free.

It is not one of the simplest alternatives, but this project has a lot of community collaboration, and I use it to issue Nfe, as well as PDF generation for the Danfe invoice, and it works well this integration.

It would look something like this

  IPAddress ipAddress = IPAddress.Parse("127.0.0.1"); //IP local(do servidor)
  IPEndPoint remoteEP = new IPEndPoint(ipAddress, intPorta);
  Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
  socket.Connect(remoteEP);  
  byte[] bytes = new byte[2097152];
  byte[] msg = Encoding.GetEncoding(strEncoding).GetBytes("BOLETO.GerarPDF" + Environment.NewLine + "." + Environment.NewLine);
  int bytesSent = socket.Send(msg);
  int bytesRec = socket.Receive(bytes);
  string strMensagemRetorno = Encoding.GetEncoding(strEncoding).GetString(bytes, 0, bytesRec);

https://msdn.microsoft.com/pt-br/library/system.net.sockets(v=vs.110). aspx http://www.projetoacbr.com.br/forum/forum/54-acbrmonitor-plus/ http://www.projetoacbr.com.br/forum/files/file/372-acbrmonitorplus/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.