Ticket generation in .NET

13

To this day I have 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 research how to do this in .NET. I researched a little and all I found was a library called Boleto.NET.

I looked at this library a bit, but I'm looking for alternatives. Firstly because I'm working with ASP.NET 5 and I have not yet been able to make this library work with Full CLR (at this point I think it's some minor error I've made). Secondly because looking at the GitHub page I did not quite understand the proposal. It seems that there is a site mixed with the library and another MVC application too, anyway, I do not quite understand if it's just a library or an application built to generate tickets.

In this way I kept searching about the subject but I did not find much and I decided to ask here.

  • How can I generate .NET tickets in a reasonably simple way within the application I'm developing?
  • If I do not want to use this library I found only by doing it manually? And in that case how is this done in .NET?
asked by anonymous 15.12.2015 / 19:42

2 answers

6

Almost a year after your question, I can say that Boleto.Net has evolved a lot.

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

The Boleto.Net is already suitable for this change and generates the delivery file.

I'm currently working with it. Even the mistakes I encountered, I reported to the project contributors. Because the project is open source , you can also make the change and send it to them.

The downside of it is having no documentation. I, for example, work with it and the bank documentation together to understand the fields.

The good thing is that it is evolving and it already has the following features:

  • Banking Issue and Printing
  • Layout Delivery File Generation
    • CNAB 240
    • CNAB 400
  • Layout Return File Reading
    • CNAB240
    • CNAB400
    • CBR643

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

    
27.09.2016 / 16:10
1

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

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

You can send some commands such as generating the ticket in PDF and deliver the PDF in the Browser and have other commands.In the installation folder comes a file. chm with available commands.

You can free download.

It is not one of the simpler alternatives, but this project has a lot of community collaboration, and I use it for NFe issue, as well as PDF generation for DANFe of the invoice, and this integration works well. >

It would be more or less 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);

link link link

    
09.05.2016 / 20:29