Class Track1.Builder
java.lang.Object
org.jpos.core.Track1.Builder
- Enclosing class:
Track1
Fluent builder that parses a raw track1 string or assembles a
Track1
from individual fields and validates the result against a configurable pattern.- Since:
- jPOS 2.0.5
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the immutableTrack1.Constructs the Track1 data based on the card data provided.Sets the CVV/CVC value.discretionaryData(String discretionaryData) Sets the discretionary data trailing the service code.Sets the expiration date.nameOnCard(String nameOnCard) Sets the cardholder name.Sets the primary account number.Optional method, can be used to override default patternserviceCode(String serviceCode) Sets the service code.Parses a raw track1 string and populates the builder fields.
-
Method Details
-
pan
Sets the primary account number.- Parameters:
pan- primary account number- Returns:
- this builder
-
nameOnCard
Sets the cardholder name.- Parameters:
nameOnCard- cardholder name as encoded on the track- Returns:
- this builder
-
exp
Sets the expiration date.- Parameters:
exp- expiration date inYYMMform- Returns:
- this builder
-
cvv
Sets the CVV/CVC value.- Parameters:
cvv- CVV/CVC value- Returns:
- this builder
-
serviceCode
Sets the service code.- Parameters:
serviceCode- three-digit service code- Returns:
- this builder
-
discretionaryData
Sets the discretionary data trailing the service code.- Parameters:
discretionaryData- discretionary data trailing the service code- Returns:
- this builder
-
pattern
Optional method, can be used to override default pattern- Parameters:
pattern- overrides default pattern- Returns:
- this builder
-
track
Parses a raw track1 string and populates the builder fields.- Parameters:
s- raw track1 data- Returns:
- this builder
- Throws:
InvalidCardException- ifsis null or does not match the configured pattern
-
buildTrackData
Constructs the Track1 data based on the card data provided. The generated Track1 data is validated using the pattern. If the Track1 data doesn't match the pattern, the track attribute keeps the original value.- Returns:
- this builder.
-
build
Builds the immutableTrack1. If no raw track string was set, one is assembled from the individual fields viabuildTrackData().- Returns:
- the built
Track1
-