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

Module for calculating the checksum of Ukrainian Individual Tax Identification Numbers (ITIN). Provides functions for checksum calculation based on weighted digits and helper functions for working with ITIN weights and dividers. Uses specified numerical weights to multiply each digit of the ITIN and validate its authenticity.

Summary

Functions

Calculate checksum for ITIN number. The checksum for ITIN is calculated in several steps

Returns the list of numerical weights used to calculate the ITIN checksum. Each digit in the ITIN is multiplied by its corresponding weight.

Functions

check_sum(digits, weights \\ [-1, 5, 7, 9, 4, 6, 10, 5, 7])

@spec check_sum(
  digits :: UkraineTaxidEx.Commons.digits(),
  weights :: UkraineTaxidEx.Commons.digits()
) ::
  integer()

Calculate checksum for ITIN number. The checksum for ITIN is calculated in several steps:

  1. Multiply each digit by its corresponding weight
  2. Sum the products
  3. Take mod 11 of the sum
  4. If mod 11 is greater or equal than 10, repeat steps 2-4 with weights +2

weights()

@spec weights() :: UkraineTaxidEx.Commons.digits()

Returns the list of numerical weights used to calculate the ITIN checksum. Each digit in the ITIN is multiplied by its corresponding weight.