public static String getCardType ( String ccPassed ) { if ( isEmpty ( ccPassed ) ) return "Unknown" ; String cc = stripCharsInBag ( ccPassed , creditCardDelimiters ) ; if ( ! isCreditCard ( cc ) ) return "Unknown" ; if ( isMasterCard ( cc ) ) return "MasterCard" ; if ( isVisa ( cc ) ) return "Visa" ; if ( isAmericanExpress ( cc ) ) return "AmericanExpress" ; if ( isDinersClub ( cc ) ) return "DinersClub" ; if ( isDiscover ( cc ) ) return "Discover" ; if ( isEnRoute ( cc ) ) return "EnRoute" ; if ( isJCB ( cc ) ) return "JCB" ; return "Unknown" ; }
Checks to see if the cc number is a valid number for any accepted credit card and return the name of that type