Ë
    Ã?Æik  ã                  óà   — d Z ddlmZ ddlZddl­ ddlmZmZmZ  e	dj                  «       «      ZdZ	 dd„Zdd	„Zdd
„Zdd„Zdd„Zdd„Z	 	 d	 	 	 	 	 	 	 dd„Z	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd„Zy)aÀ  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'
é    )ÚannotationsN)Ú*)ÚcleanÚget_soap_clientÚisdigitszæ
101581601 101582245 101595422 101595785 10233317 131188691 401007374
501341601 501378067 501620371 501651319 501651823 501651845 501651926
501656006 501658167 501670785 501676936 501680158 504654542 504680029
504681442 505038691
z9https://www.dgii.gov.do/wsMovilDGII/WSMovilDGII.asmx?WSDLc                ó6   — t        | d«      j                  «       S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -)r   Ústrip©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/do/rnc.pyÚcompactr   ?   s   € ô �˜Ó×$Ñ$Ó&Ð&ó    c                ól   — d}t        d„ t        || «      D «       «      dz  }t        d|z
  dz  dz   «      S )zCalculate the check digit.)é   é	   é   é   é   é   é   é   c              3  ó>   K  — | ]  \  }}|t        |«      z  –— Œ y ­w©N)Úint)Ú.0ÚwÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>H   s   è ø€ Ò<™t˜q !�”C˜“F•
Ñ<ùs   ‚é   é
   r   é   )ÚsumÚzipÚstr)r   ÚweightsÚchecks      r   Úcalc_check_digitr'   E   s<   € à&€GÜÑ<¤s¨7°FÓ';Ô<Ó<¸rÑA€EÜ��U‘
˜aÑ !Ñ#Ó$Ð$r   c                óÆ   — t        | «      } t        | «      s
t        «       ‚| t        v r| S t	        | «      dk7  r
t        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )ú,Check if the number provided is a valid RNC.r   Néÿÿÿÿ)r   r   ÚInvalidFormatÚ	whitelistÚlenÚInvalidLengthr'   ÚInvalidChecksumr
   s    r   Úvalidater0   L   sa   € ä�V‹_€FÜ�FÔÜ‹oÐØ”ÑØˆÜ
ˆ6ƒ{�aÒÜ‹oÐÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r)   F)Úboolr0   ÚValidationErrorr
   s    r   Úis_validr4   Z   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óZ   — t        | «      } dj                  | dd | dd | dd | d   f«      S )z8Reformat the number to the standard presentation format.ú-Nr!   r   r*   )r   Újoinr
   s    r   Úformatr8   b   s9   € ä�V‹_€FØ�8‰8�V˜B˜Q�Z ¨¨! ¨f°Q°r¨l¸FÀ2¹JÐGÓHÐHr   c           	     óÂ   ‡— ddddddddœŠt        ˆfd	„t        j                  | j                  d
d«      j                  dd«      «      j	                  «       D «       «      S )z)Translate SOAP result entries into dicts.ÚrncÚnameÚcommercial_nameÚcategoryÚpayment_regimeÚstatusÚresult_number)ÚRGE_RUCÚ
RGE_NOMBREÚNOMBRE_COMERCIALÚ	CATEGORIAÚREGIMEN_PAGOSÚESTATUSÚRNUMc              3  óL   •K  — | ]  \  }}‰j                  ||«      |f–— Œ y ­wr   )Úget)r   ÚkeyÚvalueÚtranslations      €r   r   z"_convert_result.<locals>.<genexpr>s   s/   øè ø€ ò `áˆC�ð 
�‰˜˜cÓ	" EÔ*ñ`ùs   ƒ!$ú
z\nú	z\t)ÚdictÚjsonÚloadsÚreplaceÚitems)ÚresultrL   s    @r   Ú_convert_resultrU   h   sk   ø€ ð ØØ-ØØ)ØØñ€Kô ó `äŸ*™* V§^¡^°D¸%Ó%@×%HÑ%HÈÈuÓ%UÓV×\Ñ\Ó^ô`ó `ð `r   c                óì   — t        | «      } t        t        ||¬«      }|j                  | dddd¬«      }|r	d|v r|d   }|dk(  ry|j	                  d	«      D �cg c]  }|‘Œ }}t        |d   «      S c c}w )
uØ  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.©ÚtimeoutÚverifyr   r!   Ú ©rK   ÚpatronBusquedaÚinicioFilasÚ	filaFilasÚIMEIÚGetContribuyentesResultÚ0Nú@@@)r   r   Ú	dgii_wsdlÚGetContribuyentesÚsplitrU   )r   rX   rY   ÚclientrT   Úxs         r   Ú
check_dgiirh   x   s‘   € ô> �V‹_€FÜœY°ÀÔG€FØ×%Ñ%ØØØØØð &ó €Fñ Ð+¨vÑ5ØÐ1Ñ2ˆØ�‚}ØØŸ™ eÓ,Ö-�AŠaÐ-€FÐ-Ü˜6 !™9Ó%Ð%ùò .s   Á	A1c                óÐ   — t        t        ||¬«      }|j                  | d||d¬«      }|r	d|v r|d   }|dk(  rg S |j                  d«      D �cg c]  }t	        |«      ‘Œ c}S c c}w )uÒ  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.rW   r!   rZ   r[   r`   ra   rb   )r   rc   rd   re   rU   )ÚkeywordÚend_atÚstart_atrX   rY   rf   ÚresultsrT   s           r   Úsearch_dgiirn   §   s}   € ôP œY°ÀÔG€FØ×&Ñ&ØØØØØð 'ó €Gñ Ð,°Ñ7ØÐ3Ñ4ˆØ�#‚~Øˆ	Ø29·-±-ÀÓ2FÖG¨ŒO˜FÕ#ÒGÐGùÒGs   ÁA#)r   r$   Úreturnr$   )r   r$   ro   r2   )rT   r$   ro   zdict[str, str])é   T)r   r$   rX   ÚfloatrY   ú
bool | strro   zdict[str, str] | None)r    r!   rp   T)rj   r$   rk   r   rl   r   rX   rq   rY   rr   ro   zlist[dict[str, str]])Ú__doc__Ú
__future__r   rP   Ústdnum.exceptionsÚstdnum.utilr   r   r   Úsetre   r,   rc   r   r'   r0   r4   r8   rU   rh   rn   © r   r   ú<module>ry      sä   ðñ.õ& #ã ä ß 8Ñ 8ñ ð ÷
 
�EƒGó€	ð H€	Ø .ó'ó%óóóIó`ð$ Øð,&Øð,&àð,&ð ð,&ð ó	,&ðb ØØØð3HØð3Hàð3Hð ð3Hð ð	3Hð
 ð3Hð ô3Hr   