Ë
    Ã?Æi6  ã                  óØ   — d Z ddlmZ ddlZddlmZ ddl­ ddlmZm	Z	m
Z
mZ  eg d¢«      Z	  e«       Z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  VAT (European Union VAT number).

The European Union VAT number consists of a 2 letter country code (ISO
3166-1, except Greece which uses EL) followed by a number that is
allocated per country.

The exact format of the numbers varies per country and a country-specific
check is performed on the number using the VAT module that is relevant for
that country.

>>> compact('ATU 57194903')
'ATU57194903'
>>> validate('BE697449992')
'BE0697449992'
>>> validate('FR 61 954 506 077')
'FR61954506077'
>>> guess_country('00449544B01')
['nl']
é    )ÚannotationsN)Úoss)Ú*)ÚNumberValidationModuleÚcleanÚget_cc_moduleÚget_soap_client)ÚatÚbeÚbgÚcyÚczÚdeÚdkÚeeÚesÚfiÚfrÚgrÚhrÚhuÚieÚitÚltÚluÚlvÚmtÚnlÚplÚptÚroÚseÚsiÚskÚxiz?https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdlc                ó¬   — | j                  «       } | dv rt        S | dk(  rd} | t        vry| dk(  rd} | t        vrt	        | d«      t        | <   t        |    S )z4Get the VAT number module based on the country code.)ÚeuÚimÚelr   Nr%   ÚgbÚvat)Úlowerr   ÚMEMBER_STATESÚ_country_modulesr   )Úccs    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/eu/vat.pyÚ_get_cc_moduler1   C   se   € ð 
�‰‹€BØ	ˆ\ÑÜˆ
Ø	ˆT‚zØˆØ	”ÑØØ	ˆT‚zØˆØ	Ô!Ñ!Ü,¨R°Ó7Ô˜ÑÜ˜BÑÐó    c                óÜ   — t        | d«      j                  «       j                  «       } | dd }t        |«      }|s
t	        «       ‚|j                  | «      } | j                  |«      s|| z   } | S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.Ú Né   )r   ÚupperÚstripr1   ÚInvalidComponentÚcompactÚ
startswith©Únumberr/   Úmodules      r0   r9   r9   T   sm   € ô �6˜2Ó×$Ñ$Ó&×,Ñ,Ó.€FØ	��ˆ€BÜ˜BÓ€FÙÜÓ Ð Ø�^‰^˜FÓ#€FØ×Ñ˜RÔ Ø�f‘ˆØ€Mr2   c                óÜ   — t        | d«      j                  «       j                  «       } | dd }t        |«      }|s
t	        «       ‚|j                  | «      } | j                  |«      s|| z   } | S )úgCheck if the number is a valid VAT number. This performs the
    country-specific check for the number.r4   Nr5   )r   r6   r7   r1   r8   Úvalidater:   r;   s      r0   r@   r@   b   sm   € ô �6˜2Ó×$Ñ$Ó&×,Ñ,Ó.€FØ	��ˆ€BÜ˜BÓ€FÙÜÓ Ð Ø�_‰_˜VÓ$€FØ×Ñ˜RÔ Ø�f‘ˆØ€Mr2   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r?   F)Úboolr@   ÚValidationError)r<   s    r0   Úis_validrD   p   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óh   — t         D �cg c]  }t        |«      j                  | «      r|‘Œ  c}S c c}w )zñGuess the country code based on the number. This checks the number
    against each of the validation routines and returns the list of countries
    for which it is valid. This returns lower case codes and returns gr (not
    el) for Greece.)r-   r1   rD   )r<   r/   s     r0   Úguess_countryrF   y   s7   € ô $ö4ØÜ˜bÓ!×*Ñ*¨6Ô2ò ò 4ð 4ùò 4s   ‰#/c                ól   — t        | «      } t        t        ||¬«      }|j                  | dd | dd «      S )a:  Use the EU VIES service to validate the provided number.

    Query the online European Commission VAT Information Exchange System
    (VIES) for validity of the provided number. Note that the service has
    usage limitations (see the VIES website for details).

    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-like object.
    ©ÚtimeoutÚverifyNr5   )r9   r	   Ú	vies_wsdlÚcheckVat)r<   rI   rJ   Úclients       r0   Ú
check_viesrN   ƒ   s8   € ô* �V‹_€FÜœY°ÀÔG€FØ�?‰?˜6 " 1˜: v¨a¨b zÓ2Ð2r2   c                ó”   — t        | «      } t        |«      }t        t        ||¬«      }|j                  | dd | dd |dd |dd ¬«      S )a©  Use the EU VIES service to validate the provided number.

    Query the online European Commission VAT Information Exchange System
    (VIES) for validity of the provided number, providing a validity
    certificate as proof. You will need to give your own VAT number for this
    to work. Note that the service has usage limitations (see the VIES
    website for details).

    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-like object.
    rH   Nr5   )ÚcountryCodeÚ	vatNumberÚrequesterCountryCodeÚrequesterVatNumber)r9   r	   rK   ÚcheckVatApprox)r<   Ú	requesterrI   rJ   rM   s        r0   Úcheck_vies_approxrV   �   sa   € ô0 �V‹_€FÜ˜	Ó"€IÜœY°ÀÔG€FØ× Ñ Ø˜2˜A�J¨&°°¨*Ø& r¨˜]¸yÈÈ¸}ð !ó Nð Nr2   )r/   ÚstrÚreturnzNumberValidationModule | None)r<   rW   rX   rW   )r<   rW   rX   rB   )r<   rW   rX   z	list[str])é   T)r<   rW   rI   ÚfloatrJ   ú
bool | strrX   ú%dict[str, str | bool | datetime.date])
r<   rW   rU   rW   rI   rZ   rJ   r[   rX   r\   )Ú__doc__Ú
__future__r   ÚdatetimeÚ	stdnum.eur   Ústdnum.exceptionsÚstdnum.utilr   r   r   r	   Úsetr-   Údictr.   rK   r1   r9   r@   rD   rF   rN   rV   © r2   r0   ú<module>rf      sØ   ðñ,õ( #ã å Ü ÷Có Cñ ò ó €ð
Cñ “6Ð àM€	Ø Aó ó"óóó4ð Øð3Øð3àð3ð ð3ð +ó	3ð: Øð	NØðNàðNð ðNð ð	Nð
 +ôNr2   