codebude / QRCoder

A pure C# Open Source QR Code implementation
MIT License
4.59k stars 1.09k forks source link

SwissQrCode checks for CH/LI IBAN #198

Closed mazocode closed 5 years ago

mazocode commented 5 years ago

Type of issue

[ ] Bug
[X] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

Valid IBAN accepted

Current Behavior

if (!iban.StartsWith("CH") && !iban.StartsWith("LI")) throw new SwissQrCodeIbanException("The IBAN must start with \"CH\" or \"LI\".");

Possible Solution (optional)

Is this part of the specs? If no, why is this code in here?

Steps to Reproduce (for bugs)

Your Environment

codebude commented 5 years ago

Hi @coboluxx ,

page 25, description of the field QRCH+CdtrInf++IBAN, from the official specs reads like:

Fixed length: 21 alphanumeric characters, only IBANs with CH or LI country code permitted

That's why this check was implemented.

mazocode commented 5 years ago

Okay, thanks! Probably I haven't understood the meaning of this code yet. I read on again ;-)

codebude commented 5 years ago

From my understanding (and as German I'm also not 100% firm with the Swiss law) the code has to be printed on every invoice a Swiss company prints. I assume that each Swiss company has to have an Swiss or Liechtenstein bank account and thus only CH or LI codes have to be printed on to the invoices.

mazocode commented 5 years ago

That's why I thought (as German ;) it probably has a wide adoption within Switzerland and would be useful for paying invoices received from other countries too. But it looks like this is useful within Switzerland only.