lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.18-9-ga09a7ce

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.18-9-ga09a7ce



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  a09a7ced421453b798e3a3e7a0771d02bbecc396 (commit)
      from  031a24981ad1b3773fcfad7c3a1c11db9da182a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=a09a7ced421453b798e3a3e7a0771d02bbecc396

commit a09a7ced421453b798e3a3e7a0771d02bbecc396
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Mar 18 13:07:32 2023 +0100

    Fix Albanian tax number validation
    
    This extends the description of the Albanian NIPT (NUIS) number with
    information on the structure of the number. The first character was
    previously limited between J and L but this letter indicates a decade
    and the number is also used for individuals to where it indicates a
    birth date.
    
    Thanks Julien Launois for pointing this out.
    
    Source: 
https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Albania-TIN.pdf
    
    Fixes 3db826c
    Closes https://github.com/arthurdejong/python-stdnum/pull/402

diff --git a/stdnum/al/nipt.py b/stdnum/al/nipt.py
index 9091ac7..59e0f7f 100644
--- a/stdnum/al/nipt.py
+++ b/stdnum/al/nipt.py
@@ -1,9 +1,9 @@
-# nipt.py - functions for handling Albanian VAT numbers
+# nipt.py - functions for handling Albanian tax numbers
 # coding: utf-8
 #
 # Copyright (C) 2008-2011 Cédric Krier
 # Copyright (C) 2008-2011 B2CK
-# Copyright (C) 2015 Arthur de Jong
+# Copyright (C) 2015-2023 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -20,10 +20,21 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA
 
-"""NIPT (Numri i Identifikimit për Personin e Tatueshëm, Albanian VAT number).
+"""NIPT, NUIS (Numri i Identifikimit për Personin e Tatueshëm, Albanian tax 
number).
 
 The Albanian NIPT is a 10-digit number with the first and last character
-being letters.
+being letters. The number is assigned to individuals and organisations for
+tax purposes.
+
+The first letter indicates the decade the number was assigned or date birth
+date for individuals, followed by a digit for the year. The next two digits
+contain the month (and gender for individuals and region for organisations)
+followed by two digits for the day of the month. The remainder is a serial
+followed by a check letter (check digit algorithm unknown).
+
+More information:
+
+* https://www.tatime.gov.al/eng/c/4/103/business-lifecycle
 
 >>> validate('AL J 91402501 L')
 'J91402501L'
@@ -46,7 +57,7 @@ from stdnum.util import clean
 
 
 # regular expression for matching number
-_nipt_re = re.compile(r'^[JKL][0-9]{8}[A-Z]$')
+_nipt_re = re.compile(r'^[A-M][0-9]{8}[A-Z]$')
 
 
 def compact(number):
diff --git a/tests/test_al_nipt.doctest b/tests/test_al_nipt.doctest
index 471b432..0c90fb7 100644
--- a/tests/test_al_nipt.doctest
+++ b/tests/test_al_nipt.doctest
@@ -1,6 +1,6 @@
 test_al_nitp.doctest - more detailed doctests stdnum.al.nipt
 
-Copyright (C) 2015-2017 Arthur de Jong
+Copyright (C) 2015-2023 Arthur de Jong
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -30,148 +30,106 @@ 
http://www.qkr.gov.al/kerko/kerko-ne-regjistrin-tregtar/kerko-per-subjekt/
 
 >>> numbers = '''
 ...
-... J 64103842 S
-... J 69102564 M
-... J 78311939 N
-... J 8291 6498 D
-... J 91402501 L
 ... J 98624806 P
-... J61807017B
-... J61826022R
-... J61911008C
+... J61827501H
 ... J61922018S
 ... J61923008Q
-... J62903175S
-... J62903393F
-... J62903470T
-... J62903491S
-... J64103682L
+... J62903770O
 ... J66702410U
+... J67902218L
 ... J67902618M
-... J69405530G
-... J71824003C
-... J72603171B
-... J73706808B
 ... J73721043Q
 ... J74517201G
+... J76418907K
+... J76705047U
 ... J77411245Q
-... J81314004P
-... J81402004E
-... J81508002V
-... J81804001C
+... J78716317H
+... J82916489E
 ... J86526614T
-... J91305001Q
-... J91808007H
-... J92006014W
-... J92917219S
+... J91425005N
 ... J93910409N
 ... K 01725001F
-... K 02727202 O
-... K 11715005 L
-... K 22013001U
+... K 11723003 M
 ... K 37507987 N
-... K 41316001 V
 ... K 41424801 U
 ... K 47905861 R
 ... K 63005203 O
 ... K 67204202 P
-... K 91426008 U
+... K01730502W
 ... K11515001T
-... K11715005L
 ... K12113002H
+... K13001013H
 ... K14019001H
-... K21405003G
 ... K21622001M
 ... K22218003V
-... K26330201T
-... K31404025J
+... K31518077S
 ... K31525146H
 ... K31526056N
-... K31823059I
-... K31929010K
 ... K32203501H
 ... K32801430W
 ... K33714725W
-... K34712418N
 ... K36308746I
 ... K36520204A
-... K42725403f
+... K41315003J
 ... K46621201I
-... K51428013Q
 ... K51518058O
+... K56417201G
 ... K59418208E
-... K61710508W
-... K71903001A
-... K72410014H
-... K81427030E
+... K61617040L
+... K71822006R
+... K72113010E
 ... K81428502L
 ... K81618039O
-... K84508002F
-... K87101202A
+... K82418002C
+... K82612003J
 ... K91725009J
 ... K92402023O
-... L 21721005U
 ... L 22614402 H
-... L01307052Q
-... L01510016S
+... L 62119008 A
 ... L01622006F
-... L01909501I
-... L02003503P
+... L01717030C
 ... L02023501H
 ... L02226012N
-... L02602801H
 ... L03321203G
+... L03929803I
 ... L06426702Q
-... L06524402O
-... L06901403L
-... L06923204C
 ... L07305201K
 ... L08711201I
-... L09110504G
 ... L11325024K
-... L11625013E
 ... L11810502T
-... L11815018A
-... L12003021H
-... L12009010A
-... L12624002J
-... L13020404N
+... L12213005M
 ... L14118803B
-... L14703202P
 ... L21310054D
 ... L21408015A
 ... L21429502L
-... L21508023Q
+... L21906001L
 ... L21923507N
-... L22201021E
-... L22203019C
 ... L22804207O
-... L22825801P
-... L22902002B
 ... L24006002V
-... L24018612J
-... L26311004G
 ... L29616001A
-... L31511019E
-... L31911504A
+... L31518001O
 ... L32210507A
 ... L32319014A
-... L32522401O
-... L33117002J
-... L33318001M
-... L41309075A
-... L41320026E
+... L32622601G
 ... L41410025S
+... L41512005R
 ... L42008005H
 ... L42115015G
-... L42206027K
 ... L42307007E
-... L42710403A
-... L42720201A
 ... L44119601E
-... L46812703Q
 ... L47014204F
 ... L48117101S
+... L52305009L
+... L58428303T
+... L62119008A
+... L72031013B
+... L81506043D
+... L81618040T
+... L82306024Q
+... L98602504L
+... M 02129023 S
+... M 11807013 N
+... M02129023 S
 ...
 ... '''
 >>> [x for x in numbers.splitlines() if x and not nipt.is_valid(x)]

-----------------------------------------------------------------------

Summary of changes:
 stdnum/al/nipt.py          |  21 ++++++--
 tests/test_al_nipt.doctest | 120 +++++++++++++++------------------------------
 2 files changed, 55 insertions(+), 86 deletions(-)


hooks/post-receive
-- 
python-stdnum