C# Class Castle.Components.Validator.CreditCardValidator

Inheritance: AbstractValidator
Datei anzeigen Open project: nats/castle-1.0.3-mono Class Usage Examples

Public Methods

Method Description
ApplyBrowserValidation ( BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target ) : void

Applies the browser validation by setting up one or more input rules on IBrowserValidationGenerator.

CreditCardValidator ( ) : System

Initializes a new credit card validator.

CreditCardValidator ( CardType allowedTypes ) : System

Initializes a new credit card validator.

CreditCardValidator ( CardType allowedTypes, string exceptions ) : System

Initializes a new credit card validator.

CreditCardValidator ( string exceptions ) : System

Initializes a new credit card validator.

IsValid ( object instance, object fieldValue ) : bool

Validate that the propety value matches a valid (formatted) credit card Note: null values are consider OK always.

Private Methods

Method Description
IsLuhnValid ( string cardNumber ) : bool
IsValidCardType ( string cardNumber ) : bool

Method Details

ApplyBrowserValidation() public method

Applies the browser validation by setting up one or more input rules on IBrowserValidationGenerator.
public ApplyBrowserValidation ( BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target ) : void
config BrowserValidationConfiguration The config.
inputType InputElementType Type of the input.
generator IBrowserValidationGenerator The generator.
attributes IDictionary The attributes.
target string The target.
return void

CreditCardValidator() public method

Initializes a new credit card validator.
public CreditCardValidator ( ) : System
return System

CreditCardValidator() public method

Initializes a new credit card validator.
public CreditCardValidator ( CardType allowedTypes ) : System
allowedTypes CardType The card types to accept.
return System

CreditCardValidator() public method

Initializes a new credit card validator.
public CreditCardValidator ( CardType allowedTypes, string exceptions ) : System
allowedTypes CardType The card types to accept.
exceptions string An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.
return System

CreditCardValidator() public method

Initializes a new credit card validator.
public CreditCardValidator ( string exceptions ) : System
exceptions string An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.
return System

IsValid() public method

Validate that the propety value matches a valid (formatted) credit card Note: null values are consider OK always.
public IsValid ( object instance, object fieldValue ) : bool
instance object
fieldValue object
return bool