Package com.scriptel.proscript.cardswipe

## Class FinancialCard

- java.lang.Object
- - com.scriptel.proscript.cardswipe.FinancialCard

-     public final class FinancialCard
      extends java.lang.Object

  This class represents the parsed magnetic stripe data from a financial (credit) card.
  See Also:
    http://en.wikipedia.org/wiki/Magnetic_stripe_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
    --- | --- | ---
    `FinancialCardIssuer` | `getIssuer()` | Gets the card issuer determined based on card number patterns.
    `FinancialCardTrackOne` | `getTrackOne()` | Gets track one.
    `FinancialCardTrackTwo` | `getTrackTwo()` | Gets track two.
    `boolean` | `isNumberValid()` | Gets whether or not the credit card number passes Luhn's algorithm.
    `static FinancialCard` | `parse​(java.lang.String cardData)` | This method takes the raw card data from the swipe and attempts to extract financial card data.
    `java.lang.String` | `toString()` | Returns this object as a human readable string.
    `static boolean` | `verifyCardChecksum​(java.lang.String cardNumber)` | This method takes a card number and applies Luhn's algorithm to verify the card checksum.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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:
        `toString` in class `java.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.