damoiser / qr-bills

Ruby Gem to generate QR-Bills for Swiss payments
BSD 3-Clause "New" or "Revised" License
21 stars 15 forks source link

Add QRBills.create_esr_reference #31

Open kalsan opened 10 months ago

kalsan commented 10 months ago

Hello and thank you for your much appreciated work on this gem! It's a true gem indeed.

While creditor references (RF...) are very easy to generate with QRBills.create_creditor_reference, I've had quite some struggle to generate valid references for bills that support QR style IBANs. As it seems that I've finally managed to generate valid references (with an ESR-style modulo-10 check-digit), I thought that it might be a good idea to contribute the solution back to qr-bills, as it is a feature that is yet missing, in my opinion.

This pull request adds QRBills.create_esr_reference to qr-bills. The solution is based on http://sahits.ch/blog/blog/2007/11/08/uberprufen-esr-referenz-nummer/. Feel free to change anything you like :-)

Best, Kalsan