-
Notifications
You must be signed in to change notification settings - Fork 15
Add QRBills.create_esr_reference #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
better later than never :-) sorry for the delay answering here and thanks a lot for your contribution. Just a question, is ESR reference still compliant to QR bills? Reading quickly the six page I found that ESR got decommissioned in favor of the QR Bill IBAN
I just try to be more compliant as possible with the standards of QR Bills. |
Hi @damoiser TLDR: when generating a QR bill with a reference number, one doesn't get to choose whether the number should be QR-style or ESR-style; it is dictated by the IBAN the money will flow to. This pull request ensures backwards compatibility. While ESR should have disappeared, there are still many ESR-style IBANs around, forcing us to keep using the feature. A few years ago, banks sent us new IBAN numbers and asked us to use them, but claimed that the old ones were still valid. I guess that might be why some billers still have old IBAN numbers in ESR style. So while in theory, ESR style should be deprecated, it is still needed if the invoicing party sends the old style IBAN. This is how to find out whether an IBAN can be used with proper QR or needs the backwards compatibility: def qr_iban?
return false if iban.blank? # arbitrary safeguard
iban_institute_identifier = iban.strip.gsub(' ', '')[4..8].to_i
return iban_institute_identifier.between?(30_000, 31_999)
end
I totally understand your concern. Perhaps adding a note to the documentation mentioning that ESR is outdated and should only be used if the IBAN dictates it would be a solution? Best, |
Hi @kalsan - thanks for the info, I slightly adjusted, bumped the ruby version and added some tests. Please check if is ok for you as well, after that. Will then merge it and publish the new version. Thanks again for contributing! |
@damoiser looks great, thank you very much! Given our discussion, I'm wondering whether it would be a good idea to further include the method |
Hi @kalsan - yes sure! feel free to commit as well the Thanks! |
…ve documentation.
@damoiser I've added an appropriate method and performed some slight refactoring for better consistency. Further, I've added a line to the README hinting to the comment explaining the differences. |
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
toqr-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