php-barcode-generator icon indicating copy to clipboard operation
php-barcode-generator copied to clipboard

Added Febraban Type

Open devdiogenes opened this issue 2 years ago • 5 comments

"Boleto" is the one of the most used payment methods in Brazil.

Febraban is the type of barcode used in boletos. It's is basically a interleaved of 2:5, but the digits order is different, then I ajusted to generate barcode in that order.

boleto

devdiogenes avatar Aug 23 '22 19:08 devdiogenes

@diogenes-souza-dev Would love to add this. Please add some basic tests for this barcode type and I will merge it.

casperbakker avatar Aug 25 '22 18:08 casperbakker

Ok, I will do it soon

devdiogenes avatar Aug 25 '22 18:08 devdiogenes

A boleto has a code and a barcode. The barcode has a differente value of the code. Let's suppose that someone wants to develop a new document that contains the barcode of a boleto, typing only the code.

For this example, I generated a R$ 200,00 document.

That is the code: 07797.77705 11661.514114 78006.780429 1 92180000020000

That is the barcode: image And that is the value of barcode: 07791921800000200007777011661514117800678042

As you can see, the barcode value is very different of the code, It remove spaces, dots and some numbers, and changes the order of the numbers.

Then I will simulate that someone wants to generate this barcode, by only typing the code:

image

That is the result:

image

After trying to pay it using the barcode I generated, that was the result of the digital bank:

image

As you can see, I can pay sussessfully a boleto barcode that I generate only using the number of the boleto.

devdiogenes avatar Aug 26 '22 12:08 devdiogenes

I am sorry, but the code itself does not have unit tests for this type. Please add tests like the ones in https://github.com/picqer/php-barcode-generator/tree/main/tests, at least you need a verified file for this type so it will be automatically test. That way we know for sure that it will keep working in the future.

casperbakker avatar Feb 01 '24 08:02 casperbakker

Ok of course, I'll try to contribute to this PR then and add the unit tests when I get a little time

epcgrs avatar Feb 01 '24 11:02 epcgrs