# stdnum.do.rnc

RNC (Registro Nacional del Contribuyente, Dominican Republic tax number).

The RNC is the Dominican Republic taxpayer registration number for institutions. The number consists of 9 digits.

    >>> validate('1-01-85004-3')
    '101850043'
    >>> validate('1018A0043')
    Traceback (most recent call last):
        ...
    InvalidFormat: ...
    >>> validate('101850042')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> format('131246796')
    '1-31-24679-6'

stdnum.do.rnc.calc_check_digit(number: str) → str

  Calculate the check digit.

stdnum.do.rnc.check_dgii(number: str, timeout: float = 30, verify: bool | str = True) → dict[str, str] | None

  Lookup the number 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 lookup registration information for the number.

  The timeout argument specifies the network timeout in seconds.

  The verify argument is either a boolean that determines whether the server’s certificate is validate or a string which must be a path the CA certificate bundle to use for verification.

  Returns a dict with the following structure:

      {
          'rnc': '123456789',     # The requested number
          'name': 'The registered name',
          'commercial_name': 'An additional commercial name',
          'status': '2',          # 1: inactive, 2: active
          'category': '0',        # always 0?
          'payment_regime': '2',  # 1: N/D, 2: NORMAL, 3: PST
      }

  Will return None if the number is invalid or unknown.

stdnum.do.rnc.compact(number: str) → str

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

stdnum.do.rnc.dgii_wsdl = 'https://www.dgii.gov.do/wsMovilDGII/WSMovilDGII.asmx?WSDL'

  The WSDL URL of DGII validation service.

stdnum.do.rnc.format(number: str) → str

  Reformat the number to the standard presentation format.

stdnum.do.rnc.is_valid(number: str) → bool

  Check if the number provided is a valid RNC.

stdnum.do.rnc.search_dgii(keyword: str, end_at: int = 10, start_at: int = 1, timeout: float = 30, verify: bool | str = True) → list[dict[str, str]]

  Search the DGII online web service using the keyword.

  This uses the validation service run by the the Dirección General de Impuestos Internos, the Dominican Republic tax department to search the registration information using the keyword.

  The number of entries returned can be tuned with the end_at and start_at arguments.

  The timeout argument specifies the network timeout in seconds.

  The verify argument is either a boolean that determines whether the server’s certificate is validate or a string which must be a path the CA certificate bundle to use for verification.

  Returns a list of dicts with the following structure:

      [
          {
              'rnc': '123456789',     # The found number
              'name': 'The registered name',
              'commercial_name': 'An additional commercial name',
              'status': '2',          # 1: inactive, 2: active
              'category': '0',        # always 0?
              'payment_regime': '2',  # 1: N/D, 2: NORMAL, 3: PST
              'result_number': '1',   # index of the result
          },
          ...
      ]

  Will return an empty list if the number is invalid or unknown.

stdnum.do.rnc.validate(number: str) → str

  Check if the number provided is a valid RNC.