mdomke / schwifty

IBAN parsing and validation
https://schwifty.readthedocs.io
MIT License
205 stars 78 forks source link

Commerzbank's usage of differenz BICs #188

Open rtwruck opened 5 months ago

rtwruck commented 5 months ago

Hi,

Commerzbank, like many german banks, uses regional BICs. For example: BLZ 20040000 -> COBADEHHXXX Commerzbank Hamburg BLZ 30040000 -> COBADEDDXXX Commerzbank Düsseldorf This data is also present in schwifty and matches the Bundesbank database.

Unfortunately though, Commerzbank decided to use COBADEFFXXX for all SEPA transactions regardless of which BLZ is encoded in the IBAN. So if you receive a payment, the account statement will have IBAN DExx 2004 0000 .... with BIC COBADEFFXXX and the same combination should be used when transfering money (see https://www.commerzbank.de/service/wo-finde-ich-meinen-bic-meine-blz-bankleitzahl/).

Currently, this will not pass schwifty's validation, i.e. the example IBAN's BIC will obviously be COBADEHHXXX and BIC.candidates_from_bank_code('DE', '20040000') will only return that one, too.

Are there any plans to support this?

mdomke commented 5 months ago

I think I'm not entirely sure what you're suggesting to implement. On which basis should the bank code 2004 000 be mapped to COBADEFFXXX instead of COBADEHHXXX? Do you want to map all Coba BLZs to the same BIC?

Natim commented 5 months ago

@rtwruck you can add multiple combinaison of valid BIC for the same bank code. We did it in France for BNP which has a similar complexity.

It will work for validation, however when trying to get the BIC from the IBAN it can either give you the list or the most plausible option.

In anycase, both BIC would work if you try to wire money to it.

mdomke commented 5 months ago

@Natim In my understanding the situation is the other way around in this case. There are multiple domestic bank codes which map all to the same BIC, but only for transfers, right @rtwruck ?

Natim commented 5 months ago

Yes it goes both ways, multiple bank codes can share the same BIC and multiple BIC can be linked to the same bank code

rtwruck commented 5 months ago

Hi, thanks for looking into this. Yes, it's for transfers only. There are two things that come to my mind: 1) COBADEFFXXX could be returned as a secondary entry from BIC.candidates_from_bank_code('DE', '20040000') 2) BIC('COBADEFFXXX').domestic_bank_codes could conversely return all the regional bank codes.

I'm not so sure whether 2) is a good idea but OTOH the current list of domestic bank codes is already 285 entries long. I'm fine with IBAN().bic returning COBADEHHXXX since that seems to be the official assignment.