Package com.scriptel.proscript.cardswipe
Class FinancialCard
- java.lang.Object
-
- com.scriptel.proscript.cardswipe.FinancialCard
-
public final class FinancialCard extends java.lang.ObjectThis class represents the parsed magnetic stripe data from a financial (credit) card.
-
-
Constructor Summary
Constructors Constructor Description FinancialCard(FinancialCardTrackOne trackOne, FinancialCardTrackTwo trackTwo, boolean numberValid, FinancialCardIssuer issuer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FinancialCardIssuergetIssuer()Gets the card issuer determined based on card number patterns.FinancialCardTrackOnegetTrackOne()Gets track one.FinancialCardTrackTwogetTrackTwo()Gets track two.booleanisNumberValid()Gets whether or not the credit card number passes Luhn's algorithm.static FinancialCardparse(java.lang.String cardData)This method takes the raw card data from the swipe and attempts to extract financial card data.java.lang.StringtoString()Returns this object as a human readable string.static booleanverifyCardChecksum(java.lang.String cardNumber)This method takes a card number and applies Luhn's algorithm to verify the card checksum.
-
-
-
Constructor Detail
-
FinancialCard
public FinancialCard(FinancialCardTrackOne trackOne, FinancialCardTrackTwo trackTwo, boolean numberValid, FinancialCardIssuer issuer)
-
-
Method Detail
-
parse
public static FinancialCard parse(java.lang.String cardData)
This method takes the raw card data from the swipe and attempts to extract financial card data.- Parameters:
cardData- Raw magnetic strip data.- Returns:
- FinancialCard object containing parsed data if possible, otherwise null.
-
toString
public java.lang.String toString()
Returns this object as a human readable string.- Overrides:
toStringin classjava.lang.Object- Returns:
- String containing human readable string.
-
verifyCardChecksum
public static boolean verifyCardChecksum(java.lang.String cardNumber)
This method takes a card number and applies Luhn's algorithm to verify the card checksum. This method can detect minor transpositions and obviously invalid card numbers, but it cannot detect fake credit card numbers.- Parameters:
cardNumber- Card number to verify.- Returns:
- True if the card number passes, false otherwise.
- See Also:
- http://en.wikipedia.org/wiki/Luhn_algorithm
-
getTrackOne
public FinancialCardTrackOne getTrackOne()
Gets track one.- Returns:
- Parsed track one.
-
getTrackTwo
public FinancialCardTrackTwo getTrackTwo()
Gets track two.- Returns:
- Parsed track two.
-
isNumberValid
public boolean isNumberValid()
Gets whether or not the credit card number passes Luhn's algorithm.- Returns:
- the numberValid
-
getIssuer
public FinancialCardIssuer getIssuer()
Gets the card issuer determined based on card number patterns.- Returns:
- The card issuer.
-
-