Home

Castle Stronghold

ValidateCreditCardAttribute API Document

Properties decorated with this attribute will be validated to ensure that they represent a valid credit card number. for more details.

Quick Note

Note that this merely check the validity of the format of the value, not whatever this it an existing and valid one

Example

//just validate that this is a credit card of any type [ValidateCreditCard("You didn't fill the credit card infomration correctly.")] //Validate that this is a VISA or Discover card [ValidateCreditCard(CreditCardValidator.CardType.VISA | CreditCardValidator.CardType.Discover, "You need to specify a VISA or Discover card")]

Constructors

ValidateCreditCardAttribute()

Initializes a new credit card validator.

ValidateCreditCardAttribute(String errorMessage)

Initializes a new credit card validator.

ParameterDescription
errorMessage Missing documentation

ValidateCreditCardAttribute(CardType allowedTypes)

Initializes a new credit card validator.

ParameterDescription
allowedTypes The card types to accept.

ValidateCreditCardAttribute(CardType allowedTypes, String errorMessage)

Initializes a new credit card validator.

ParameterDescription
allowedTypes The card types to accept.
errorMessage The error message to be displayed if the validation fails.

ValidateCreditCardAttribute(String[] exceptions)

Initializes a new credit card validator.

ParameterDescription
exceptions An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.

ValidateCreditCardAttribute(String[] exceptions, String errorMessage)

Initializes a new credit card validator.

ParameterDescription
exceptions An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.
errorMessage The error message to be displayed if the validation fails.

ValidateCreditCardAttribute(CardType allowedTypes, String[] exceptions)

Initializes a new credit card validator.

ParameterDescription
allowedTypes The card types to accept.
exceptions An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.

ValidateCreditCardAttribute(CardType allowedTypes, String[] exceptions, String errorMessage)

Initializes a new credit card validator.

ParameterDescription
allowedTypes The card types to accept.
exceptions An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.
errorMessage The error message to be displayed if the validation fails.

Properties

NameTypeDescription
ValidatorIValidator Gets the validator for this attribute. Each attribute that inherits from this class will have its own validtor.

Google
Search WWW Search castleproject.org