MCPcopy Create free account
hub / github.com/banq/jdonframework / isDinersClub

Method isDinersClub

src/main/java/com/jdon/util/UtilValidate.java:945–952  ·  view source on GitHub ↗

Checks to see if the cc number is a valid Diners Club number @param cc - a string representing a credit card number; Sample number: 30000000000004(14 digits) @return true, if the credit card number is a valid Diner's Club number, false otherwise

(String cc)

Source from the content-addressed store, hash-verified

943 * @return true, if the credit card number is a valid Diner's Club number, false otherwise
944 */
945 public static boolean isDinersClub(String cc) {
946 int firstdig = Integer.parseInt(cc.substring(0, 1));
947 int seconddig = Integer.parseInt(cc.substring(1, 2));
948
949 if ((cc.length() == 14) && (firstdig == 3) && ((seconddig == 0) || (seconddig == 6) || (seconddig == 8)))
950 return isCreditCard(cc);
951 return false;
952 }
953
954 /** Checks to see if the cc number is a valid Carte Blanche number
955 * @param cc - a string representing a credit card number; Sample number: 30000000000004(14 digits)

Callers 4

isCarteBlancheMethod · 0.95
isAnyCardMethod · 0.95
getCardTypeMethod · 0.95
isCardMatchMethod · 0.95

Calls 1

isCreditCardMethod · 0.95

Tested by

no test coverage detected