CreditCardName (creditCardNumber)

You can determin the type of credit card but looking at the number. This function does not cover all the cards on the market but it does account for the most popular ones. The first thing it does is to make sure the number has been entered correctly. To do this it uses the three Luhn function which you will find in the list of custom functions. Therefore you must either enter the Luhn functions first or comment out the line that says "valid = Luhn (justNumbers)"

CreditCardName (creditCardNumber)

/*

This is a Custom Function implementation of Brian Dunning's Card Validator

It requires that the 3 Luhn functions are available in the file.

*/

Let ( [

justNumbers = Filter( CreditCardNumber ; "0123456789" ) ; // remove any non-numeric characters

valid = Luhn ( justNumbers ) ] ; // end let variable definition

// begin calculation

If ( valid and Length( justNumbers ) >= 15 and Length( justNumbers ) <= 16 ;

Case(

GetAsNumber(Left(justNumbers;6)) >= 413733 and GetAsNumber(Left(justNumbers;6)) <= 413737; "Visa Debit / Delta";

Left(justNumbers;4) = "4462"; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 453978 and GetAsNumber(Left(justNumbers;6)) <= 453979; "Visa Debit / Delta";

Left(justNumbers;6) = "454313"; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 454432 and GetAsNumber(Left(justNumbers;6)) <= 454435; "Visa Debit / Delta";

Left(justNumbers;6) = "454742"; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 456725 and GetAsNumber(Left(justNumbers;6)) <= 456745; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 465830 and GetAsNumber(Left(justNumbers;6)) <= 465879; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 465901 and GetAsNumber(Left(justNumbers;6)) <= 465950; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 484409 and GetAsNumber(Left(justNumbers;6)) <= 484410; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 490960 and GetAsNumber(Left(justNumbers;6)) <= 490979; "Visa Debit / Delta";

GetAsNumber(Left(justNumbers;6)) >= 492181 and GetAsNumber(Left(justNumbers;6)) <= 492182; "Visa Debit / Delta";

Left(justNumbers;6) = "498824"; "Visa Debit / Delta";

Left(justNumbers;6) = "450875"; "Visa Electron";

GetAsNumber(Left(justNumbers;6)) >= 484406 and GetAsNumber(Left(justNumbers;6)) <= 484408; "Visa Electron";

GetAsNumber(Left(justNumbers;6)) >= 484411 and GetAsNumber(Left(justNumbers;6)) <= 484455; "Visa Electron";

GetAsNumber(Left(justNumbers;6)) >= 491730 and GetAsNumber(Left(justNumbers;6)) <= 491759; "Visa Electron";

Left(justNumbers;6) = "491880"; "Visa Electron";

GetAsNumber(Left(justNumbers;6)) >= 405501 and GetAsNumber(Left(justNumbers;6)) <= 405504; "Visa Purchasing";

GetAsNumber(Left(justNumbers;6)) >= 405550 and GetAsNumber(Left(justNumbers;6)) <= 405554; "Visa Purchasing";

Left(justNumbers;6) = "415928"; "Visa Purchasing";

GetAsNumber(Left(justNumbers;6)) >= 424604 and GetAsNumber(Left(justNumbers;6)) <= 424605; "Visa Purchasing";

Left(justNumbers;6) = "427533"; "Visa Purchasing";

Left(justNumbers;4) = "4288"; "Visa Purchasing";

Left(justNumbers;6) = "443085"; "Visa Purchasing";

GetAsNumber(Left(justNumbers;4)) >= 4484 and GetAsNumber(Left(justNumbers;4)) <= 4486; "Visa Purchasing";

Left(justNumbers;4) = "4715"; "Visa Purchasing";

Left(justNumbers;4) = "4716"; "Visa Purchasing";

Left(justNumbers;4) = "4804"; "Visa Purchasing";

GetAsNumber(Left(justNumbers;6)) >= 490302 and GetAsNumber(Left(justNumbers;6)) <= 490309; "Switch";

GetAsNumber(Left(justNumbers;6)) >= 490335 and GetAsNumber(Left(justNumbers;6)) <= 490339; "Switch";

GetAsNumber(Left(justNumbers;6)) >= 491101 and GetAsNumber(Left(justNumbers;6)) <= 491102; "Switch";

GetAsNumber(Left(justNumbers;6)) >= 491174 and GetAsNumber(Left(justNumbers;6)) <= 491182; "Switch";

Left(justNumbers;4) = "4936"; "Switch";

Left(justNumbers;6) = "564182"; "Switch";

GetAsNumber(Left(justNumbers;6)) >= 633300 and GetAsNumber(Left(justNumbers;6)) <= 633349; "Switch";

Left(justNumbers;4) = "6759"; "Switch";

GetAsNumber(Left(justNumbers;6)) >= 633450 and GetAsNumber(Left(justNumbers;6)) <= 633499; "Solo";

Left(justNumbers;4) = "6767"; "Solo";

Left(justNumbers;2) ="50"; "Maestro";

GetAsNumber(Left(justNumbers;2)) >= 56 and GetAsNumber(Left(justNumbers;2)) <= 58; "Maestro";

Left(justNumbers;1) ="6"; "Maestro";

GetAsNumber(Left(justNumbers;2)) >= 51 and GetAsNumber(Left(justNumbers;2)) <= 55; "MasterCard";

Left(justNumbers;2) ="34"; "American Express";

Left(justNumbers;2) ="37"; "American Express";

GetAsNumber(Left(justNumbers;3)) >= 300 and GetAsNumber(Left(justNumbers;3)) <= 305; "Diners Club";

Left(justNumbers;2) ="36"; "Diners Club";

Left(justNumbers;2) ="38"; "Diners Club";

Left(justNumbers;1) ="3"; "JCB";

Left(justNumbers;4) ="2131"; "JCB";

Left(justNumbers;4) ="1800"; "JCB";

Left(justNumbers;1) ="4"; "Visa";

Left(justNumbers;4) ="6011"; "Discover";

"?" // unknown card

) // end case

; "Invalid Card Number" ) // end if

) // end let

Contact Us | Privacy | Policies

Copyright © 2006 DataIsland Software LLC. All rights reserved.

Notice: Product specifications and availability are subject to change without notice.