org.erif.util
Class CCUtil
java.lang.Object
|
+--org.erif.util.CCUtil
- public class CCUtil
- extends java.lang.Object
General credit card constants and information.
Card Type | Prefix | Length | Check Digit |
Mastercard | 51-55 | 16 | mod 10 |
Visa | 4 | 13, 16 | mod 10 |
AmEx | 34, 37 | 15 | mod 10 |
Diners Club/ Care Blanche | 300-305, 36, 38 | 14 | mod 10 |
Discover | 6011 | 16 | mod 10 |
enRoute | 2014, 2149 | 15 | any |
JCB | 3 | 16 | mod 10 |
JCB | 2131, 1800 | 15 | mod 10 |
TODO: currently only supports MC/VISA/AMEX for typechecking
Method Summary |
static int |
getTypeFromNumber(java.lang.String ccnum)
|
static void |
main(java.lang.String[] args)
|
static int |
mod10(java.lang.String ccnum)
|
static boolean |
verify(java.lang.String ccnum)
|
static boolean |
verify(java.lang.String ccnum,
int type)
validates based on card type and mod10 rule; please use one of the appropriate class constants to specify the credit card type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INVALID
public static final int INVALID
MASTERCARD
public static final int MASTERCARD
VISA
public static final int VISA
AMEX
public static final int AMEX
DINERS
public static final int DINERS
CARTBLANCHE
public static final int CARTBLANCHE
DISCOVER
public static final int DISCOVER
ENROUTE
public static final int ENROUTE
JCB
public static final int JCB
MINLENGTH
public static final int MINLENGTH
CCUtil
public CCUtil()
getTypeFromNumber
public static int getTypeFromNumber(java.lang.String ccnum)
mod10
public static int mod10(java.lang.String ccnum)
verify
public static boolean verify(java.lang.String ccnum)
verify
public static boolean verify(java.lang.String ccnum,
int type)
- validates based on card type and mod10 rule; please use one of the appropriate class constants to specify the credit card type.
main
public static void main(java.lang.String[] args)
Copyright © 2003 - kaolin fire