Table of contents
- 1 Example
- 2 Constructors
- 2.1 ValidateCreditCardAttribute()
- 2.2 ValidateCreditCardAttribute(String errorMessage)
- 2.3 ValidateCreditCardAttribute(CardType allowedTypes)
- 2.4 ValidateCreditCardAttribute(CardType allowedTypes, String errorMessage)
- 2.5 ValidateCreditCardAttribute(String[] exceptions)
- 2.6 ValidateCreditCardAttribute(String[] exceptions, String errorMessage)
- 2.7 ValidateCreditCardAttribute(CardType allowedTypes, String[] exceptions)
- 2.8 ValidateCreditCardAttribute(CardType allowedTypes, String[] exceptions, String errorMessage)
- 3 Properties
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.
| Parameter | Description |
|---|---|
| errorMessage | Missing documentation |
ValidateCreditCardAttribute(CardType allowedTypes)
Initializes a new credit card validator.
| Parameter | Description |
|---|---|
| allowedTypes | The card types to accept. |
ValidateCreditCardAttribute(CardType allowedTypes, String errorMessage)
Initializes a new credit card validator.
| Parameter | Description |
|---|---|
| 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.
| Parameter | Description |
|---|---|
| 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.
| Parameter | Description |
|---|---|
| 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.
| Parameter | Description |
|---|---|
| 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.
| Parameter | Description |
|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| Validator | IValidator | Gets the validator for this attribute. Each attribute that inherits from this class will have its own validtor. |