Class Track1

java.lang.Object
org.jpos.core.Track1

public class Track1 extends Object
This class is based on the old 'CardHolder' class and adds support for multiple PAN and Expiration dates taken from manual entry, track1, track1. It also corrects the name.
Since:
jPOS 2.0.5
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Fluent builder that parses a raw track1 string or assembles a Track1 from individual fields and validates the result against a configurable pattern.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Copies the track1 fields from the supplied Track1.Builder.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new builder for assembling a Track1.
    boolean
     
    Returns the CVV/CVC value, when present.
    Returns the discretionary data trailing the service code.
    Returns the expiration date.
    Returns the cardholder name encoded on the track.
    Returns the primary account number.
    Returns the service code.
    Returns the raw track1 string this object was built from.
    int
     
    boolean
    Returns true when the service code marks this as an IC (EMV) card.
    boolean
    Returns true when the service code marks this as an IC card (first digit 2 for international or 6 for national).
    boolean
    Returns true when the service code marks this as an internationally-usable IC card (first digit 2).
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Track1

      public Track1(Track1.Builder builder)
      Copies the track1 fields from the supplied Track1.Builder.
      Parameters:
      builder - builder carrying the parsed or assembled track1 fields
  • Method Details

    • getPan

      public String getPan()
      Returns the primary account number.
      Returns:
      primary account number
    • getNameOnCard

      Returns the cardholder name encoded on the track.
      Returns:
      cardholder name as encoded on the track
    • getExp

      public String getExp()
      Returns the expiration date.
      Returns:
      expiration date in YYMM form, or null if absent
    • getCvv

      public String getCvv()
      Returns the CVV/CVC value, when present.
      Returns:
      CVV/CVC value, or null if not present in the track
    • getServiceCode

      Returns the service code.
      Returns:
      three-digit service code, or null if absent
    • getDiscretionaryData

      Returns the discretionary data trailing the service code.
      Returns:
      remaining discretionary data, or null if absent
    • getTrack

      public String getTrack()
      Returns the raw track1 string this object was built from.
      Returns:
      raw track1 string this object was built from, or null when assembled programmatically
    • isEMV

      public boolean isEMV()
      Returns true when the service code marks this as an IC (EMV) card.
      Returns:
      true if the Track 1 service code indicates an IC card
    • isICCard

      public boolean isICCard()
      Returns true when the service code marks this as an IC card (first digit 2 for international or 6 for national).
      Returns:
      true if the Track 1 service code indicates an IC card
    • isInternationalICCard

      public boolean isInternationalICCard()
      Returns true when the service code marks this as an internationally-usable IC card (first digit 2).
      Returns:
      true if the Track 1 service code indicates an international IC card
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • builder

      public static Track1.Builder builder()
      Creates a new builder for assembling a Track1.
      Returns:
      a new Track1.Builder for assembling a Track1