Closed quickquestion closed 9 years ago
We are talking about iban rule 5 (with it's three versions), correct? Have a look at https://github.com/infiniteam/avacodo/blob/master/avacodo-core/src/main/java/org/avacodo/conversion/iban/rules/Rule000500.xtend#L186 There the rule for a fixed BIC you are quoting is implemented and a local test indicates that it works.
Please verify that for the bank codes you are listing, iban rule 5 is actually used (in the "blz"-file you are using).
Thank you for your answer. Yes thats the rule. I used bank codes attached to the project (simplified_BLZ2.txt) and the following iban for testing: DE36200400000375555000 (i generated it here: ibancalculator.com/bic_und_iban.html using 20040000 bank code) this is the code i used:
LegacyAccount la= DeIban.accountFromIban(iban);
System.out.println("bank: " + la.getBankCode());
BankConfig tmp = configs.getBankConfig(la.getBankCode());
System.out.println("bic: " + tmp.getBic() +"-Rule:" +
tmp.getIbanRule()+"-Vs:" +
tmp.getIbanRuleVersion()+"-BLZ:" +
tmp.getSucceedingBlz()+ "--method:" + tmp.getAccountCheckMethod());
System.out.println("Result: " + AccountValidator.defImpl.checkAccountNumber(la.getAccount(),tmp.getAccountCheckMethod(), tmp.getSucceedingBlz() == null ? 0 : tmp.getSucceedingBlz() ));
and those are results: bank: 20040000 bic: COBADEHHXXX-Rule:5-Vs:3-BLZ:null--method:13 Result: true
I was wandering if it should not return COBADEFFXXX as a bic? Maybee i should validate in different way?
OK, I see the problem and this is why ticket #2 should have been addressed earlier (or example code should not be hidden too deeply in the tests).
You missed an important step. Reading the list of BankConfigs (variables configs in your code) is only step one and corresponds to obtaining a typed version of the bank config file. It does not apply the Iban calculation rules at all but provides the necessary data for determining which rule is to be applied.
RuleBasedIbanCalculator calculator=new RuleBasedIbanCalculator(configs);
IbanResult result=calculator.getIban(la);
String bic=result.getBic();
should get you on your way.
Note that some of the Iban rules explicitly state that account number validation should be suppressed. So, for validation you should also use the RuleBasedIbanCalculator and not the AccountValidator directly. An AccountValidationException will be thrown if validation fails.
Disclaimer: Validation and Iban rules are currently not maintained!
gr8 thank you
Please see chapter 5.5 at the document Übersicht der IBAN-Regeln: "For all sort codes of the Commerzbank AG (**4xx*) please use always BIC COBADEFFXXX But only for Commerzbank AG, for example not for ComDirect e.g. 20041144."
But when i tested iban for sortcode 10040000, 12040000, 20040000, 30040000 it looks like getBic() is returning original bic from the file not COBADEFFXXX Is it by design?