public class CardHolder extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, Loggeable
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
exp
Expiration date (YYMM)
|
protected java.lang.String |
pan
Primary Account Number
|
protected java.lang.String |
securityCode
Optional security code (CVC, CVV, Locale ID, wse)
|
protected java.lang.String |
track1
Track1 Data
|
protected java.lang.String |
trailer
Track2 trailler
|
Constructor and Description |
---|
CardHolder()
creates an empty CardHolder
|
CardHolder(ISOMsg m)
Construct a CardHolder based on content received on
field 35 (track2) or field 2 (PAN) + field 14 (EXP)
|
CardHolder(java.lang.String track2)
creates a new CardHolder based on track2
|
CardHolder(java.lang.String pan,
java.lang.String exp)
creates a new CardHolder based on pan and exp
|
Modifier and Type | Method and Description |
---|---|
void |
dump(java.io.PrintStream p,
java.lang.String indent)
dumps CardHolder basic information
by default we do not dump neither track1/2 nor securityCode for security reasons. |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getBIN()
Get the traditional 6-digit BIN (Bank Issuer Number) from the PAN
|
java.lang.String |
getBIN(int len)
Get the first
len digits from the PAN. |
java.lang.String |
getEXP()
Get Expiration Date
|
java.lang.String |
getNameOnCard() |
java.lang.String |
getPAN() |
java.lang.String |
getSecurityCode() |
java.lang.String |
getServiceCode() |
java.lang.String |
getTrack1() |
java.lang.String |
getTrack2() |
java.lang.String |
getTrailer() |
java.lang.String |
getTrailler()
Deprecated.
use getTrailer()
|
int |
hashCode() |
boolean |
hasSecurityCode() |
boolean |
hasTrack1() |
boolean |
hasTrack2() |
boolean |
isExpired()
Y2K compliant expiration check
|
boolean |
isExpired(java.util.Date currentDate)
Y2K compliant expiration check
|
boolean |
isValidCRC() |
static boolean |
isValidCRC(java.lang.String p) |
void |
parseTrack2(java.lang.String s)
extract pan/exp/trailler from track2
|
boolean |
seemsManualEntry() |
void |
setEXP(java.lang.String exp)
Set Expiration Date
|
void |
setPAN(java.lang.String pan)
Sets Primary Account Number
|
void |
setSecurityCode(java.lang.String securityCode)
assigns securityCode to this CardHolder object
|
void |
setTrack1(java.lang.String track1) |
void |
setTrailer(java.lang.String trailer) |
void |
setTrailler(java.lang.String trailer)
Deprecated.
use setTrailer
|
protected java.lang.String pan
protected java.lang.String exp
protected java.lang.String trailer
protected java.lang.String securityCode
protected java.lang.String track1
public CardHolder()
public CardHolder(java.lang.String track2) throws InvalidCardException
track2
- cards track2InvalidCardException
public CardHolder(java.lang.String pan, java.lang.String exp) throws InvalidCardException
InvalidCardException
public CardHolder(ISOMsg m) throws InvalidCardException
m
- an ISOMsgInvalidCardException
public void parseTrack2(java.lang.String s) throws InvalidCardException
s
- a valid track2InvalidCardException
public void setTrack1(java.lang.String track1)
track1
- card's track1public java.lang.String getTrack1()
public boolean hasTrack1()
public java.lang.String getNameOnCard()
public java.lang.String getTrack2()
public boolean hasTrack2()
public void setSecurityCode(java.lang.String securityCode)
securityCode
- Card's security codepublic java.lang.String getSecurityCode()
public boolean hasSecurityCode()
public java.lang.String getTrailler()
public void setTrailler(java.lang.String trailer)
trailer
- Card's trailerpublic java.lang.String getTrailer()
public void setTrailer(java.lang.String trailer)
public void setPAN(java.lang.String pan) throws InvalidCardException
pan
- Primary Account NUmberInvalidCardException
public java.lang.String getPAN()
public java.lang.String getBIN(int len)
len
digits from the PAN.
Can be used for the newer 8-digit BINs, or some arbitrary length.len
-digit bank issuer numberpublic java.lang.String getBIN()
public void setEXP(java.lang.String exp) throws InvalidCardException
exp
- card expiration dateInvalidCardException
public java.lang.String getEXP()
public boolean isExpired()
public boolean isExpired(java.util.Date currentDate)
currentDate
- current system's datepublic boolean isValidCRC()
public static boolean isValidCRC(java.lang.String p)
public void dump(java.io.PrintStream p, java.lang.String indent)
public java.lang.String getServiceCode()
public boolean seemsManualEntry()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object