Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Done
-
None
-
None
-
None
Description
It's tricky validating Credit card numbers using only regular expressions.
It would be a lot simpler to check the syntax (digits only) and length, and then validate the IIN (initial 6 digits) separately using numeric ranges.
No need even to convert the strings to numbers, because string comparison would work just as well.
Unfortunately CreditCardValidator uses the final class CodeValidator in its public API, but the latter can accept a RegexValidator which can be subclassed to provide the necessary functionality. This should be possible without further exposing the internal workings.
Attachments
Issue Links
- relates to
-
VALIDATOR-415 Simplify building new CreditCard validators
- Closed