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

fix: amount formatting and error correction code (#17) #18

Closed solaris007 closed 2 years ago

solaris007 commented 2 years ago
damoiser commented 2 years ago

Hi @solaris007 , thanks for the PR will check and let you know

damoiser commented 2 years ago

Thanks again for the fix @solaris007 - I took the occasion to improve the tests based on your round amount fix and pushed to your PRs (yes...3 commits only to some extra tests, probably I am a bit tired tonight ;-))

The PR looks good for me and the only open point is the one in the comment: if you have read some requirements about minimal code restore for qr-codes in qr-bills we can leave as "m" (15%), please share the resource because I am curious. Otherwise I would like to be on the caution side and leave it as default (h=30%)

solaris007 commented 2 years ago

@damoiser thank you for improving the PR :) The patch is a direct consequence of the financial institution of my client (a Cantonal Bank) providing feedback after I sent them a test-bill for verification. Their validator admonished the number formatting as well as the error correction code.

The M is part of the Swiss QR spec: https://docs.qr-invoice.ch/latest/reference/requirements-fulfillment.html (search for "error").

See attached image for the bank's validator output. Not sure which validator they used, might be this one: https://validation.iso-payments.ch/gp/qrrechnung/account/logon

unnamed

damoiser commented 2 years ago

thanks for the details @solaris007 ! I will then merge your PR and publish a new version

damoiser commented 2 years ago

pushed new version to rubygems repository https://rubygems.org/gems/qr-bills/versions/1.0.5

happy coding :-)