Interface LUHNCalculator

All Known Implementing Classes:
DefaultLUHNCalculator

public interface LUHNCalculator
Strategy interface for LUHN check-digit calculation and verification.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    Computes the LUHN check digit for a PAN body (without check digit).
    boolean
    Verifies the LUHN check digit of a full PAN.
  • Method Details

    • verify

      boolean verify(String pan) throws InvalidCardException
      Verifies the LUHN check digit of a full PAN.
      Parameters:
      pan - the full card PAN including check digit
      Returns:
      true if the check digit is valid
      Throws:
      InvalidCardException - if the PAN is null or too short
    • calculate

      Computes the LUHN check digit for a PAN body (without check digit).
      Parameters:
      pan - the PAN without the check digit
      Returns:
      the computed check digit character
      Throws:
      InvalidCardException - if the PAN contains non-digit characters