Class Card.Builder
java.lang.Object
org.jpos.core.Card.Builder
- Enclosing class:
Card
Builder for constructing
Card instances.- Since:
- jPOS 2.0.5
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and validates theCard.Sets the CVV1 value.Sets the CVV2 value.Sets the expiry date.Populates card data from anISOMsg.Sets the primary account number.serviceCode(String serviceCode) Sets the service code.Sets the Track 1 data.Sets the Track 2 data.validator(CardValidator validator) Sets the card validator.withTrack1Builder(Track1.Builder track1Builder) Provides a Track 1 builder.withTrack2Builder(Track2.Builder track2Builder) Provides a Track 2 builder.
-
Field Details
-
DEFAULT_CARD_VALIDATOR
Default card validator instance.
-
-
Method Details
-
pan
Sets the primary account number.- Parameters:
pan- the PAN- Returns:
- this builder
-
exp
Sets the expiry date.- Parameters:
exp- the expiry in YYMM format- Returns:
- this builder
-
cvv
Sets the CVV1 value.- Parameters:
cvv- the CVV1 value- Returns:
- this builder
-
cvv2
Sets the CVV2 value.- Parameters:
cvv2- the CVV2 value- Returns:
- this builder
-
serviceCode
Sets the service code.- Parameters:
serviceCode- the 3-digit service code- Returns:
- this builder
-
validator
Sets the card validator.- Parameters:
validator- the card validator to use- Returns:
- this builder
-
withTrack1Builder
Provides a Track 1 builder.- Parameters:
track1Builder- aTrack1.Builderinstance- Returns:
- this builder
-
withTrack2Builder
Provides a Track 2 builder.- Parameters:
track2Builder- aTrack2.Builderinstance- Returns:
- this builder
-
track1
Sets the Track 1 data.- Parameters:
track1- theTrack1object- Returns:
- this builder
-
track2
Sets the Track 2 data.- Parameters:
track2- theTrack2object- Returns:
- this builder
-
isomsg
Populates card data from anISOMsg. Extracts PAN, expiry, track 1, and track 2 from the appropriate fields.- Parameters:
m- an ISOMsg to extract card data from- Returns:
- this builder
- Throws:
InvalidCardException- if card data is invalid
-
build
Builds and validates theCard.- Returns:
- a new Card instance
- Throws:
InvalidCardException- if the card data is invalid
-