Alterplay / APValidators

Codeless solution for form validation in iOS!
https://cocoapods.org/pods/APValidators
MIT License
131 stars 18 forks source link

amex cvn (cvv) = 4 digits #9

Open rjpalermo1 opened 7 years ago

rjpalermo1 commented 7 years ago

Hi excited to try your control.

As I was evaluating noticed the CVV validation was limited to 3 chars and amex cards carry 4 chars. Sure I can adjust the 3 to 4 in regex but in order to keep user input errors to minimum is this something I can do with a compound object? I'm not sure, I'll dig in deeper but in meantime if you get this before i come up with answer what is your recommendation? Is there a flag or something I can evaluate to adjust the field object for the cc number? ie, isAmex (then I can set set CVV validator to 4)

NickolaySheika commented 7 years ago

Hi,

Please take a look at example. CVV validation is made there by APRegexValidator with ^[0-9]{3}$ regex. Regex to support 4 digits will be - ^[0-9]{4}$ . But maybe you would need to adjust this regex every time user changes CC number and you get CC type from APCreditCardValidator.