iban4j icon indicating copy to clipboard operation
iban4j copied to clipboard

CountryCode.Ru

Open kamyshev1993-admin opened this issue 3 years ago • 4 comments

Hello. I have some problems with generate ru iban.

Iban.random(CountryCode.RU);

org.iban4j.UnsupportedCountryException: Country code is not supported.

	at org.iban4j.Iban$Builder.fillMissingFieldsRandomly(Iban.java:464)
	at org.iban4j.Iban$Builder.buildRandom(Iban.java:385)
	at org.iban4j.Iban.random(Iban.java:201)
	at TestTestasd.testMethod(TestTestasd.java:47)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804)
	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.testng.TestRunner.privateRun(TestRunner.java:770)
	at org.testng.TestRunner.run(TestRunner.java:591)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:402)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355)
	at org.testng.SuiteRunner.run(SuiteRunner.java:304)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1102)
	at org.testng.TestNG.runSuites(TestNG.java:1032)
	at org.testng.TestNG.run(TestNG.java:1000)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)

Could you add it in structures EnumMap please?)

kamyshev1993-admin avatar Sep 21 '21 09:09 kamyshev1993-admin

ContryCode doesnt have RUS value, just RU. RU("Russian Federation", "RUS"), it is from CountryCode enum.

kamyshev1993-admin avatar Sep 21 '21 09:09 kamyshev1993-admin

Oh Yes, I see, It's missing in BbanStructure.

FrankHossfeld avatar Sep 21 '21 09:09 FrankHossfeld

I think, it is because Russia is not in the list of countries using the IBAN standard.

See: https://bank-code.net/iban/country-list?cf_chl_captcha_tk=pmd_m0hQcnz.9rcCcCXAIz3L5.R6VMXd4kEQL2eNg.ECVBQ-1632218069-0-gqNtZGzNAvujcnBszQil

FrankHossfeld avatar Sep 21 '21 09:09 FrankHossfeld

Oh yes, i see. Thank you for help)

kamyshev1993-admin avatar Sep 21 '21 10:09 kamyshev1993-admin

RU has been added to the IBAN structure - see https://www.swift.com/standards/data-standards/iban-international-bank-account-number An option could be to generate the supported countries from the SWIFT source as it is authoritative. That would also solve issues like all supported territories and the info if they are part of the SEPA area. We even have samples to generate the unit tests. What is missing though is the check digit into the BBAN (that should be stored separately) To support new countries we would just need to update the SWIFT file and regenerate - other option is to parse the file at startup, so that would allow easier maintenance and flexibility if some wants to update the structure (either because new release of the library is lagging behind or to add "experimental countries" as per https://www.iban.com/structure or the bottom of the wikipedia page: https://en.wikipedia.org/wiki/International_Bank_Account_Number ).

tdltdl avatar Feb 14 '23 00:02 tdltdl