# stdnum.do.ncf

NCF (Números de Comprobante Fiscal, Dominican Republic receipt number).

The NCF is used to number invoices and other documents for the purposes of tax filing. The number is 19 digits long and consists of a letter (A or P) to indicate that the number was assigned by the taxpayer or the DGIT, followed a 2-digit business unit number, a 3-digit location number, a 3-digit mechanism identifier, a 2-digit document type and a 8-digit serial number.

More information:

> - https://www.dgii.gov.do/et/nivelContribuyentes/Presentaciones%20contribuyentes/Número%20de%20Comprobantes%20Fiscales%20(NCF).pdf

    >>> validate('A020010210100000005')
    'A020010210100000005'
    >>> validate('Z020010210100000005')
    Traceback (most recent call last):
        ...
    InvalidFormat: ...

`stdnum.do.ncf.``check_dgii`(rnc, ncf)

  Validate the RNC, NCF combination on using the DGII online web service.

  This uses the validation service run by the the Dirección General de Impuestos Internos, the Dominican Republic tax department to check whether the combination of RNC and NCF is valid.

  Returns a dict with the following structure:

      {
          'name': 'The registered name',
          'proof': 'Source of the information',
          'is_valid': '1',
          'validation_message': '',
          'rnc': '123456789',
          'ncf': 'A020010210100000005'
      }

  Will return None if the number is invalid or unknown.

`stdnum.do.ncf.``compact`(number)

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

`stdnum.do.ncf.``is_valid`(number)

  Check if the number provided is a valid NCF.

`stdnum.do.ncf.``validate`(number)

  Check if the number provided is a valid NCF.