credit_card_validator library

Classes

CCNumValidationResults
CreditCardValidator
CreditCardValidator helps with validating credit card numbers, expiration dates, and security codes. It is meant to validate the credit card as the user is typing in the card information This class is meant to be used as a mixin and is not inheritable For example: class CreditCardValidationBloc extends Object with CreditCardValidator Will allow access to the functions mentioned below Exposes 3 public functions which can be used to validate different parts of the credit card 1) Card number - validated based on type of card, luhn validity & card number length 2) Expiration Date - validated based on the date being a valid string & not expiring more than 'n' years in the future. 'n' defaults to 19 years. 3) Security code (CVV) - validates based on the length of the code in conjunction with the type of card
ValidationResults
A class that contains the results from the validation process Each of the parts of the credit card are either 'valid' or 'potentially valid' [...]

Constants

ALT_SECURITY_CODE_LENGTH → const int
The alternate length of the security code (only American Express cards use this) Set to 4
4
DEFAULT_MAX_CARD_NUM_LENGTH → const int
The default card number length. Set to 19
19
DEFAULT_NUM_YEARS_IN_FUTURE → const int
The default number of years into the future a card is valid. Set to 19 i.e. if the current year is 2019 then a valid card would not have an expiration date greater than 2038
19
DEFAULT_SECURITY_CODE_LENGTH → const int
The default length of the CVV or security code (most cards do this) Set to 3
3