skwasjer / IbanNet

C# .NET IBAN validator, parser, builder and generator
Apache License 2.0
126 stars 31 forks source link

Jersey IBAN numbers are not accepted with unknown country #119

Closed eximiusdevelopment closed 1 year ago

eximiusdevelopment commented 1 year ago

When validating a Jersey IBAN number an error is return stating unknown or unsupported country.

Provide IBAN number JE68ABNA0350917C000978 and validate the number

The IBAN should be valid and the country code JE to be returned (as it is part of the included countries).

IbanNet 5.8.0 .NET 4.8 Windows 10

skwasjer commented 1 year ago

Is your example a confirmed existing IBAN? Because according to the sources I have used (including official SWIFT registry), Jersey is using GB country code.

The United Kingdom of Great Britain and Northern Ireland, the Isle of Man and the Bailiwicks of Guernsey and Jersey use this format.

I know there are some 'IBAN generators' out there that will produce an IBAN without caring about the country code, so just wanting to make sure.

I do not wish to add support for arbitrary country codes without proper supportive documentation and multiple examples.

eximiusdevelopment commented 1 year ago

Hi Martijn,

The example itself is not a real one, but for sure there are real IBAN bank account numbers starting with JE and IM, although GB for both are also valid for all 3 UK related countries. It depends where the bank has its origin.

Guernsey only has GB supported.

Check this document of HSBC where it is also listed. https://www.hsbc.com.au/content/dam/hsbc/au/docs/pdf/iban-bic.pdf

We received an issue from our UK customer who was testing the different IBAN numbers they have in their system.

Regards, Michael

skwasjer commented 1 year ago

I tried your example IBAN by modifying IbanNet locally to resolve JE to GB, but it does not match the pattern specification for GB (disregarding the country code for a moment here), due to presence of the character C at position 15 as the pattern dictates only digits there.

image

If this means that the pattern for JE is not the same as for GB, then it complicates the issue further as now I'd have to add a custom pattern specification. IbanNet tries to offer a strict validation mechanism, based on a trusted source (SWIFT registry). Adding support manually for JE with little evidence, would be breaking that promise.

Do you have a proposal on how you'd want this resolved? Because the problem I have is that many different sources say otherwise (including the official one). I do not want to discount any evidence you have in a real world application, but all (other) validators I checked online do not validate the example IBAN you provided either.

For the time being you could work around it by creating a custom IIbanRegistryProvider to add support for JE and IM yourself https://github.com/skwasjer/IbanNet/wiki/Options#other-registry-providers

eximiusdevelopment commented 1 year ago

Hi Martijn,

I appreciate that you took the time to investigate the example. I understand the issue yes, so the format doens't comply with the GB standard and there is nothing to be found that defines the JE 'format' specifications.

Leave it with me for the moment, I will get back to the customer and I will try to get more details. It is a weird issue in any case and if the more real examples don't check back I will work around it with the custom registry provider.

Regards, Michael

skwasjer commented 1 year ago

@eximiusdevelopment if you have further feedback, feel free to reopen, but closing for now due to issue being stale.