Hey Dave.... is there a chance we can get this added into the code for credit card validation? If CreditCard is chosen for payment type, pass the CC# through this for validation....
private static bool IsValidNumber(string number)
{
int[] DELTAS = new int[] { 0, 1, 2, 3, 4, -4, -3, -2, -1, 0 };
int checksum = 0;
char[] chars = number.ToCharArray();
for (int i = chars.Length - 1; i > -1; i--)
{
int j = ((int)chars[i]) - 48;
checksum += j;
if (((i - chars.Length) % 2) == 0)
checksum += DELTAS[j];
}
return ((checksum % 10) == 0);
}
.... additionally, is there a quick and simple way to validate the MMYY to make sure that it is not in the past? These two things would have to be done with code-behind, because the usage of the text fields dynamically changes for the payment type... so, it's a Credit Card Number when Credit Card is selected, but a PO Number when Purchase Order is checked, so I can't do any of this as a regex, javascript, etc. It would have to be done conditionally as code-behind.