Ë
    Ã?ÆiÁ  ã                  óv   — d Z ddlmZ ddlZddl­ ddlmZ  ej                  d«      Zdd„Z	dd„Z
dd	„Zdd
„Zy)aÕ  TIN (Taxpayer Identification Number, Ghana tax number).

This number is issued by the Ghana Revenue Authority (GRA) to individuals who
are not eligible for the Ghanacard PIN and other entities.

This number consists of 11 alphanumeric characters. It begins with one of the
following prefixes:

    P00 For Individuals.
    C00 For Companies limited by guarantee, shares, Unlimited (i.e organisation required to register with the RGD).
    G00 Government Agencies, MDAs.
    Q00 Foreign Missions, Employees of foreign missions.
    V00 Public Institutions, Trusts, Co-operatives, Foreign Shareholder (Offshore), (Entities not registered by RGD).

More information:

* https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Ghana-TIN.pdf
* https://gra.gov.gh/tin/
* https://gra.gov.gh/tin/tin-faq/

>>> validate('C0000803561')
'C0000803561'
>>> validate('C0000803562')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
é    )ÚannotationsN)Ú*)Úcleanz^[PCGQV]{1}00[A-Z0-9]{8}$c                ó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.
    ú )r   Úupper©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/gh/tin.pyÚcompactr   =   s   € ô �˜Ó×#Ñ#Ó%Ð%ó    c                óh   — t        d„ t        | dd «      D «       «      dz  }|dk(  rdS t        |«      S )z&Calculate the check digit for the TIN.c              3  óD   K  — | ]  \  }}|d z   t        |«      z  –— Œ y­w)é   N)Úint)Ú.0ÚiÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>H   s!   è ø€ ÒE¡T Q¨��Q‘œ#˜a›&Õ ÑEùs   ‚ r   é
   é   ÚX)ÚsumÚ	enumerateÚstr)r
   Úchecks     r   Úcalc_check_digitr   F   s7   € äÑE¬Y°v¸aÀ°|Ó-DÔEÓEÈÑJ€EØ˜2’+ˆ3Ð-¤3 u£:Ð-r   c                óÀ   — t        | «      } t        | «      dk7  r
t        «       ‚t        j	                  | «      s
t        «       ‚| d   t        | «      k7  r
t        «       ‚| S )ú)Check if the number is a valid Ghana TIN.r   éÿÿÿÿ)r   ÚlenÚInvalidLengthÚ
_gh_tin_reÚmatchÚInvalidFormatr   ÚInvalidChecksumr	   s    r   Úvalidater'   L   sU   € ä�V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ×Ñ˜FÔ#Ü‹oÐØˆb�zÔ% fÓ-Ò-ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r   F)Úboolr'   ÚValidationErrorr	   s    r   Úis_validr+   X   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡")r
   r   Úreturnr   )r
   r   r,   r)   )Ú__doc__Ú
__future__r   ÚreÚstdnum.exceptionsÚstdnum.utilr   Úcompiler#   r   r   r'   r+   © r   r   ú<module>r4      s?   ðñ,õ8 #ã 	ä Ý ð ˆR�Z‰ZÐ4Ó5€
ó&ó.ó	ôr   