CVC validator doesn't work correctly, i.e. returns true for invalid (e.g. 1 digit only) CVC number, if there's no credit card type available yet. This may happen if someone tries to fill out CVC field, without filling out credit card number field yet, though I admit that it's probably very, very unlikely 😄. Combined with automatic focus of the next field, in this case ZIP code field, it automatically moves focus to this field after typing any digit.
I'm not sure if it handles all cases, but maybe it would be ok to assume that CVC is invalid, if it has less than 3 digits? Additionally, once credit card type is known, it could check if CVC should have 3 or 4 digits.
CVC validator doesn't work correctly, i.e. returns
true
for invalid (e.g. 1 digit only) CVC number, if there's no credit card type available yet. This may happen if someone tries to fill out CVC field, without filling out credit card number field yet, though I admit that it's probably very, very unlikely 😄. Combined with automatic focus of the next field, in this case ZIP code field, it automatically moves focus to this field after typing any digit.I'm not sure if it handles all cases, but maybe it would be ok to assume that CVC is invalid, if it has less than 3 digits? Additionally, once credit card type is known, it could check if CVC should have 3 or 4 digits.