# stdnum.th.moa

MOA (Thailand Memorandum of Association Number).

Memorandum of Association Number (aka Company’s Taxpayer Identification Number) are numbers issued by the Department of Business Development.

The number consists of 13 digits of which the last is a check digit following the same algorithm as in the Personal Identity Number (PIN). It uses a different grouping format and always starts with zero to indicate that the number issued by DBD.

More information:

- https://www.dbd.go.th/download/pdf_kc/s09/busin_2542-48.pdf

    >>> compact('0 10 5 536 11201 4')
    '0105536112014'
    >>> validate('0994000617721')
    '0994000617721'
    >>> validate('0-99-4-000-61772-1')
    '0994000617721'
    >>> validate('0-99-4-000-61772-3')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> format('0993000133978')
    '0-99-3-000-13397-8'

stdnum.th.moa.calc_check_digit(number)

  Calculate the check digit.

stdnum.th.moa.compact(number)

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.th.moa.format(number)

  Reformat the number to the standard presentation format.

stdnum.th.moa.is_valid(number)

  Check whether the number is valid.

stdnum.th.moa.validate(number)

  Check if the number is a valid MOA Number. This checks the length, formatting, component and check digit.