National bank code
mfirry opened this issue · 6 comments
Hi is there anyway to add a functionality to discover the National bank code?
There's no support for that in the library at this time.
At face value, decoding the bank code should be fairly easy. However, doing so opens up the requirement for adding all the other country-specific features in the various IBANs. Most of these exist for a few countries but not for most others, where you'd have to return Optional
s (which don't exist in the Android runtime) or null
s (which are awful for all kinds of reasons) or throw exceptions (equally awful) and it all becomes complicated and messy.
I'm intentionally keeping the IBAN
class as simple as it now is.
I would accept a separate utility class with static methods that take an IBAN
and extract the requested data.
Thanks a lot for your answer. I'm actually using java-iban
inside my Scala projects so Option
s would be just great in my case. I'll try and find the time to develop that utility and let you know if I manage. Sounds like lots of different things to consider and many different cases. Thanks again
@mfirry I gave it a go and implemented the bank code / branch code extraction based on the SWIFT spec. I'm not entirely happy with the class naming, would love to hear if you have something better.
The reasoning is this:
- Helps discoverability if it sits next to
IBAN
in an IDE's autocompletion window. BankCodes
or something along those lines implies there never will be something else queryable through that class.- Can't be
Extras
because that's already something in Android.
Basically, I'm now going to update my test code. If the autocompletion in the various IDE's puts IBANExtras
before IBAN
I'll ditch the name and come up with something else.
I'm also quite ambivalent to IBAN
versus Iban
. Both are problematic in different ways, but that's a breaking change, so I get to just leave it be and not worry about it :).
I had considered IBANUtils
, but it's equally meh. IBANFields
it is.