Class DefaultCardValidator
java.lang.Object
org.jpos.core.DefaultCardValidator
- All Implemented Interfaces:
CardValidator
- Direct Known Subclasses:
IgnoreLuhnCardValidator
Default
CardValidator that cross-checks the PAN, expiration, and
service code across explicit fields and embedded tracks 1/2, and verifies
the LUHN check digit using a configurable LUHNCalculator.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor; no instance state to initialise. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetLuhnCalculator(LUHNCalculator luhnCalculator) Replaces theLUHNCalculatorused to verify PAN check digits.voidValidates the given card.
-
Constructor Details
-
DefaultCardValidator
public DefaultCardValidator()Default constructor; no instance state to initialise.
-
-
Method Details
-
validate
Description copied from interface:CardValidatorValidates the given card.- Specified by:
validatein interfaceCardValidator- Parameters:
card- the card to validate- Throws:
InvalidCardException- if the card is invalid
-
setLuhnCalculator
Replaces theLUHNCalculatorused to verify PAN check digits.- Parameters:
luhnCalculator- new calculator (ornullto skip LUHN verification)
-