View Source UkraineTaxidEx.Itin.Validator (ukraine_tax_id v0.1.1)

Validator module for Ukrainian Individual Taxpayer Identification Number (ITIN/IPN). Handles validation of ITIN numbers according to Ukrainian tax authority requirements.

Validates an ITIN number to check if it meets length requirements and has a valid checksum.

Returns:

  • {:ok, itin} if validation successful
  • {:error, :length_too_short} if shorter than required length
  • {:error, :length_too_long} if longer than required length
  • {:error, :invalid_checksum} if checksum is invalid

Examples:

    iex> UkraineTaxidEx.Itin.Validator.validate("3184710691")
    {:ok, "3184710691"}

    iex> UkraineTaxidEx.Itin.Validator.validate("123456")
    {:error, :length_too_short}

    iex> UkraineTaxidEx.Itin.Validator.validate("12345678901")
    {:error, :length_too_long}

    iex> UkraineTaxidEx.Itin.Validator.validate("3184710692")
    {:error, :invalid_checksum}

Summary

Functions

Check whether a given EDRPOU has correct checksum

Check whether a given EDRPOU violates the required length

Check whether a given EDRPOU too long

Check whether a given EDRPOU too short

Functions

violates_checksum?(code)

@spec violates_checksum?(code :: String.t()) :: boolean()

Check whether a given EDRPOU has correct checksum

violates_length?(code)

@spec violates_length?(code :: String.t()) :: boolean()

Check whether a given EDRPOU violates the required length

violates_length_too_long?(code)

@spec violates_length_too_long?(code :: String.t()) :: boolean()

Check whether a given EDRPOU too long

violates_length_too_short?(code)

@spec violates_length_too_short?(code :: String.t()) :: boolean()

Check whether a given EDRPOU too short