globalcitizen / php-iban

Generate, parse, validate, error-correct and present IBAN (and IIBAN) bank account information in PHP.
GNU Lesser General Public License v3.0
474 stars 110 forks source link

support for country specific check digit #46

Closed dem3trio closed 8 years ago

dem3trio commented 8 years ago

Hello, I'm glad to see that the library is receiving support again.

I don't know if within the new features (or the future ones) is included a new function/method to get the country specific check digit.

In the case of Spain:

The format of the iban is: ESkk bbbb gggg xxcc cccc cccc

where: k = IBAN control digit b = National bank code g = Branch code x = Check digits c = Account number

More here: https://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country

globalcitizen commented 8 years ago

Hi there. Certainly, anything is possible, however I am afraid that there is no such standard concept as a national-level checksum digit or digits within the IBAN format itself, and I am currently under the impression that such a checksum is actually a national BBAN component for a small number of countries only.

I would love to add support for grabbing this, but we need more information than one country to make an informed design. I mean, who knows, some countries might have two BBAN-based checksums! Unfortunately it seems Wikipedia is not really a valid source for this stuff, it's as good as hearsay until there's an official document, but it's a good starting point.

Since the implementation will therefore probably follow a "country-specific validation" path once documents are dug up, I feel like #40 is perhaps a better description of the same issue and this issue is almost a duplicate.

May I ask why you want the BBAN check digits?

May I ask if you have the algorithm for the checksum?

May I ask if you would like to volunteer to do country-specific research on additional countries with BBANs that incorporate national checksum systems?

There may also be similar checksum systems at the bank level in some countries...

globalcitizen commented 8 years ago

Actually #39 is closest.

globalcitizen commented 8 years ago

Searching the Wikipedia country-specific data, it is really untrustworthy. For example look at Bosnia and Herzegovina, it says the IBAN checksum is "always 39". What? This is just garbage. We need real references.

I believe your data on Spain, but I would prefer to have some additional countries official data before starting out. Therefore I am going to close this issue as duplicate and use #39 to request country info, please feel free to post country-specific info there, and when we have 3 or more I will be happy to add the feature.