Credit card validation and parsing utilities for .Net Compact framework 3.5
I have payment gateway integration in my application developed using .Net Compact framework 3.5.
Is there any "Credit card validation and parsing utilities" that i can use in my application or is there any class that i can use to id开发者_运维百科entify the type of the card?
Google for Lunn or Luhn validation. This will simply validate that the cc number is a valid sequence, but you will need to obviously validate that against the provider.
The same links may provide you with the prefixes used by several card companies.
Try Subsonic.Sugar .. then you could do somethign like this
protected void ValidateCardServerValidate(object source, ServerValidateEventArgs args)
{ bool cardValidate; string item = ddlCardType.SelectedItem.Text.ToUpper();
if (item == "MASTERCARD")
cardValidate = SubSonic.Sugar.Validation.IsCreditCardMasterCard(args.Value);
else if (item == "VISA")
cardValidate = SubSonic.Sugar.Validation.IsCreditCardVisa(args.Value);
else if (item == "ACME")
cardValidate = SubSonic.Sugar.Validation.IsCreditCardDinersClub(args.Value);
else if (item == "DINERS")
cardValidate = SubSonic.Sugar.Validation.IsCreditCardAmericanExpress(args.Value);
else
cardValidate = SubSonic.Sugar.Validation.IsCreditCardAny(args.Value);
args.IsValid = cardValidate;
}
精彩评论