private bool CreditCardValidatorTest(string input, CreditCardValidator.CardType allowedTypes, string[] exceptions)
        {
            CreditCardValidator validator = new CreditCardValidator(allowedTypes, exceptions);

            return(validator.IsValid(this, input));
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new credit card validator.
 /// </summary>
 /// <param name="allowedTypes">The card types to accept.</param>
 /// <param name="errorMessage">The error message to be displayed if the validation fails.</param>
 public ValidateCreditCardAttribute(CreditCardValidator.CardType allowedTypes, String errorMessage)
     : base(errorMessage)
 {
     validator = new CreditCardValidator(allowedTypes);
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new credit card validator.
 /// </summary>
 /// <param name="allowedTypes">The card types to accept.</param>
 /// <param name="exceptions">An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.</param>
 public ValidateCreditCardAttribute(CreditCardValidator.CardType allowedTypes, string[] exceptions)
 {
     validator = new CreditCardValidator(allowedTypes, exceptions);
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new credit card validator.
 /// </summary>
 /// <param name="allowedTypes">The card types to accept.</param>
 public ValidateCreditCardAttribute(CreditCardValidator.CardType allowedTypes)
 {
     validator = new CreditCardValidator(allowedTypes);
 }