After adding 16 new card brands, I’m finding the single file is getting slightly more complex than I’d like.
There’s only about 270 lines of code, but it’s difficult to come up with logical arrangement as many brands have multiple ranges in entirely different areas.
An approach I’m considering creating a set of cb_1
thru cb_9
submodules
and move the logic for each leading digit into the submodule.
Of course, this is not practicable without a proper Mix project, so that’s the next major step.
I’ll also be introducing tests at that point as I’m not comfortable I’ve not broken some earlier brands.
New Card Brands
China UnionPay, China T-Union, Diners Club, Diners Club International, JCB, Maestro, Maestro UK, Visa Electron, BORICA, Humo, InstaPayment, InterPayment, Mir, Napas, UATP, UzCard
Next Steps
Add guards to
card_brand
to check for String and Integer.Proper Mix project (including tests).
More brands.
Publish(?)
Yes, I changed SimpleCardBin to SimpleCardBrand, much better name.