[tryton-debian-vcs] vatnumber branch debian created. 5a45959ee792870e57d82b279c61b3b5098319ec
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Wed Nov 27 17:15:19 UTC 2013
The following commit has been merged in the debian branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/vatnumber.git;a=commitdiff;h=5a45959ee792870e57d82b279c61b3b5098319ec
commit 5a45959ee792870e57d82b279c61b3b5098319ec
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Nov 24 19:15:30 2013 +0100
Updating to standards version 3.9.5, no changes needed.
diff --git a/debian/control b/debian/control
index 274fd43..d3f9879 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
Uploaders: Mathias Behrle <mathiasb at m9s.biz>
Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
-Standards-Version: 3.9.4
+Standards-Version: 3.9.5
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://debian.tryton.org/gitweb/?p=packages/vatnumber.git
Vcs-Git: git://debian.tryton.org/packages/vatnumber.git
commit ea8d34c98c98949996903aade0861ed1750ec1b8
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Aug 15 12:36:21 2013 +0200
Releasing debian version 1.1-2.
diff --git a/debian/changelog b/debian/changelog
index b7c69c0..7659213 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+vatnumber (1:1.1-2) unstable; urgency=low
+
+ * Reuploading to unstable with correct changelog.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Thu, 15 Aug 2013 12:30:38 +0200
+
vatnumber (1:1.1-1) unstable; urgency=low
* Merging upstream version 1.1.
commit 394ff8b034b0ba270956d065281e2de217216299
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Aug 15 12:30:19 2013 +0200
Releasing debian version 1.1-1.
diff --git a/debian/changelog b/debian/changelog
index f8f2bfb..b7c69c0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (1:1.1-1) unstable; urgency=low
+
+ * Merging upstream version 1.1.
+ * Updating year in copyright.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Thu, 15 Aug 2013 12:29:11 +0200
+
vatnumber (1:1.0-5) unstable; urgency=low
* Adapting the rules file to work also with git-buildpackage.
commit 9e7c60fc1676a67c0ec25b29b6f5a88da5f25de0
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Aug 15 12:28:14 2013 +0200
Updating year in copyright.
diff --git a/debian/copyright b/debian/copyright
index fb34ba1..965b86f 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -7,7 +7,7 @@ License: GPL-3+
Files: debian/*
Copyright: 2009-2012 Daniel Baumann <daniel at debian.org>
- 2012 Mathias Behrle <mathiasb at m9s.biz>
+ 2012-2013 Mathias Behrle <mathiasb at m9s.biz>
License: GPL-3+
License: GPL-3+
commit 59062fca10872556616ef26ef662cd553c059070
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Aug 15 12:26:22 2013 +0200
Merging upstream version 1.1.
diff --git a/CHANGELOG b/CHANGELOG
index 4ab00db..e24a5fa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+Version 1.1 - 2013-06-01
+* Add Python 3 support
+* Add Check Argentina VAT number
+* Fix check for negative integer
+
Version 1.0 - 2011-09-28
* Fix UK VAT check
* Fix UK VAT 9755 validation
diff --git a/PKG-INFO b/PKG-INFO
index eecea2d..e1b549f 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: vatnumber
-Version: 1.0
+Version: 1.1
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
@@ -37,7 +37,8 @@ Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial :: Accounting
Classifier: Topic :: Software Development :: Internationalization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/setup.py b/setup.py
index e726086..e6d57a6 100644
--- a/setup.py
+++ b/setup.py
@@ -3,34 +3,42 @@
#this repository contains the full copyright notices and license terms.
import os
+import re
from setuptools import setup, find_packages
-import vatnumber
+
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+def get_version():
+ init = read(os.path.join('vatnumber', '__init__.py'))
+ return re.search("__version__ = '([0-9.]*)'", init).group(1)
+
setup(name='vatnumber',
- version=vatnumber.__version__,
- author='B2CK',
- author_email='info at b2ck.com',
- url="http://code.google.com/p/vatnumber/",
- description="Python module to validate VAT numbers",
- long_description=read('README'),
- download_url="http://code.google.com/p/vatnumber/downloads/",
- packages=find_packages(),
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: GNU General Public License (GPL)',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Topic :: Office/Business :: Financial :: Accounting',
- 'Topic :: Software Development :: Internationalization',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- ],
- license='GPL-3',
- extras_require={
- 'suds': ['suds'],
+ version=get_version(),
+ author='B2CK',
+ author_email='info at b2ck.com',
+ url="http://code.google.com/p/vatnumber/",
+ description="Python module to validate VAT numbers",
+ long_description=read('README'),
+ download_url="http://code.google.com/p/vatnumber/downloads/",
+ packages=find_packages(),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: GNU General Public License (GPL)',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 3',
+ 'Topic :: Office/Business :: Financial :: Accounting',
+ 'Topic :: Software Development :: Internationalization',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ],
+ license='GPL-3',
+ extras_require={
+ 'suds': ['suds'],
},
- test_suite="vatnumber.tests",
+ test_suite="vatnumber.tests",
+ use_2to3=True,
)
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index eecea2d..e1b549f 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: vatnumber
-Version: 1.0
+Version: 1.1
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
@@ -37,7 +37,8 @@ Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial :: Accounting
Classifier: Topic :: Software Development :: Internationalization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/vatnumber/__init__.py b/vatnumber/__init__.py
index a11c2fa..c11053c 100644
--- a/vatnumber/__init__.py
+++ b/vatnumber/__init__.py
@@ -6,18 +6,27 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '1.0'
-VIES_URL='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'
+__version__ = '1.1'
+VIES_URL = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'
+
+
+def _posint(x):
+ value = int(x)
+ if value < 0:
+ raise ValueError('not a positive integer')
+ return value
+
def countries():
'''
Return the list of country's codes that have check function
'''
res = [x.replace('check_vat_', '').upper() for x in globals()
- if x.startswith('check_vat_')]
+ if x.startswith('check_vat_')]
res.sort()
return res
+
def mult_add(i, j):
'''
Sum each digits of the multiplication of i and j.
@@ -28,6 +37,7 @@ def mult_add(i, j):
res += int(str(mult)[i])
return res
+
def mod1110(value):
'''
Compute ISO 7064, Mod 11,10
@@ -38,6 +48,7 @@ def mod1110(value):
t = (2 * ((t + c) % 10 or 10)) % 11
return (11 - t) % 10
+
def check_vat_at(vat):
'''
Check Austria VAT number.
@@ -48,13 +59,13 @@ def check_vat_at(vat):
return False
num = vat[1:]
try:
- int(num)
+ _posint(num)
except ValueError:
return False
check_sum = int(num[0]) + mult_add(2, int(num[1])) + \
- int(num[2]) + mult_add(2, int(num[3])) + \
- int(num[4]) + mult_add(2, int(num[5])) + \
- int(num[6])
+ int(num[2]) + mult_add(2, int(num[3])) + \
+ int(num[4]) + mult_add(2, int(num[5])) + \
+ int(num[6])
check = 10 - ((check_sum + 4) % 10)
if check == 10:
check = 0
@@ -62,6 +73,7 @@ def check_vat_at(vat):
return False
return True
+
def check_vat_al(vat):
'''
Check Albania VAT number.
@@ -71,13 +83,32 @@ def check_vat_al(vat):
if vat[0] not in ('J', 'K'):
return False
try:
- int(vat[1:9])
+ _posint(vat[1:9])
except ValueError:
return False
if ord(vat[9]) < 65 or ord(vat[9]) > 90:
return False
return True
+
+def check_vat_ar(vat):
+ '''
+ Check Argentina VAT number.
+ '''
+ if len(vat) != 11:
+ return False
+ base = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]
+ aux = 0
+ for i in xrange(10):
+ aux += int(vat[i]) * base[i]
+ aux = 11 - (aux - (int(aux / 11) * 11))
+ if aux == 11:
+ aux = 0
+ if aux == 10:
+ aux = 9
+ return aux == int(vat[10])
+
+
def check_vat_be(vat):
'''
Check Belgium VAT number.
@@ -87,7 +118,7 @@ def check_vat_be(vat):
if vat[0] != '0':
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[-2:]) != \
@@ -95,6 +126,7 @@ def check_vat_be(vat):
return False
return True
+
def check_vat_bg(vat):
'''
Check Bulgaria VAT number.
@@ -105,15 +137,15 @@ def check_vat_bg(vat):
if len(vat) != 10:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0]) in (2, 3) and \
int(vat[1:2]) != 22:
return False
check_sum = 4 * int(vat[0]) + 3 * int(vat[1]) + 2 * int(vat[2]) + \
- 7 * int(vat[3]) + 6 * int(vat[4]) + 5 * int(vat[5]) + \
- 4 * int(vat[6]) + 3 * int(vat[7]) + 2 * int(vat[8])
+ 7 * int(vat[3]) + 6 * int(vat[4]) + 5 * int(vat[5]) + \
+ 4 * int(vat[6]) + 3 * int(vat[7]) + 2 * int(vat[8])
check = 11 - (check_sum % 11)
if check == 11:
check = 0
@@ -123,12 +155,13 @@ def check_vat_bg(vat):
return False
return True
+
def check_vat_cl(rut):
'''
Check Chile RUT number.
'''
try:
- int(rut[:-1])
+ _posint(rut[:-1])
except ValueError:
return False
sum = 0
@@ -142,6 +175,7 @@ def check_vat_cl(rut):
else:
return check == int(rut[-1])
+
def check_vat_co(rut):
'''
Check Colombian RUT number.
@@ -149,17 +183,18 @@ def check_vat_co(rut):
if len(rut) != 10:
return False
try:
- int(rut)
+ _posint(rut)
except ValueError:
return False
nums = [3, 7, 13, 17, 19, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71]
sum = 0
- for i in range (len(rut) - 2, -1, -1):
+ for i in range(len(rut) - 2, -1, -1):
sum += int(rut[i]) * nums[len(rut) - 2 - i]
if sum % 11 > 1:
- return int(rut[-1]) == 11 - (sum % 11)
+ return int(rut[-1]) == 11 - (sum % 11)
else:
- return int(rut[-1]) == sum % 11
+ return int(rut[-1]) == sum % 11
+
def check_vat_cy(vat):
'''
@@ -168,7 +203,7 @@ def check_vat_cy(vat):
if len(vat) != 9:
return False
try:
- int(vat[:8])
+ _posint(vat[:8])
except ValueError:
return False
num0 = int(vat[0])
@@ -204,6 +239,7 @@ def check_vat_cy(vat):
return False
return True
+
def check_vat_cz(vat):
'''
Check Czech Republic VAT number.
@@ -211,7 +247,7 @@ def check_vat_cz(vat):
if len(vat) not in (8, 9, 10):
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
@@ -219,8 +255,8 @@ def check_vat_cz(vat):
if int(vat[0]) not in (0, 1, 2, 3, 4, 5, 6, 7, 8):
return False
check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
- 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
- 2 * int(vat[6])
+ 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
+ 2 * int(vat[6])
check = 11 - (check_sum % 11)
if check == 10:
check = 0
@@ -230,8 +266,8 @@ def check_vat_cz(vat):
return False
elif len(vat) == 9 and int(vat[0]) == 6:
check_sum = 8 * int(vat[1]) + 7 * int(vat[2]) + 6 * int(vat[3]) + \
- 5 * int(vat[4]) + 4 * int(vat[5]) + 3 * int(vat[6]) + \
- 2 * int(vat[7])
+ 5 * int(vat[4]) + 4 * int(vat[5]) + 3 * int(vat[6]) + \
+ 2 * int(vat[7])
check = 9 - ((11 - (check_sum % 11)) % 10)
if check != int(vat[8]):
return False
@@ -301,6 +337,7 @@ def check_vat_cz(vat):
return False
return True
+
def check_vat_de(vat):
'''
Check Germany VAT number.
@@ -308,7 +345,7 @@ def check_vat_de(vat):
if len(vat) != 9:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0:7]) <= 0:
@@ -323,6 +360,7 @@ def check_vat_de(vat):
return False
return True
+
def check_vat_dk(vat):
'''
Check Denmark VAT number.
@@ -330,18 +368,19 @@ def check_vat_dk(vat):
if len(vat) != 8:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0]) <= 0:
return False
check_sum = 2 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
- 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
- 2 * int(vat[6]) + int(vat[7])
+ 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
+ 2 * int(vat[6]) + int(vat[7])
if check_sum % 11 != 0:
return False
return True
+
def check_vat_ee(vat):
'''
Check Estonia VAT number.
@@ -349,12 +388,12 @@ def check_vat_ee(vat):
if len(vat) != 9:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
check_sum = 3 * int(vat[0]) + 7 * int(vat[1]) + 1 * int(vat[2]) + \
- 3 * int(vat[3]) + 7 * int(vat[4]) + 1 * int(vat[5]) + \
- 3 * int(vat[6]) + 7 * int(vat[7])
+ 3 * int(vat[3]) + 7 * int(vat[4]) + 1 * int(vat[5]) + \
+ 3 * int(vat[6]) + 7 * int(vat[7])
check = 10 - (check_sum % 10)
if check == 10:
check = 0
@@ -362,6 +401,7 @@ def check_vat_ee(vat):
return False
return True
+
def check_vat_es(vat):
'''
Check Spain VAT number.
@@ -397,13 +437,13 @@ def check_vat_es(vat):
if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'U', 'V'):
try:
- int(vat[1:])
+ _posint(vat[1:])
except ValueError:
return False
check_sum = mult_add(2, int(vat[1])) + int(vat[2]) + \
- mult_add(2, int(vat[3])) + int(vat[4]) + \
- mult_add(2, int(vat[5])) + int(vat[6]) + \
- mult_add(2, int(vat[7]))
+ mult_add(2, int(vat[3])) + int(vat[4]) + \
+ mult_add(2, int(vat[5])) + int(vat[6]) + \
+ mult_add(2, int(vat[7]))
check = 10 - (check_sum % 10)
if check == 10:
check = 0
@@ -412,13 +452,13 @@ def check_vat_es(vat):
return True
elif vat[0] in ('N', 'P', 'Q', 'R', 'S', 'W'):
try:
- int(vat[1:8])
+ _posint(vat[1:8])
except ValueError:
return False
check_sum = mult_add(2, int(vat[1])) + int(vat[2]) + \
- mult_add(2, int(vat[3])) + int(vat[4]) + \
- mult_add(2, int(vat[5])) + int(vat[6]) + \
- mult_add(2, int(vat[7]))
+ mult_add(2, int(vat[3])) + int(vat[4]) + \
+ mult_add(2, int(vat[5])) + int(vat[6]) + \
+ mult_add(2, int(vat[7]))
check = 10 - (check_sum % 10)
check = chr(check + 64)
if check != vat[8]:
@@ -433,7 +473,7 @@ def check_vat_es(vat):
check_value = vat[1:8]
try:
- int(check_value)
+ _posint(check_value)
except ValueError:
return False
check = 1 + (int(check_value) % 23)
@@ -444,7 +484,7 @@ def check_vat_es(vat):
return True
else:
try:
- int(vat[:8])
+ _posint(vat[:8])
except ValueError:
return False
check = 1 + (int(vat[:8]) % 23)
@@ -454,6 +494,7 @@ def check_vat_es(vat):
return False
return True
+
def check_vat_fi(vat):
'''
Check Finland VAT number.
@@ -461,12 +502,12 @@ def check_vat_fi(vat):
if len(vat) != 8:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
check_sum = 7 * int(vat[0]) + 9 * int(vat[1]) + 10 * int(vat[2]) + \
- 5 * int(vat[3]) + 8 * int(vat[4]) + 4 * int(vat[5]) + \
- 2 * int(vat[6])
+ 5 * int(vat[3]) + 8 * int(vat[4]) + 4 * int(vat[5]) + \
+ 2 * int(vat[6])
check = 11 - (check_sum % 11)
if check == 11:
check = 0
@@ -476,6 +517,7 @@ def check_vat_fi(vat):
return False
return True
+
def check_vat_fr(vat):
'''
Check France VAT number.
@@ -484,13 +526,13 @@ def check_vat_fr(vat):
return False
try:
- int(vat[2:11])
+ _posint(vat[2:11])
except ValueError:
return False
system = None
try:
- int(vat[0:2])
+ _posint(vat[0:2])
system = 'old'
except ValueError:
system = 'new'
@@ -523,6 +565,7 @@ def check_vat_fr(vat):
return False
return True
+
def check_vat_gb(vat):
'''
Check United Kingdom VAT number.
@@ -530,7 +573,7 @@ def check_vat_gb(vat):
if len(vat) == 5:
try:
- int(vat[2:5])
+ _posint(vat[2:5])
except ValueError:
return False
@@ -546,7 +589,7 @@ def check_vat_gb(vat):
elif len(vat) == 11 \
and vat[0:6] in ('GD8888', 'HA8888'):
try:
- int(vat[6:11])
+ _posint(vat[6:11])
except ValueError:
return False
if vat[0:2] == 'GD' \
@@ -561,7 +604,7 @@ def check_vat_gb(vat):
elif len(vat) in (12, 13) \
and vat[0:3] in ('000', '001'):
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
@@ -573,14 +616,14 @@ def check_vat_gb(vat):
return False
check_sum = 8 * int(vat[3]) + 7 * int(vat[4]) + 6 * int(vat[5]) + \
- 5 * int(vat[6]) + 4 * int(vat[7]) + 3 * int(vat[8]) + \
- 2 * int(vat[9]) + 10 * int(vat[10]) + int(vat[11])
+ 5 * int(vat[6]) + 4 * int(vat[7]) + 3 * int(vat[8]) + \
+ 2 * int(vat[9]) + 10 * int(vat[10]) + int(vat[11])
if check_sum % 97 != 0:
return False
return True
elif len(vat) in (9, 10, 12):
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
@@ -592,8 +635,8 @@ def check_vat_gb(vat):
return False
check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
- 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
- 2 * int(vat[6]) + 10 * int(vat[7]) + int(vat[8])
+ 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
+ 2 * int(vat[6]) + 10 * int(vat[7]) + int(vat[8])
if int(vat[0:3]) >= 100:
if check_sum % 97 not in (0, 55, 42):
return False
@@ -603,18 +646,19 @@ def check_vat_gb(vat):
return True
return False
+
def check_vat_gr(vat):
'''
Check Greece VAT number.
'''
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if len(vat) == 8:
check_sum = 128 * int(vat[0]) + 64 * int(vat[1]) + 32 * int(vat[2]) + \
- 16 * int(vat[3]) + 8 * int(vat[4]) + 4 * int(vat[5]) + \
- 2 * int(vat[6])
+ 16 * int(vat[3]) + 8 * int(vat[4]) + 4 * int(vat[5]) + \
+ 2 * int(vat[6])
check = check_sum % 11
if check == 10:
check = 0
@@ -622,9 +666,9 @@ def check_vat_gr(vat):
return False
return True
elif len(vat) == 9:
- check_sum = 256 * int(vat[0]) + 128 * int(vat[1]) + 64 * int(vat[2]) + \
- 32 * int(vat[3]) + 16 * int(vat[4]) + 8 * int(vat[5]) + \
- 4 * int(vat[6]) + 2 * int(vat[7])
+ check_sum = 256 * int(vat[0]) + 128 * int(vat[1]) + 64 * int(vat[2]) +\
+ 32 * int(vat[3]) + 16 * int(vat[4]) + 8 * int(vat[5]) + \
+ 4 * int(vat[6]) + 2 * int(vat[7])
check = check_sum % 11
if check == 10:
check = 0
@@ -633,12 +677,14 @@ def check_vat_gr(vat):
return True
return False
+
def check_vat_el(vat):
'''
Check Greece VAT number.
'''
return check_vat_gr(vat)
+
def check_vat_hr(vat):
'''
Check Croatia VAT number.
@@ -646,7 +692,7 @@ def check_vat_hr(vat):
if len(vat) != 11:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
check = mod1110(vat[:-1])
@@ -654,6 +700,7 @@ def check_vat_hr(vat):
return False
return True
+
def check_vat_hu(vat):
'''
Check Hungary VAT number.
@@ -661,14 +708,14 @@ def check_vat_hu(vat):
if len(vat) != 8:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0]) <= 0:
return False
check_sum = 9 * int(vat[0]) + 7 * int(vat[1]) + 3 * int(vat[2]) + \
- 1 * int(vat[3]) + 9 * int(vat[4]) + 7 * int(vat[5]) + \
- 3 * int(vat[6])
+ 1 * int(vat[3]) + 9 * int(vat[4]) + 7 * int(vat[5]) + \
+ 3 * int(vat[6])
check = 10 - (check_sum % 10)
if check == 10:
check = 0
@@ -676,6 +723,7 @@ def check_vat_hu(vat):
return False
return True
+
def check_vat_ie(vat):
'''
Check Ireland VAT number.
@@ -685,8 +733,8 @@ def check_vat_ie(vat):
if (ord(vat[1]) >= 65 and ord(vat[1]) <= 90) \
or vat[1] in ('+', '*'):
try:
- int(vat[0])
- int(vat[2:7])
+ _posint(vat[0])
+ _posint(vat[2:7])
except ValueError:
return False
@@ -694,7 +742,7 @@ def check_vat_ie(vat):
return False
check_sum = 7 * int(vat[2]) + 6 * int(vat[3]) + 5 * int(vat[4]) + \
- 4 * int(vat[5]) + 3 * int(vat[6]) + 2 * int(vat[0])
+ 4 * int(vat[5]) + 3 * int(vat[6]) + 2 * int(vat[0])
check = check_sum % 23
if check == 0:
check = 'W'
@@ -705,13 +753,13 @@ def check_vat_ie(vat):
return True
else:
try:
- int(vat[0:7])
+ _posint(vat[0:7])
except ValueError:
return False
check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
- 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
- 2 * int(vat[6])
+ 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
+ 2 * int(vat[6])
check = check_sum % 23
if check == 0:
check = 'W'
@@ -721,6 +769,7 @@ def check_vat_ie(vat):
return False
return True
+
def check_vat_it(vat):
'''
Check Italy VAT number.
@@ -728,7 +777,7 @@ def check_vat_it(vat):
if len(vat) != 11:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0:7]) <= 0:
@@ -738,10 +787,10 @@ def check_vat_it(vat):
return False
check_sum = int(vat[0]) + mult_add(2, int(vat[1])) + int(vat[2]) + \
- mult_add(2, int(vat[3])) + int(vat[4]) + \
- mult_add(2, int(vat[5])) + int(vat[6]) + \
- mult_add(2, int(vat[7])) + int(vat[8]) + \
- mult_add(2, int(vat[9]))
+ mult_add(2, int(vat[3])) + int(vat[4]) + \
+ mult_add(2, int(vat[5])) + int(vat[6]) + \
+ mult_add(2, int(vat[7])) + int(vat[8]) + \
+ mult_add(2, int(vat[9]))
check = 10 - (check_sum % 10)
if check == 10:
check = 0
@@ -749,12 +798,13 @@ def check_vat_it(vat):
return False
return True
+
def check_vat_lt(vat):
'''
Check Lithuania VAT number.
'''
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
@@ -762,12 +812,12 @@ def check_vat_lt(vat):
if int(vat[7]) != 1:
return False
check_sum = 1 * int(vat[0]) + 2 * int(vat[1]) + 3 * int(vat[2]) + \
- 4 * int(vat[3]) + 5 * int(vat[4]) + 6 * int(vat[5]) + \
- 7 * int(vat[6]) + 8 * int(vat[7])
+ 4 * int(vat[3]) + 5 * int(vat[4]) + 6 * int(vat[5]) + \
+ 7 * int(vat[6]) + 8 * int(vat[7])
if check_sum % 11 == 10:
check_sum = 3 * int(vat[0]) + 4 * int(vat[1]) + 5 * int(vat[2]) + \
- 6 * int(vat[3]) + 7 * int(vat[4]) + 8 * int(vat[5]) + \
- 9 * int(vat[6]) + 1 * int(vat[7])
+ 6 * int(vat[3]) + 7 * int(vat[4]) + 8 * int(vat[5]) + \
+ 9 * int(vat[6]) + 1 * int(vat[7])
check = check_sum % 11
if check == 10:
check = 0
@@ -778,14 +828,14 @@ def check_vat_lt(vat):
if int(vat[10]) != 1:
return False
check_sum = 1 * int(vat[0]) + 2 * int(vat[1]) + 3 * int(vat[2]) + \
- 4 * int(vat[3]) + 5 * int(vat[4]) + 6 * int(vat[5]) + \
- 7 * int(vat[6]) + 8 * int(vat[7]) + 9 * int(vat[8]) + \
- 1 * int(vat[9]) + 2 * int(vat[10])
+ 4 * int(vat[3]) + 5 * int(vat[4]) + 6 * int(vat[5]) + \
+ 7 * int(vat[6]) + 8 * int(vat[7]) + 9 * int(vat[8]) + \
+ 1 * int(vat[9]) + 2 * int(vat[10])
if check_sum % 11 == 10:
check_sum = 3 * int(vat[0]) + 4 * int(vat[1]) + 5 * int(vat[2]) + \
- 6 * int(vat[3]) + 7 * int(vat[4]) + 8 * int(vat[5]) + \
- 9 * int(vat[6]) + 1 * int(vat[7]) + 2 * int(vat[8]) + \
- 3 * int(vat[9]) + 4 * int(vat[10])
+ 6 * int(vat[3]) + 7 * int(vat[4]) + 8 * int(vat[5]) + \
+ 9 * int(vat[6]) + 1 * int(vat[7]) + 2 * int(vat[8]) + \
+ 3 * int(vat[9]) + 4 * int(vat[10])
check = check_sum % 11
if check == 10:
check = 0
@@ -794,6 +844,7 @@ def check_vat_lt(vat):
return True
return False
+
def check_vat_lu(vat):
'''
Check Luxembourg VAT number.
@@ -801,7 +852,7 @@ def check_vat_lu(vat):
if len(vat) != 8:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0:6]) <= 0:
@@ -811,6 +862,7 @@ def check_vat_lu(vat):
return False
return True
+
def check_vat_lv(vat):
'''
Check Latvia VAT number.
@@ -818,14 +870,14 @@ def check_vat_lv(vat):
if len(vat) != 11:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0]) >= 4:
check_sum = 9 * int(vat[0]) + 1 * int(vat[1]) + 4 * int(vat[2]) + \
- 8 * int(vat[3]) + 3 * int(vat[4]) + 10 * int(vat[5]) + \
- 2 * int(vat[6]) + 5 * int(vat[7]) + 7 * int(vat[8]) + \
- 6 * int(vat[9])
+ 8 * int(vat[3]) + 3 * int(vat[4]) + 10 * int(vat[5]) + \
+ 2 * int(vat[6]) + 5 * int(vat[7]) + 7 * int(vat[8]) + \
+ 6 * int(vat[9])
if check_sum % 11 == 4 and int(vat[0]) == 9:
check_sum = check_sum - 45
if check_sum % 11 == 4:
@@ -854,6 +906,7 @@ def check_vat_lv(vat):
return False
return True
+
def check_vat_mt(vat):
'''
Check Malta VAT number.
@@ -861,7 +914,7 @@ def check_vat_mt(vat):
if len(vat) != 8:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
@@ -869,12 +922,13 @@ def check_vat_mt(vat):
return False
check_sum = 3 * int(vat[0]) + 4 * int(vat[1]) + 6 * int(vat[2]) + \
- 7 * int(vat[3]) + 8 * int(vat[4]) + 9 * int(vat[5])
+ 7 * int(vat[3]) + 8 * int(vat[4]) + 9 * int(vat[5])
check = 37 - (check_sum % 37)
if check != int(vat[6:8]):
return False
return True
+
def check_vat_nl(vat):
'''
Check Netherlands VAT number.
@@ -882,8 +936,8 @@ def check_vat_nl(vat):
if len(vat) != 12:
return False
try:
- int(vat[0:9])
- int(vat[10:12])
+ _posint(vat[0:9])
+ _posint(vat[10:12])
except ValueError:
return False
if int(vat[0:8]) <= 0:
@@ -892,8 +946,8 @@ def check_vat_nl(vat):
return False
check_sum = 9 * int(vat[0]) + 8 * int(vat[1]) + 7 * int(vat[2]) + \
- 6 * int(vat[3]) + 5 * int(vat[4]) + 4 * int(vat[5]) + \
- 3 * int(vat[6]) + 2 * int(vat[7])
+ 6 * int(vat[3]) + 5 * int(vat[4]) + 4 * int(vat[5]) + \
+ 3 * int(vat[6]) + 2 * int(vat[7])
check = check_sum % 11
if check == 10:
@@ -902,6 +956,7 @@ def check_vat_nl(vat):
return False
return True
+
def check_vat_pl(vat):
'''
Check Poland VAT number.
@@ -909,13 +964,13 @@ def check_vat_pl(vat):
if len(vat) != 10:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
check_sum = 6 * int(vat[0]) + 5 * int(vat[1]) + 7 * int(vat[2]) + \
- 2 * int(vat[3]) + 3 * int(vat[4]) + 4 * int(vat[5]) + \
- 5 * int(vat[6]) + 6 * int(vat[7]) + 7 * int(vat[8])
+ 2 * int(vat[3]) + 3 * int(vat[4]) + 4 * int(vat[5]) + \
+ 5 * int(vat[6]) + 6 * int(vat[7]) + 7 * int(vat[8])
check = check_sum % 11
if check == 10:
return False
@@ -923,6 +978,7 @@ def check_vat_pl(vat):
return False
return True
+
def check_vat_pt(vat):
'''
Check Portugal VAT number.
@@ -930,7 +986,7 @@ def check_vat_pt(vat):
if len(vat) != 9:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
@@ -938,8 +994,8 @@ def check_vat_pt(vat):
return False
check_sum = 9 * int(vat[0]) + 8 * int(vat[1]) + 7 * int(vat[2]) + \
- 6 * int(vat[3]) + 5 * int(vat[4]) + 4 * int(vat[5]) + \
- 3 * int(vat[6]) + 2 * int(vat[7])
+ 6 * int(vat[3]) + 5 * int(vat[4]) + 4 * int(vat[5]) + \
+ 3 * int(vat[6]) + 2 * int(vat[7])
check = 11 - (check_sum % 11)
if check == 10 or check == 11:
check = 0
@@ -947,20 +1003,21 @@ def check_vat_pt(vat):
return False
return True
+
def check_vat_ro(vat):
'''
Check Romania VAT number.
'''
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if len(vat) >= 2 and len(vat) <= 10:
vat = (10 - len(vat)) * '0' + vat
check_sum = 7 * int(vat[0]) + 5 * int(vat[1]) + 3 * int(vat[2]) + \
- 2 * int(vat[3]) + 1 * int(vat[4]) + 7 * int(vat[5]) + \
- 5 * int(vat[6]) + 3 * int(vat[7]) + 2 * int(vat[8])
+ 2 * int(vat[3]) + 1 * int(vat[4]) + 7 * int(vat[5]) + \
+ 5 * int(vat[6]) + 3 * int(vat[7]) + 2 * int(vat[8])
check = (check_sum * 10) % 11
if check == 10:
check = 0
@@ -986,9 +1043,9 @@ def check_vat_ro(vat):
return False
check_sum = 2 * int(vat[0]) + 7 * int(vat[1]) + 9 * int(vat[2]) + \
- 1 * int(vat[3]) + 4 * int(vat[4]) + 6 * int(vat[5]) + \
- 3 * int(vat[6]) + 5 * int(vat[7]) + 8 * int(vat[8]) + \
- 2 * int(vat[9]) + 7 * int(vat[10]) + 9 * int(vat[11])
+ 1 * int(vat[3]) + 4 * int(vat[4]) + 6 * int(vat[5]) + \
+ 3 * int(vat[6]) + 5 * int(vat[7]) + 8 * int(vat[8]) + \
+ 2 * int(vat[9]) + 7 * int(vat[10]) + 9 * int(vat[11])
check = check_sum % 11
if check == 10:
check = 1
@@ -997,6 +1054,7 @@ def check_vat_ro(vat):
return True
return False
+
def check_vat_se(vat):
'''
Check Sweden VAT number.
@@ -1004,17 +1062,17 @@ def check_vat_se(vat):
if len(vat) != 12:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[10:12]) <= 0:
return False
check_sum = mult_add(2, int(vat[0])) + int(vat[1]) + \
- mult_add(2, int(vat[2])) + int(vat[3]) + \
- mult_add(2, int(vat[4])) + int(vat[5]) + \
- mult_add(2, int(vat[6])) + int(vat[7]) + \
- mult_add(2, int(vat[8]))
+ mult_add(2, int(vat[2])) + int(vat[3]) + \
+ mult_add(2, int(vat[4])) + int(vat[5]) + \
+ mult_add(2, int(vat[6])) + int(vat[7]) + \
+ mult_add(2, int(vat[8]))
check = 10 - (check_sum % 10)
if check == 10:
check = 0
@@ -1022,6 +1080,7 @@ def check_vat_se(vat):
return False
return True
+
def check_vat_si(vat):
'''
Check Slovenia VAT number.
@@ -1029,15 +1088,15 @@ def check_vat_si(vat):
if len(vat) != 8:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if int(vat[0:7]) <= 999999:
return False
check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
- 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
- 2 * int(vat[6])
+ 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
+ 2 * int(vat[6])
check = 11 - (check_sum % 11)
if check == 10:
check = 0
@@ -1047,12 +1106,13 @@ def check_vat_si(vat):
return False
return True
+
def check_vat_sk(vat):
'''
Check Slovakia VAT number.
'''
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if len(vat) not in(9, 10):
@@ -1066,7 +1126,7 @@ def check_vat_sk(vat):
return False
if len(vat) == 9:
- if int(vat[0:2]) > 53 :
+ if int(vat[0:2]) > 53:
return False
if int(vat[2:4]) < 1:
@@ -1090,6 +1150,7 @@ def check_vat_sk(vat):
return False
return True
+
def check_vat_sm(vat):
'''
Check San Marino VAT number.
@@ -1097,11 +1158,12 @@ def check_vat_sm(vat):
if len(vat) != 5:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
return True
+
def check_vat_ua(vat):
'''
Check Ukraine VAT number.
@@ -1109,17 +1171,19 @@ def check_vat_ua(vat):
if len(vat) != 8:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
return True
+
def check_vat_uk(vat):
'''
Check United Kingdom VAT number.
'''
return check_vat_gb(vat)
+
def check_vat_ru(vat):
'''
Check Russia VAT number.
@@ -1127,35 +1191,36 @@ def check_vat_ru(vat):
if len(vat) != 10 and len(vat) != 12:
return False
try:
- int(vat)
+ _posint(vat)
except ValueError:
return False
if len(vat) == 10:
check_sum = 2 * int(vat[0]) + 4 * int(vat[1]) + 10 * int(vat[2]) + \
- 3 * int(vat[3]) + 5 * int(vat[4]) + 9 * int(vat[5]) + \
- 4 * int(vat[6]) + 6 * int(vat[7]) + 8 * int(vat[8])
+ 3 * int(vat[3]) + 5 * int(vat[4]) + 9 * int(vat[5]) + \
+ 4 * int(vat[6]) + 6 * int(vat[7]) + 8 * int(vat[8])
check = check_sum % 11
if check % 10 != int(vat[9]):
return False
else:
check_sum1 = 7 * int(vat[0]) + 2 * int(vat[1]) + 4 * int(vat[2]) + \
- 10 * int(vat[3]) + 3 * int(vat[4]) + 5 * int(vat[5]) + \
- 9 * int(vat[6]) + 4 * int(vat[7]) + 6 * int(vat[8]) + \
- 8 * int(vat[9])
+ 10 * int(vat[3]) + 3 * int(vat[4]) + 5 * int(vat[5]) + \
+ 9 * int(vat[6]) + 4 * int(vat[7]) + 6 * int(vat[8]) + \
+ 8 * int(vat[9])
check = check_sum1 % 11
if check != int(vat[10]):
return False
check_sum2 = 3 * int(vat[0]) + 7 * int(vat[1]) + 2 * int(vat[2]) + \
- 4 * int(vat[3]) + 10 * int(vat[4]) + 3 * int(vat[5]) + \
- 5 * int(vat[6]) + 9 * int(vat[7]) + 4 * int(vat[8]) + \
- 6 * int(vat[9]) + 8 * int(vat[10])
+ 4 * int(vat[3]) + 10 * int(vat[4]) + 3 * int(vat[5]) + \
+ 5 * int(vat[6]) + 9 * int(vat[7]) + 4 * int(vat[8]) + \
+ 6 * int(vat[9]) + 8 * int(vat[10])
check = check_sum2 % 11
if check != int(vat[11]):
return False
return True
+
def check_vat(vat):
'''
Check VAT number.
@@ -1168,6 +1233,7 @@ def check_vat(vat):
return False
return checker(number)
+
def check_vies(vat):
'''
Check VAT number for EU member state using the SOAP Service
diff --git a/vatnumber/tests.py b/vatnumber/tests.py
index 0fa5fb8..d05a450 100644
--- a/vatnumber/tests.py
+++ b/vatnumber/tests.py
@@ -19,6 +19,8 @@ VAT_NUMBERS = [
('AL', 'AA9999999L', False),
('AL', 'KA9999999L', False),
('AL', 'K999999991', False),
+ ('AR', '00000000000', True),
+ ('AR', '00000000001', False),
('BE', '0123456749', True),
('BE', '0897290877', True),
('BE', '01234567490', False),
@@ -162,6 +164,7 @@ VAT_NUMBERS = [
('RO', '24736200', True),
('RO', '1234567897', True),
('RO', '1630615123457', True),
+ ('RO', '-7793957', False),
('RU', '5505035011', True),
('RU', '550501929014', True),
('SE', '123456789701', True),
@@ -193,7 +196,7 @@ class VatNumberTest(unittest.TestCase):
'''
for code, number, result in VAT_NUMBERS:
if result:
- test = self.assert_
+ test = self.assertTrue
else:
test = self.assertFalse
test(vatnumber.check_vat(code + number), code + number)
commit 62f8a39b779c6252149a1d60606fe2072f286de6
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Aug 6 16:21:20 2013 +0200
Releasing debian version 1.0-5.
diff --git a/debian/changelog b/debian/changelog
index 1cd6a1b..f8f2bfb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+vatnumber (1:1.0-5) unstable; urgency=low
+
+ * Adapting the rules file to work also with git-buildpackage.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Tue, 06 Aug 2013 13:33:57 +0200
+
vatnumber (1:1.0-4) unstable; urgency=low
* Removing Daniel from Uploaders. Thanks for your work! (Closes: #704411).
commit 46e5e127f2f4ba3563030c8be4c9b712b768e96a
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Aug 5 18:12:00 2013 +0200
Adapting the rules file to work also with git-buildpackage.
diff --git a/debian/rules b/debian/rules
index b918925..63f539a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,11 +1,23 @@
#!/usr/bin/make -f
+PACKAGE_NAME := $(shell python setup.py --name)
+
%:
dh ${@} --with python2
override_dh_auto_clean:
dh_auto_clean
+
+override_dh_auto_build:
+ mv $(PACKAGE_NAME).egg-info $(PACKAGE_NAME).hen-info
+ mv PKG-INFO PKG-INFO.hen
+ dh_auto_build
+
+override_dh_auto_install:
+ dh_auto_install
rm -rf *.egg-info
+ mv $(PACKAGE_NAME).hen-info $(PACKAGE_NAME).egg-info
+ mv PKG-INFO.hen PKG-INFO
override_dh_builddeb:
dh_builddeb -- -Zxz -z9
commit ae88e8bcbac47bb86b38b74cb9c43e4ef4762e6e
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri May 31 20:26:48 2013 +0200
Releasing debian version 1.0-4.
diff --git a/debian/changelog b/debian/changelog
index bddd5a4..1cd6a1b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (1:1.0-4) unstable; urgency=low
+
+ * Removing Daniel from Uploaders. Thanks for your work! (Closes: #704411).
+ * Removing needless empty line in rules.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Fri, 31 May 2013 15:11:59 +0200
+
vatnumber (1:1.0-3) experimental; urgency=low
* Removing obsolete Dm-Upload-Allowed
commit e1f304814baa5ef29b01765f8dc236df8fcf781c
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed May 29 17:19:30 2013 +0200
Removing needless empty line in rules.
diff --git a/debian/rules b/debian/rules
index 1ae0776..b918925 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,7 +5,6 @@
override_dh_auto_clean:
dh_auto_clean
-
rm -rf *.egg-info
override_dh_builddeb:
commit 0982e064821d78541a79056dfa5ebbc2e567840e
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Apr 21 23:42:45 2013 +0200
Removing Daniel from Uploaders. Thanks for your work! (Closes: #704411).
diff --git a/debian/control b/debian/control
index 3bbad2b..274fd43 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: vatnumber
Section: python
Priority: optional
Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
-Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
+Uploaders: Mathias Behrle <mathiasb at m9s.biz>
Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
Standards-Version: 3.9.4
Homepage: http://code.google.com/p/vatnumber/
commit 7669580671b67c8fdafab134151deade5df238ed
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Feb 24 15:06:43 2013 +0100
Releasing debian version 1.0-3.
diff --git a/debian/changelog b/debian/changelog
index b0ff12f..bddd5a4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+vatnumber (1:1.0-3) experimental; urgency=low
+
+ * Removing obsolete Dm-Upload-Allowed
+ * Updating to Standards-Version: 3.9.4, no changes needed.
+ * Updating Vcs-Git to correct address.
+ * Adding watch file.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Sun, 24 Feb 2013 14:26:06 +0100
+
vatnumber (1:1.0-2) unstable; urgency=low
[ Mathias Behrle ]
commit 295680bb13426cb1c090af5f334704faf93ccd53
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Feb 24 14:01:20 2013 +0100
Adding watch file.
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..c490add
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=3
+http://code.google.com/p/vatnumber/downloads/list?can=1 .*/vatnumber-(\d[\d.]*)\.(?:zip|tgz|tbz2|txz|tar\.gz|tar\.bz2|tar\.xz)
+https://pypi.python.org/packages/source/v/vatnumber/vatnumber-(\d+.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz))
commit a40ff30df4eb09baa702dcc7bc3be1b217d8629b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sat Feb 23 20:08:13 2013 +0100
Updating Vcs-Git to correct address.
diff --git a/debian/control b/debian/control
index 72bdcf4..3bbad2b 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
Standards-Version: 3.9.4
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://debian.tryton.org/gitweb/?p=packages/vatnumber.git
-Vcs-Git: git://debian.tryton.org/git/packages/vatnumber.git
+Vcs-Git: git://debian.tryton.org/packages/vatnumber.git
X-Python-Version: >= 2.4
Package: python-vatnumber
commit 46dae3b1d1702b55c6b8ace55b0ce85419479d90
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri Feb 15 19:28:39 2013 +0100
Updating to Standards-Version: 3.9.4, no changes needed.
diff --git a/debian/control b/debian/control
index 5facfe6..72bdcf4 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
-Standards-Version: 3.9.3
+Standards-Version: 3.9.4
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://debian.tryton.org/gitweb/?p=packages/vatnumber.git
Vcs-Git: git://debian.tryton.org/git/packages/vatnumber.git
commit 2d8d35b0777abf28b71e725e24cee9747351723b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed Feb 13 21:37:13 2013 +0100
Removing obsolete Dm-Upload-Allowed
diff --git a/debian/control b/debian/control
index 4baa56b..5facfe6 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,6 @@ Section: python
Priority: optional
Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
-Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
Standards-Version: 3.9.3
Homepage: http://code.google.com/p/vatnumber/
commit 228de624cc5c4818ee65fc7db56df9f6601f63a8
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Jun 30 17:41:36 2012 +0200
Releasing debian version 1.0-2.
diff --git a/debian/changelog b/debian/changelog
index 65b4611..b0ff12f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+vatnumber (1:1.0-2) unstable; urgency=low
+
+ [ Mathias Behrle ]
+ * Updating to Standards-Version: 3.9.3, no changes needed.
+ * Updating year in copyright.
+ * Adding myself to copyright.
+ * Adding Format header for DEP5.
+
+ [ Daniel Baumann ]
+ * Updating maintainers field.
+ * Updating vcs fields.
+ * Switching to xz compression.
+ * Updating to debhelper version 9.
+ * Correcting copyright file to match format version 1.0.
+
+ -- Daniel Baumann <daniel at debian.org> Sat, 30 Jun 2012 17:41:20 +0200
+
vatnumber (1:1.0-1) unstable; urgency=low
* Merging upstream version 1.0.
commit 5ac177cee4263fdc68f217c9e83431c78072b8bd
Author: Daniel Baumann <daniel at 127011.net>
Date: Sat Jun 30 17:12:10 2012 +0200
Correcting copyright file to match format version 1.0.
diff --git a/debian/copyright b/debian/copyright
index bb9eb5d..fb34ba1 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,15 +1,13 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: *
-Copyright:
- (C) 2008-2011 Cedric Krier
- (C) 2008-2011 B2CK
+Copyright: 2008-2011 Cedric Krier
+ 2008-2011 B2CK
License: GPL-3+
Files: debian/*
-Copyright:
- (C) 2009-2012 Daniel Baumann <daniel at debian.org>
- (C) 2012 Mathias Behrle <mathiasb at m9s.biz>
+Copyright: 2009-2012 Daniel Baumann <daniel at debian.org>
+ 2012 Mathias Behrle <mathiasb at m9s.biz>
License: GPL-3+
License: GPL-3+
commit 120bf7e4ff4ac1975ee805709e30e68fde28dddb
Author: Daniel Baumann <daniel at 127011.net>
Date: Sat Jun 30 17:12:10 2012 +0200
Updating to debhelper version 9.
diff --git a/debian/compat b/debian/compat
index 45a4fb7..ec63514 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-8
+9
diff --git a/debian/control b/debian/control
index 242e584..4baa56b 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
Dm-Upload-Allowed: yes
-Build-Depends: debhelper (>= 8), python (>= 2.6.6-3~), python-setuptools
+Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
Standards-Version: 3.9.3
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://debian.tryton.org/gitweb/?p=packages/vatnumber.git
commit a2dc94af87dfa76104a361edcc5c232926c5e740
Author: Daniel Baumann <daniel at 127011.net>
Date: Sat Jun 30 17:12:10 2012 +0200
Switching to xz compression.
diff --git a/debian/rules b/debian/rules
index e32b791..1ae0776 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,3 +7,6 @@ override_dh_auto_clean:
dh_auto_clean
rm -rf *.egg-info
+
+override_dh_builddeb:
+ dh_builddeb -- -Zxz -z9
diff --git a/debian/source/options b/debian/source/options
index d053b65..22a4de9 100644
--- a/debian/source/options
+++ b/debian/source/options
@@ -1,2 +1,2 @@
-compression = gzip
+compression = xz
compression-level = 9
commit 1263c57a695453f9577dbbd5ae43ed7ebda274ad
Author: Daniel Baumann <daniel at 127011.net>
Date: Sat Jun 30 16:55:07 2012 +0200
Updating vcs fields.
diff --git a/debian/control b/debian/control
index e56a36f..242e584 100644
--- a/debian/control
+++ b/debian/control
@@ -7,8 +7,8 @@ Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 8), python (>= 2.6.6-3~), python-setuptools
Standards-Version: 3.9.3
Homepage: http://code.google.com/p/vatnumber/
-Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
-Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
+Vcs-Browser: http://debian.tryton.org/gitweb/?p=packages/vatnumber.git
+Vcs-Git: git://debian.tryton.org/git/packages/vatnumber.git
X-Python-Version: >= 2.4
Package: python-vatnumber
commit aaa014b83ef8467b4cc0077ee02f0d4ef579dad8
Author: Daniel Baumann <daniel at 127011.net>
Date: Sat Jun 30 16:47:48 2012 +0200
Updating maintainers field.
diff --git a/debian/control b/debian/control
index 1b73461..e56a36f 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
Source: vatnumber
Section: python
Priority: optional
-Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
+Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 8), python (>= 2.6.6-3~), python-setuptools
commit 04eaad73eb6ad5faa670aecd21da83722ef100b5
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Mar 25 15:28:18 2012 +0200
Adding Format header for DEP5.
diff --git a/debian/copyright b/debian/copyright
index 8a46a8b..bb9eb5d 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,3 +1,5 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
Files: *
Copyright:
(C) 2008-2011 Cedric Krier
commit 15f232f19b095b1440d95a586383bbb88246cd68
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri Feb 24 14:09:12 2012 +0100
Adding myself to copyright.
diff --git a/debian/copyright b/debian/copyright
index cf88340..8a46a8b 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -5,7 +5,9 @@ Copyright:
License: GPL-3+
Files: debian/*
-Copyright: (C) 2009-2012 Daniel Baumann <daniel at debian.org>
+Copyright:
+ (C) 2009-2012 Daniel Baumann <daniel at debian.org>
+ (C) 2012 Mathias Behrle <mathiasb at m9s.biz>
License: GPL-3+
License: GPL-3+
commit 34898676b8c1a68537e3b9d666a0c24ec3385da3
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri Feb 24 14:01:04 2012 +0100
Updating year in copyright.
diff --git a/debian/copyright b/debian/copyright
index 2993aeb..cf88340 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -5,7 +5,7 @@ Copyright:
License: GPL-3+
Files: debian/*
-Copyright: (C) 2009-2011 Daniel Baumann <daniel at debian.org>
+Copyright: (C) 2009-2012 Daniel Baumann <daniel at debian.org>
License: GPL-3+
License: GPL-3+
commit 3e528c3e39894409da480990193adb3788e9f9b2
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri Feb 24 13:47:03 2012 +0100
Updating to Standards-Version: 3.9.3, no changes needed.
diff --git a/debian/control b/debian/control
index 03b239a..1b73461 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 8), python (>= 2.6.6-3~), python-setuptools
-Standards-Version: 3.9.2
+Standards-Version: 3.9.3
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
commit d029e7ad364f960ce8bd707e24e88c631ffb9539
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed Sep 28 19:47:30 2011 +0200
Releasing debian version 1.0-1.
diff --git a/debian/changelog b/debian/changelog
index 64e9b6e..65b4611 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (1:1.0-1) unstable; urgency=low
+
+ * Merging upstream version 1.0.
+ * Removing deprecated XB-Python-Version for dh_python2.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Wed, 28 Sep 2011 19:24:12 +0200
+
vatnumber (1:0.9-2) unstable; urgency=low
[ Mathias Behrle ]
commit 292973ca2878ed56e3ac1f31cfb05c4aa86d9f5d
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed Sep 28 19:23:29 2011 +0200
Merging upstream version 1.0.
diff --git a/CHANGELOG b/CHANGELOG
index 08fcfd0..4ab00db 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,9 @@
+Version 1.0 - 2011-09-28
+* Fix UK VAT check
+* Fix UK VAT 9755 validation
+* Fix Sweden 2 last numbers validation
+* Add 999 and 888 as valide IT province of residence
+
Version 0.9 - 2011-03-17
* Fix VIES URL
diff --git a/PKG-INFO b/PKG-INFO
index c73961b..eecea2d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.9
+Version: 1.0
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index c73961b..eecea2d 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.9
+Version: 1.0
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber/__init__.py b/vatnumber/__init__.py
index 1e84f34..a11c2fa 100644
--- a/vatnumber/__init__.py
+++ b/vatnumber/__init__.py
@@ -6,7 +6,7 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.9'
+__version__ = '1.0'
VIES_URL='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'
def countries():
@@ -567,8 +567,6 @@ def check_vat_gb(vat):
if int(vat[3:10]) < 1:
return False
- if int(vat[3:10]) > 19999 and int(vat[3:10]) < 1000000:
- return False
if int(vat[10:12]) > 97:
return False
if len(vat) == 13 and int(vat[12]) != 3:
@@ -588,8 +586,6 @@ def check_vat_gb(vat):
if int(vat[0:7]) < 1:
return False
- if int(vat[0:7]) > 19999 and int(vat[0:7]) < 1000000:
- return False
if int(vat[7:9]) > 97:
return False
if len(vat) == 10 and int(vat[9]) != 3:
@@ -598,7 +594,7 @@ def check_vat_gb(vat):
check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
2 * int(vat[6]) + 10 * int(vat[7]) + int(vat[8])
- if int(vat[0:3]) > 100:
+ if int(vat[0:3]) >= 100:
if check_sum % 97 not in (0, 55, 42):
return False
else:
@@ -737,11 +733,8 @@ def check_vat_it(vat):
return False
if int(vat[0:7]) <= 0:
return False
- if int(vat[7:10]) <= 0:
- return False
- if int(vat[7:10]) > 100 and int(vat[7:10]) < 120:
- return False
- if int(vat[7:10]) > 121:
+ if not((0 <= int(vat[7:10]) <= 100)
+ or int(vat[7:10]) in (120, 121, 888, 999)):
return False
check_sum = int(vat[0]) + mult_add(2, int(vat[1])) + int(vat[2]) + \
@@ -1014,7 +1007,7 @@ def check_vat_se(vat):
int(vat)
except ValueError:
return False
- if int(vat[9:11]) <= 0:
+ if int(vat[10:12]) <= 0:
return False
check_sum = mult_add(2, int(vat[0])) + int(vat[1]) + \
diff --git a/vatnumber/tests.py b/vatnumber/tests.py
index 4ed8438..0fa5fb8 100644
--- a/vatnumber/tests.py
+++ b/vatnumber/tests.py
@@ -134,6 +134,8 @@ VAT_NUMBERS = [
('GB', 'HA888856782', True),
('GB', '123456782', True),
('GB', '102675046', True),
+ ('GB', '100190874', True),
+ ('GB', '003232345', True),
('GB', '1234567823', True),
('GB', '001123456782', True),
('GB', '0011234567823', True),
@@ -147,6 +149,7 @@ VAT_NUMBERS = [
('IE', '7A12345J', True),
('IE', '1234567T', True),
('IT', '12345670017', True),
+ ('IT', '00118439991', True),
('LT', '123456715', True),
('LT', '123456789011', True),
('LU', '12345613', True),
@@ -162,6 +165,7 @@ VAT_NUMBERS = [
('RU', '5505035011', True),
('RU', '550501929014', True),
('SE', '123456789701', True),
+ ('SE', '556728341001', True),
('SI', '12345679', True),
('SK', '0012345675', True),
('SK', '0012345678', True),
commit 180e3dc0a76b7fcb613aa5070df95911f04fba7c
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri Jul 22 12:27:02 2011 +0200
Removing deprecated XB-Python-Version for dh_python2.
diff --git a/debian/control b/debian/control
index 7465e10..03b239a 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,6 @@ Package: python-vatnumber
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources
Recommends: python-suds
-XB-Python-Version: ${python:Versions}
Description: Python module to validate VAT numbers
This is a Python module to check the validity of Value Added Tax (VAT) numbers
of States inside the European Union. It uses the validation rules according to
commit 4d6a6dc3ac4dd1c000bedae2a443b1f099817e42
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Jul 17 19:39:45 2011 +0200
Releasing debian version 0.9-2.
diff --git a/debian/changelog b/debian/changelog
index f1915d5..64e9b6e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
+vatnumber (1:0.9-2) unstable; urgency=low
+
+ [ Mathias Behrle ]
+ * Removing obsolete backup file.
+ * Updating to standards version 3.9.2.
+
+ [ Daniel Baumann ]
+ * Not wrapping uploaders field, it does not exceed 80 chars.
+ * Compacting copyright file.
+ * Moving to source format 3.0 (quilt).
+ * Rewrapping package long-description.
+
+ [ Mathias Behrle ]
+ * Moving from deprecated python-support to dh_python2.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Sun, 17 Jul 2011 19:39:28 +0200
+
vatnumber (1:0.9-1) unstable; urgency=low
* Merging upstream version 0.9.
commit b0a5732673a0f7a835e2f2d804a6e031132a5aff
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Jul 17 18:35:31 2011 +0200
Moving from deprecated python-support to dh_python2.
diff --git a/debian/control b/debian/control
index 279292c..7465e10 100644
--- a/debian/control
+++ b/debian/control
@@ -4,11 +4,12 @@ Priority: optional
Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
Dm-Upload-Allowed: yes
-Build-Depends: debhelper (>= 8), python, python-setuptools, python-support
+Build-Depends: debhelper (>= 8), python (>= 2.6.6-3~), python-setuptools
Standards-Version: 3.9.2
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
+X-Python-Version: >= 2.4
Package: python-vatnumber
Architecture: all
diff --git a/debian/pycompat b/debian/pycompat
deleted file mode 100644
index 0cfbf08..0000000
--- a/debian/pycompat
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/debian/pyversions b/debian/pyversions
deleted file mode 100644
index 8b253bc..0000000
--- a/debian/pyversions
+++ /dev/null
@@ -1 +0,0 @@
-2.4-
diff --git a/debian/rules b/debian/rules
index 000210b..e32b791 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,9 @@
#!/usr/bin/make -f
%:
- dh ${@}
+ dh ${@} --with python2
+
+override_dh_auto_clean:
+ dh_auto_clean
+
+ rm -rf *.egg-info
commit 7150caa39572012f87956b7a3c973a8ce7c33bdb
Author: Daniel Baumann <daniel at debian.org>
Date: Sun Jul 10 15:21:21 2011 +0200
Rewrapping package long-description.
diff --git a/debian/control b/debian/control
index 54d25b2..279292c 100644
--- a/debian/control
+++ b/debian/control
@@ -19,7 +19,7 @@ Description: Python module to validate VAT numbers
This is a Python module to check the validity of Value Added Tax (VAT) numbers
of States inside the European Union. It uses the validation rules according to
http://sima-pc.com/nif.php.
+ .
Additionally this module provides a function for online validation of given VAT
numbers by the VIES VAT number validation (SOAP Service) of the Taxation and
- Customs Union:
- http://ec.europa.eu/taxation_customs/vies/vieshome.do
+ Customs Union: http://ec.europa.eu/taxation_customs/vies/vieshome.do
commit 08237ed446e99ffcdc221bbc7539477be6a3be74
Author: Daniel Baumann <daniel at debian.org>
Date: Sun Jul 10 15:20:41 2011 +0200
Moving to source format 3.0 (quilt).
diff --git a/debian/README.source b/debian/README.source
deleted file mode 100644
index 18b6b24..0000000
--- a/debian/README.source
+++ /dev/null
@@ -1,37 +0,0 @@
-Package Repositories
---------------------
-
-Backports for the current stable debian distribution as well as snapshots of
-unreleased versions may be available in repositories listed on the maintainers
-homepage. The current URL of the maintainer homepage can be seen in
-debian/copyright.
-
-
-Source Access
--------------
-
-You can obtain the sources of this package with:
-
- $ apt-get source ${PACKAGE}
-
-whereas '${PACKAGE}' has to be replaced with the actual name of the package.
-
-This package is maintained with the Git version control system. The current git
-source tree can be obtained with:
-
- $ git clone ${GIT_URI}
-
-whereas '${GIT_URI}' has to be replaced with the actual URI for the Git
-repository. The current Git URI can be seen in debian/control in the extracted
-package sources.
-
-More information about Git can be found in the git-core package.
-
-This package may use the Quilt patch system to manage all modifications to the
-upstream source. Changes, if any, are stored in the source package as diffs in
-debian/diff and are applied during the build. Current modifications can be
-applied to the source tree with:
-
- $ QUILT_PATCHES=debian/patches quilt push -a
-
-More information about Quilt can be found in the quilt package.
diff --git a/debian/source/options b/debian/source/options
new file mode 100644
index 0000000..d053b65
--- /dev/null
+++ b/debian/source/options
@@ -0,0 +1,2 @@
+compression = gzip
+compression-level = 9
commit 30a54da89515a64635c9735ef77024a4f7323869
Author: Daniel Baumann <daniel at debian.org>
Date: Sun Jul 10 15:20:32 2011 +0200
Compacting copyright file.
diff --git a/debian/copyright b/debian/copyright
index a919942..2993aeb 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,34 +1,14 @@
-Upstream-Contact:
- Cedric Krier <cedric.krier at b2ck.com>
- Bertrand Chenal <bertrand.chenal at b2ck.com>
-Download: http://code.google.com/p/vatnumber/
-Maintainer-Contact: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
-Maintainer-Homepage: http://tryton.debian-maintainers.org/
-
Files: *
Copyright:
(C) 2008-2011 Cedric Krier
(C) 2008-2011 B2CK
License: GPL-3+
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- .
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- .
- On Debian systems, the complete text of the GNU General Public License
- can be found in /usr/share/common-licenses/GPL-3 file.
Files: debian/*
Copyright: (C) 2009-2011 Daniel Baumann <daniel at debian.org>
License: GPL-3+
+
+License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@@ -42,5 +22,5 @@ License: GPL-3+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
- On Debian systems, the complete text of the GNU General Public License
+ The complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL-3 file.
commit ef225e386634e67b16dcb96459e60c52a86facaa
Author: Daniel Baumann <daniel at debian.org>
Date: Sun Jul 10 15:20:02 2011 +0200
Not wrapping uploaders field, it does not exceed 80 chars.
diff --git a/debian/control b/debian/control
index e846b32..54d25b2 100644
--- a/debian/control
+++ b/debian/control
@@ -2,9 +2,7 @@ Source: vatnumber
Section: python
Priority: optional
Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
-Uploaders:
- Daniel Baumann <daniel at debian.org>,
- Mathias Behrle <mathiasb at m9s.biz>
+Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at m9s.biz>
Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 8), python, python-setuptools, python-support
Standards-Version: 3.9.2
commit 56bdaee90e24912e53a14061457d0423f485aafe
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Apr 26 21:08:56 2011 +0200
Updating to standards version 3.9.2.
diff --git a/debian/control b/debian/control
index 71382e6..e846b32 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders:
Mathias Behrle <mathiasb at m9s.biz>
Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 8), python, python-setuptools, python-support
-Standards-Version: 3.9.1
+Standards-Version: 3.9.2
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
commit 39df70b3e32bd626c00f606ecddf715d55565ab3
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Mar 21 12:09:21 2011 +0100
Removing obsolete backup file.
diff --git a/debian/changelog~ b/debian/changelog~
deleted file mode 100644
index bb1dfd6..0000000
--- a/debian/changelog~
+++ /dev/null
@@ -1,129 +0,0 @@
-vatnumber (1:0.8-2) unstable; urgency=low
-
- * Merging upstream version 0.9.
-
- -- Mathias Behrle <mathiasb at m9s.biz> Mon, 21 Mar 2011 11:48:47 +0100
-
-vatnumber (1:0.8-1) unstable; urgency=low
-
- * Changing my email address.
- * Merging upstream version 0.8.
- * Updating Copyright.
-
- -- Mathias Behrle <mathiasb at m9s.biz> Mon, 07 Feb 2011 19:53:39 +0100
-
-vatnumber (1:0.7-2) experimental; urgency=low
-
- * Updating to debhelper version 8.
- * Updating to standards version 3.9.1.
- * Switching to source format 3.0 (quilt).
-
- -- Daniel Baumann <daniel at debian.org> Fri, 12 Nov 2010 14:19:48 +0100
-
-vatnumber (1:0.7-1) unstable; urgency=low
-
- * Merging upstream version 0.7.
-
- -- Mathias Behrle <mathiasb at mbsolutions.selfip.biz> Tue, 24 Aug 2010 21:41:15 +0200
-
-vatnumber (1:0.6-2) unstable; urgency=low
-
- [ Mathias Behrle ]
- * Adding python-suds to Recommends.
- * Fixing typo in Recommends.
-
- [ Daniel Baumann ]
- * Updating standards version to 3.9.0.
-
- -- Mathias Behrle <mathiasb at mbsolutions.selfip.biz> Tue, 13 Jul 2010 00:46:00 +0200
-
-vatnumber (1:0.6-1) unstable; urgency=low
-
- * Merging upstream version 0.6.
- * Updating year in copyright file.
-
- -- Daniel Baumann <daniel at debian.org> Mon, 31 May 2010 08:17:23 +0200
-
-vatnumber (1:0.5-3) unstable; urgency=low
-
- * Adding Dm-Upload-Allowed in control in preparation for Mathias.
-
- -- Daniel Baumann <daniel at debian.org> Thu, 13 May 2010 22:17:39 +0200
-
-vatnumber (1:0.5-2) unstable; urgency=low
-
- * Adding explicit debian source version 1.0 until switch to 3.0.
- * Updating year in copyright file.
- * Removing unneeded python-all-dev from build-depends.
- * Updating to standards 3.8.4.
- * Updating README.source.
-
- -- Daniel Baumann <daniel at debian.org> Sat, 20 Feb 2010 11:08:57 +0100
-
-vatnumber (1:0.5-1) unstable; urgency=low
-
- * Merging upstream version 0.5.
- * Updating year in copyright file.
-
- -- Daniel Baumann <daniel at debian.org> Mon, 16 Nov 2009 20:33:28 +0100
-
-vatnumber (1:0.4-5) unstable; urgency=low
-
- * Correcting spelling error in package long-description.
- * Updating to standards version 3.8.3.
- * Adding maintainer homepage field to control.
- * Adding README.source.
- * Moving maintainer homepage field to copyright.
- * Updating README.source.
-
- -- Daniel Baumann <daniel at debian.org> Sat, 05 Sep 2009 09:36:23 +0200
-
-vatnumber (1:0.4-4) unstable; urgency=low
-
- [ Mathias Behrle ]
- * Updating package description (Closes: #520099).
-
- -- Daniel Baumann <daniel at debian.org> Tue, 11 Aug 2009 21:27:32 +0200
-
-vatnumber (1:0.4-3) unstable; urgency=low
-
- * Updating maintainer field.
- * Updating vcs fields.
- * Adding Mathias as co-maintainer.
- * Wrapping lines in control.
-
- -- Daniel Baumann <daniel at debian.org> Mon, 10 Aug 2009 20:32:44 +0200
-
-vatnumber (1:0.4-2) unstable; urgency=low
-
- * Using correct rfc-2822 date formats in changelog.
- * Updating to standards version 3.8.2.
- * Minimizing rules file.
-
- -- Daniel Baumann <daniel at debian.org> Mon, 27 Jul 2009 14:51:33 +0200
-
-vatnumber (0.4-1) unstable; urgency=low
-
- * Merging upstream version 0.4.
-
- -- Daniel Baumann <daniel at debian.org> Mon, 30 Mar 2009 11:04:00 +0200
-
-vatnumber (0.3-1) unstable; urgency=low
-
- * Updating to standards version 3.8.1.
- * Merging upstream version 0.3.
-
- -- Daniel Baumann <daniel at debian.org> Mon, 30 Mar 2009 11:01:00 +0200
-
-vatnumber (0.2-2) unstable; urgency=low
-
- * Correcting typo in control, architecture should have been arch all,
- not any.
-
- -- Daniel Baumann <daniel at debian.org> Wed, 04 Feb 2009 20:41:00 +0100
-
-vatnumber (0.2-1) unstable; urgency=low
-
- * Initial release.
-
- -- Daniel Baumann <daniel at debian.org> Mon, 12 Jan 2009 15:49:00 -0500
commit 938cd96667e58107c94595c1cdbab8a9e8e154a5
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Mar 21 12:05:55 2011 +0100
Releasing debian version 0.9-1.
diff --git a/debian/changelog b/debian/changelog
index d384cfe..f1915d5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+vatnumber (1:0.9-1) unstable; urgency=low
+
+ * Merging upstream version 0.9.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Mon, 21 Mar 2011 11:48:47 +0100
+
vatnumber (1:0.8-1) unstable; urgency=low
* Changing my email address.
diff --git a/debian/changelog b/debian/changelog~
similarity index 95%
copy from debian/changelog
copy to debian/changelog~
index d384cfe..bb1dfd6 100644
--- a/debian/changelog
+++ b/debian/changelog~
@@ -1,3 +1,9 @@
+vatnumber (1:0.8-2) unstable; urgency=low
+
+ * Merging upstream version 0.9.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Mon, 21 Mar 2011 11:48:47 +0100
+
vatnumber (1:0.8-1) unstable; urgency=low
* Changing my email address.
commit a09d215d918aed2cf702ac3963ad2ae6cf8ff84c
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Mar 21 11:47:54 2011 +0100
Merging upstream version 0.9.
diff --git a/CHANGELOG b/CHANGELOG
index 783d86e..08fcfd0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 0.9 - 2011-03-17
+* Fix VIES URL
+
Version 0.8 - 2011-01-18
* Add GB validation for the "9755" checksum introduced in November 2009
diff --git a/PKG-INFO b/PKG-INFO
index 466e5fc..c73961b 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.8
+Version: 0.9
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index 466e5fc..c73961b 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.8
+Version: 0.9
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber/__init__.py b/vatnumber/__init__.py
index 20bc93e..1e84f34 100644
--- a/vatnumber/__init__.py
+++ b/vatnumber/__init__.py
@@ -6,8 +6,8 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.8'
-VIES_URL='http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl'
+__version__ = '0.9'
+VIES_URL='http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'
def countries():
'''
commit fb3698a06ff6b4da0243e2216e03aff18207b819
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Feb 7 19:54:37 2011 +0100
Releasing debian version 0.8-1.
diff --git a/debian/changelog b/debian/changelog
index 6d141f7..d384cfe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+vatnumber (1:0.8-1) unstable; urgency=low
+
+ * Changing my email address.
+ * Merging upstream version 0.8.
+ * Updating Copyright.
+
+ -- Mathias Behrle <mathiasb at m9s.biz> Mon, 07 Feb 2011 19:53:39 +0100
+
vatnumber (1:0.7-2) experimental; urgency=low
* Updating to debhelper version 8.
commit da8eaf1adae152d44f4691c958f13c4c8ad1adda
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Feb 7 19:53:22 2011 +0100
Updating Copyright.
diff --git a/debian/copyright b/debian/copyright
index a116829..a919942 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -7,8 +7,8 @@ Maintainer-Homepage: http://tryton.debian-maintainers.org/
Files: *
Copyright:
- (C) 2008-2010 Cedric Krier
- (C) 2008-2010 B2CK
+ (C) 2008-2011 Cedric Krier
+ (C) 2008-2011 B2CK
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ License: GPL-3+
can be found in /usr/share/common-licenses/GPL-3 file.
Files: debian/*
-Copyright: (C) 2009-2010 Daniel Baumann <daniel at debian.org>
+Copyright: (C) 2009-2011 Daniel Baumann <daniel at debian.org>
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
commit ae597e3a7f5a610b21462ae382687412d2bf73ef
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Feb 7 19:52:02 2011 +0100
Merging upstream version 0.8.
diff --git a/CHANGELOG b/CHANGELOG
index c5ad7d6..783d86e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 0.8 - 2011-01-18
+* Add GB validation for the "9755" checksum introduced in November 2009
+
Version 0.7 - 2010-08-24
* Fix test on last char of Albania
* Add Check Croatia VAT number
diff --git a/COPYRIGHT b/COPYRIGHT
index 636799b..e55164c 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (c) 2008-2010 Cédric Krier.
-Copyright (c) 2008-2010 B2CK.
+Copyright (c) 2008-2011 Cédric Krier.
+Copyright (c) 2008-2011 B2CK.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index 2900d73..466e5fc 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.7
+Version: 0.8
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index 2900d73..466e5fc 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.7
+Version: 0.8
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber/__init__.py b/vatnumber/__init__.py
index 93cdff0..20bc93e 100644
--- a/vatnumber/__init__.py
+++ b/vatnumber/__init__.py
@@ -6,7 +6,7 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.7'
+__version__ = '0.8'
VIES_URL='http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl'
def countries():
@@ -598,8 +598,12 @@ def check_vat_gb(vat):
check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
2 * int(vat[6]) + 10 * int(vat[7]) + int(vat[8])
- if check_sum % 97 != 0:
- return False
+ if int(vat[0:3]) > 100:
+ if check_sum % 97 not in (0, 55, 42):
+ return False
+ else:
+ if check_sum % 97 != 0:
+ return False
return True
return False
@@ -1165,7 +1169,11 @@ def check_vat(vat):
'''
code = vat[:2].lower()
number = vat[2:]
- return globals()['check_vat_%s' % code](number)
+ try:
+ checker = globals()['check_vat_%s' % code]
+ except KeyError:
+ return False
+ return checker(number)
def check_vies(vat):
'''
diff --git a/vatnumber/tests.py b/vatnumber/tests.py
index 8864d3f..4ed8438 100644
--- a/vatnumber/tests.py
+++ b/vatnumber/tests.py
@@ -133,6 +133,7 @@ VAT_NUMBERS = [
('GB', 'HA567', True),
('GB', 'HA888856782', True),
('GB', '123456782', True),
+ ('GB', '102675046', True),
('GB', '1234567823', True),
('GB', '001123456782', True),
('GB', '0011234567823', True),
@@ -169,6 +170,7 @@ VAT_NUMBERS = [
('SK', '2021853504', True),
('SM', '12345', True),
('UA', '12345678', True),
+ ('', '12456789', False),
]
VIES_NUMBERS = [
commit 5d508cf1d8ae04cc08c169d169c664f9785c3f5d
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sat Nov 20 11:48:58 2010 +0100
Changing my email address.
diff --git a/debian/control b/debian/control
index 371c646..71382e6 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
Uploaders:
Daniel Baumann <daniel at debian.org>,
- Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
+ Mathias Behrle <mathiasb at m9s.biz>
Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 8), python, python-setuptools, python-support
Standards-Version: 3.9.1
commit 44b7fce47cb15790bb96dfc83ffa895508910663
Author: Daniel Baumann <daniel at debian.org>
Date: Fri Nov 12 14:20:04 2010 +0100
Releasing debian version 0.7-2.
diff --git a/debian/changelog b/debian/changelog
index 20ad248..6d141f7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+vatnumber (1:0.7-2) experimental; urgency=low
+
+ * Updating to debhelper version 8.
+ * Updating to standards version 3.9.1.
+ * Switching to source format 3.0 (quilt).
+
+ -- Daniel Baumann <daniel at debian.org> Fri, 12 Nov 2010 14:19:48 +0100
+
vatnumber (1:0.7-1) unstable; urgency=low
* Merging upstream version 0.7.
commit a37b5f2d21a84a158804f19742eeb3e9ec2ec4c6
Author: Daniel Baumann <daniel at debian.org>
Date: Tue Nov 2 14:20:46 2010 +0100
Switching to source format 3.0 (quilt).
diff --git a/debian/source/format b/debian/source/format
index d3827e7..163aaf8 100644
--- a/debian/source/format
+++ b/debian/source/format
@@ -1 +1 @@
-1.0
+3.0 (quilt)
commit 9dec2f35e64992a57d52c5f5409b68b08b22eca1
Author: Daniel Baumann <daniel at debian.org>
Date: Thu Sep 30 01:05:33 2010 +0200
Updating to standards version 3.9.1.
diff --git a/debian/control b/debian/control
index 7962dba..371c646 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders:
Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 8), python, python-setuptools, python-support
-Standards-Version: 3.9.0
+Standards-Version: 3.9.1
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
commit ab57417db87eafb7ed57485970e4f0cd1bd7e7f2
Author: Daniel Baumann <daniel at debian.org>
Date: Thu Sep 30 01:04:05 2010 +0200
Updating to debhelper version 8.
diff --git a/debian/compat b/debian/compat
index 7f8f011..45a4fb7 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-7
+8
diff --git a/debian/control b/debian/control
index 9b452bf..7962dba 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Uploaders:
Daniel Baumann <daniel at debian.org>,
Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Dm-Upload-Allowed: yes
-Build-Depends: debhelper (>= 7), python, python-setuptools, python-support
+Build-Depends: debhelper (>= 8), python, python-setuptools, python-support
Standards-Version: 3.9.0
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
commit 17887fd861f2949830737e4c34938397a4f7967b
Author: Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Date: Tue Aug 24 21:42:11 2010 +0200
Releasing debian version 0.7-1.
diff --git a/debian/changelog b/debian/changelog
index 9527758..20ad248 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+vatnumber (1:0.7-1) unstable; urgency=low
+
+ * Merging upstream version 0.7.
+
+ -- Mathias Behrle <mathiasb at mbsolutions.selfip.biz> Tue, 24 Aug 2010 21:41:15 +0200
+
vatnumber (1:0.6-2) unstable; urgency=low
[ Mathias Behrle ]
commit 4ac19da0e1be3585e1bd0f322cd1625f34978932
Author: Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Date: Tue Aug 24 21:40:37 2010 +0200
Merging upstream version 0.7.
diff --git a/CHANGELOG b/CHANGELOG
index 97507d5..c5ad7d6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 0.7 - 2010-08-24
+* Fix test on last char of Albania
+* Add Check Croatia VAT number
+
Version 0.6 - 2010-05-30
* Add generic check_vat method
* Replace SOAPpy by suds
diff --git a/INSTALL b/INSTALL
index 499bfa0..6037913 100644
--- a/INSTALL
+++ b/INSTALL
@@ -5,7 +5,7 @@ Prerequisites
-------------
* Python (http://www.python.org/)
- * suds (https://fedorahosted.org/suds/)
+ * Optional: suds (https://fedorahosted.org/suds/)
Installation
------------
diff --git a/PKG-INFO b/PKG-INFO
index 76bfeaa..2900d73 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.6
+Version: 0.7
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
@@ -17,18 +17,18 @@ Description: vatnumber
Here a simple example to validate VAT numbers format::
- >>> import vatnumber
- >>> vatnumber.check_vat('BE0123456749')
- True
+ >>> import vatnumber
+ >>> vatnumber.check_vat('BE0123456749')
+ True
Here a simple example to validate European VAT through VIES service::
- >>> import vatnumber
- >>> vatnumber.check_vies('BE0897290877')
- True
+ >>> import vatnumber
+ >>> vatnumber.check_vies('BE0897290877')
+ True
- For more information please visit the `vatnumber website_`.
+ For more information please visit the `vatnumber website`_.
.. _vatnumber website: http://code.google.com/p/vatnumber/
diff --git a/README b/README
index 0696fe0..f6f447c 100644
--- a/README
+++ b/README
@@ -19,6 +19,6 @@ Here a simple example to validate European VAT through VIES service::
True
-For more information please visit the `vatnumber website_`.
+For more information please visit the `vatnumber website`_.
.. _vatnumber website: http://code.google.com/p/vatnumber/
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index 76bfeaa..2900d73 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.6
+Version: 0.7
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
@@ -17,18 +17,18 @@ Description: vatnumber
Here a simple example to validate VAT numbers format::
- >>> import vatnumber
- >>> vatnumber.check_vat('BE0123456749')
- True
+ >>> import vatnumber
+ >>> vatnumber.check_vat('BE0123456749')
+ True
Here a simple example to validate European VAT through VIES service::
- >>> import vatnumber
- >>> vatnumber.check_vies('BE0897290877')
- True
+ >>> import vatnumber
+ >>> vatnumber.check_vies('BE0897290877')
+ True
- For more information please visit the `vatnumber website_`.
+ For more information please visit the `vatnumber website`_.
.. _vatnumber website: http://code.google.com/p/vatnumber/
diff --git a/vatnumber/__init__.py b/vatnumber/__init__.py
index c205c16..93cdff0 100644
--- a/vatnumber/__init__.py
+++ b/vatnumber/__init__.py
@@ -6,7 +6,7 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.6'
+__version__ = '0.7'
VIES_URL='http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl'
def countries():
@@ -28,6 +28,16 @@ def mult_add(i, j):
res += int(str(mult)[i])
return res
+def mod1110(value):
+ '''
+ Compute ISO 7064, Mod 11,10
+ '''
+ t = 10
+ for i in value:
+ c = int(i)
+ t = (2 * ((t + c) % 10 or 10)) % 11
+ return (11 - t) % 10
+
def check_vat_at(vat):
'''
Check Austria VAT number.
@@ -64,7 +74,7 @@ def check_vat_al(vat):
int(vat[1:9])
except ValueError:
return False
- if ord(vat[9]) < 65 and ord(vat[9]) > 90:
+ if ord(vat[9]) < 65 or ord(vat[9]) > 90:
return False
return True
@@ -118,26 +128,25 @@ def check_vat_cl(rut):
Check Chile RUT number.
'''
try:
- int(str(rut)[:len(str(rut))-1])
+ int(rut[:-1])
except ValueError:
return False
sum = 0
- RUTLen = len(str(rut))
- for i in range (RUTLen - 2, -1, -1):
- sum += int(str(rut)[i]) * (((RUTLen - 2 - i) % 6) + 2)
+ for i in range(len(rut) - 2, -1, -1):
+ sum += int(rut[i]) * (((len(rut) - 2 - i) % 6) + 2)
check = 11 - (sum % 11)
if check == 11:
- return str(rut)[len(str(rut)) -1] == '0'
+ return rut[-1] == '0'
elif check == 10:
- return str(rut)[len(str(rut)) -1].upper() == 'K'
+ return rut[-1].upper() == 'K'
else:
- return str(check) == str(rut)[len(str(rut)) -1]
+ return check == int(rut[-1])
def check_vat_co(rut):
'''
Check Colombian RUT number.
'''
- if len(str(rut)) != 10:
+ if len(rut) != 10:
return False
try:
int(rut)
@@ -145,13 +154,12 @@ def check_vat_co(rut):
return False
nums = [3, 7, 13, 17, 19, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71]
sum = 0
- RUTLen = len(str(rut))
- for i in range (RUTLen - 2, -1, -1):
- sum += int(str(rut)[i]) * nums [RUTLen - 2 - i]
+ for i in range (len(rut) - 2, -1, -1):
+ sum += int(rut[i]) * nums[len(rut) - 2 - i]
if sum % 11 > 1:
- return str(rut)[RUTLen - 1] == str(11 - (sum % 11))
+ return int(rut[-1]) == 11 - (sum % 11)
else:
- return str(rut)[RUTLen - 1] == str(sum % 11)
+ return int(rut[-1]) == sum % 11
def check_vat_cy(vat):
'''
@@ -288,9 +296,8 @@ def check_vat_cz(vat):
if int(vat[4:6]) > 31:
return False
if (int(vat[0:2]) + int(vat[2:4]) + int(vat[4:6]) + int(vat[6:8]) +
- int(vat[8:10])) % 11 != 0:
- return False
- if int(vat[0:10]) % 11 != 0:
+ int(vat[8:10])) % 11 != 0 \
+ or int(vat[0:10]) % 11 != 0:
return False
return True
@@ -632,6 +639,21 @@ def check_vat_el(vat):
'''
return check_vat_gr(vat)
+def check_vat_hr(vat):
+ '''
+ Check Croatia VAT number.
+ '''
+ if len(vat) != 11:
+ return False
+ try:
+ int(vat)
+ except ValueError:
+ return False
+ check = mod1110(vat[:-1])
+ if check != int(vat[10]):
+ return False
+ return True
+
def check_vat_hu(vat):
'''
Check Hungary VAT number.
@@ -1039,7 +1061,7 @@ def check_vat_sk(vat):
if len(vat) not in(9, 10):
return False
- if int(vat[0:2]) == 0 and len(vat) == 10:
+ if int(vat[0:2]) in (0, 10, 20) and len(vat) == 10:
return True
if len(vat) == 10:
diff --git a/vatnumber/tests.py b/vatnumber/tests.py
index 2152edb..8864d3f 100644
--- a/vatnumber/tests.py
+++ b/vatnumber/tests.py
@@ -8,76 +8,167 @@ import unittest
import vatnumber
VAT_NUMBERS = [
- ('AT', 'U12345675'),
- ('AL', 'K99999999L'),
- ('BE', '0123456749'),
- ('BG', '1234567892'),
- ('BG', '175074752'),
- ('BG', '131202360'),
- ('BG', '040683212'),
- ('CL', '334441113'),
- ('CO', '9001279338'),
- ('CY', '12345678F'),
- ('CZ', '12345679'),
- ('CZ', '612345670'),
- ('CZ', '991231123'),
- ('CZ', '6306150004'),
- ('DE', '123456788'),
- ('DK', '12345674'),
- ('EE', '123456780'),
- ('ES', 'A12345674'),
- ('ES', 'P1234567D'),
- ('ES', 'K1234567L'),
- ('ES', 'R9600075G'),
- ('ES', 'W4003922D'),
- ('ES', 'V99218067'),
- ('ES', 'U99216632'),
- ('ES', 'J99216582'),
- ('ES', 'U99216426'),
- ('ES', '12345678Z'),
- ('ES', 'X5277343Q'),
- ('ES', 'Y5277343F'),
- ('ES', 'Z5277343K'),
- ('FI', '12345671'),
- ('FR', '32123456789'),
- ('FR', '2H123456789'),
- ('GB', 'GD123'),
- ('GB', 'GD888812326'),
- ('GB', 'HA567'),
- ('GB', 'HA888856782'),
- ('GB', '123456782'),
- ('GB', '1234567823'),
- ('GB', '001123456782'),
- ('GB', '0011234567823'),
- ('GB', '242338087388'),
- ('GR', '12345670'),
- ('GR', '123456783'),
- ('HU', '12345676'),
- ('IE', '7A12345J'),
- ('IE', '1234567T'),
- ('IT', '12345670017'),
- ('LT', '123456715'),
- ('LT', '123456789011'),
- ('LU', '12345613'),
- ('LV', '41234567891'),
- ('LV', '15066312345'),
- ('MT', '12345634'),
- ('NL', '123456782B90'),
- ('PL', '1234567883'),
- ('PT', '123456789'),
- ('RO', '24736200'),
- ('RO', '1234567897'),
- ('RO', '1630615123457'),
- ('RU', '5505035011'),
- ('RU', '550501929014'),
- ('SE', '123456789701'),
- ('SI', '12345679'),
- ('SK', '0012345675'),
- ('SK', '0012345678'),
- ('SK', '531231123'),
- ('SK', '6306151234'),
- ('SM', '12345'),
- ('UA', '12345678'),
+ ('AT', 'U12345675', True),
+ ('AT', 'U123456789', False),
+ ('AT', 'A12345675', False),
+ ('AT', 'UA2345675', False),
+ ('AT', 'U12345620', True),
+ ('AT', 'U12345678', False),
+ ('AL', 'K99999999L', True),
+ ('AL', 'K999999999L', False),
+ ('AL', 'AA9999999L', False),
+ ('AL', 'KA9999999L', False),
+ ('AL', 'K999999991', False),
+ ('BE', '0123456749', True),
+ ('BE', '0897290877', True),
+ ('BE', '01234567490', False),
+ ('BE', '9123456749', False),
+ ('BE', '0A23456749', False),
+ ('BE', '0123456700', False),
+ ('BG', '1234567892', True),
+ ('BG', '175074752', True),
+ ('BG', '131202360', True),
+ ('BG', '040683212', True),
+ ('BG', '12345678921', False),
+ ('BG', 'A234567892', False),
+ ('BG', '2234567892', False),
+ ('BG', '1001000000', True),
+ ('BG', '0000003000', False),
+ ('BG', '1234567890', False),
+ ('CL', '334441113', True),
+ ('CL', 'A34441113', False),
+ ('CL', '334441180', True),
+ ('CL', '33444113K', True),
+ ('CO', '9001279338', True),
+ ('CO', '900127933', False),
+ ('CO', 'A001279338', False),
+ ('CO', '9001279320', True),
+ ('CY', '12345678F', True),
+ ('CY', '2345678F', False),
+ ('CY', 'A2345678F', False),
+ ('CY', '12345678A', False),
+ ('CZ', '1234567', False),
+ ('CZ', '12345679', True),
+ ('CZ', 'A2345679', False),
+ ('CZ', '92345679', False),
+ ('CZ', '10001000', True),
+ ('CZ', '10000101', True),
+ ('CZ', '12345670', False),
+ ('CZ', '612345670', True),
+ ('CZ', '612345679', False),
+ ('CZ', '991231123', True),
+ ('CZ', '541231123', False),
+ ('CZ', '791231123', False),
+ ('CZ', '990031123', False),
+ ('CZ', '991331123', False),
+ ('CZ', '995031123', False),
+ ('CZ', '996331123', False),
+ ('CZ', '990200123', False),
+ ('CZ', '995229123', False),
+ ('CZ', '965200123', False),
+ ('CZ', '960230123', False),
+ ('CZ', '990400123', False),
+ ('CZ', '990431123', False),
+ ('CZ', '990100123', False),
+ ('CZ', '990132123', False),
+ ('CZ', '6306150004', True),
+ ('CZ', '5306150004', False),
+ ('CZ', '6300150004', False),
+ ('CZ', '6313150004', False),
+ ('CZ', '6350150004', False),
+ ('CZ', '6363150004', False),
+ ('CZ', '6302000004', False),
+ ('CZ', '6302290004', False),
+ ('CZ', '6402000004', False),
+ ('CZ', '6402310004', False),
+ ('CZ', '6304000004', False),
+ ('CZ', '6304310004', False),
+ ('CZ', '6301000004', False),
+ ('CZ', '6301320004', False),
+ ('CZ', '6306150000', False),
+ ('CZ', '6306150004', True),
+ ('DE', '123456788', True),
+ ('DE', '12345678', False),
+ ('DE', 'A23456788', False),
+ ('DE', '000000088', False),
+ ('DE', '123456770', True),
+ ('DE', '123456789', False),
+ ('DK', '12345674', True),
+ ('DK', '1234564', False),
+ ('DK', 'A2345674', False),
+ ('DK', '02345674', False),
+ ('DK', '12345679', False),
+ ('EE', '123456780', True),
+ ('EE', '1234567890', False),
+ ('EE', 'A23456780', False),
+ ('EE', '123456789', False),
+ ('ES', 'A12345674', True),
+ ('ES', 'P1234567D', True),
+ ('ES', 'K1234567L', True),
+ ('ES', 'R9600075G', True),
+ ('ES', 'W4003922D', True),
+ ('ES', 'V99218067', True),
+ ('ES', 'U99216632', True),
+ ('ES', 'J99216582', True),
+ ('ES', 'U99216426', True),
+ ('ES', '12345678Z', True),
+ ('ES', 'X5277343Q', True),
+ ('ES', 'Y5277343F', True),
+ ('ES', 'Z5277343K', True),
+ ('ES', '1234567890', False),
+ ('ES', 'AB3456789', False),
+ ('ES', 'A12345690', True),
+ ('ES', 'A12345679', False),
+ ('ES', 'WA003922D', False),
+ ('ES', 'W4003922A', False),
+ ('ES', 'ZA277343K', False),
+ ('ES', 'Z5277343A', False),
+ ('ES', '1A345678Z', False),
+ ('ES', '12345678A', False),
+ ('FI', '12345671', True),
+ ('FR', '32123456789', True),
+ ('FR', '2H123456789', True),
+ ('GB', 'GD123', True),
+ ('GB', 'GD888812326', True),
+ ('GB', 'HA567', True),
+ ('GB', 'HA888856782', True),
+ ('GB', '123456782', True),
+ ('GB', '1234567823', True),
+ ('GB', '001123456782', True),
+ ('GB', '0011234567823', True),
+ ('GB', '242338087388', True),
+ ('GR', '12345670', True),
+ ('GR', '123456783', True),
+ ('HR', '12345678903', True),
+ ('HR', '24595836665', True),
+ ('HR', '23448731483', True),
+ ('HU', '12345676', True),
+ ('IE', '7A12345J', True),
+ ('IE', '1234567T', True),
+ ('IT', '12345670017', True),
+ ('LT', '123456715', True),
+ ('LT', '123456789011', True),
+ ('LU', '12345613', True),
+ ('LV', '41234567891', True),
+ ('LV', '15066312345', True),
+ ('MT', '12345634', True),
+ ('NL', '123456782B90', True),
+ ('PL', '1234567883', True),
+ ('PT', '123456789', True),
+ ('RO', '24736200', True),
+ ('RO', '1234567897', True),
+ ('RO', '1630615123457', True),
+ ('RU', '5505035011', True),
+ ('RU', '550501929014', True),
+ ('SE', '123456789701', True),
+ ('SI', '12345679', True),
+ ('SK', '0012345675', True),
+ ('SK', '0012345678', True),
+ ('SK', '531231123', True),
+ ('SK', '6306151234', True),
+ ('SK', '2021853504', True),
+ ('SM', '12345', True),
+ ('UA', '12345678', True),
]
VIES_NUMBERS = [
@@ -94,8 +185,12 @@ class VatNumberTest(unittest.TestCase):
'''
Test VAT numbers
'''
- for code, number in VAT_NUMBERS:
- self.assert_(vatnumber.check_vat(code + number), code + number)
+ for code, number, result in VAT_NUMBERS:
+ if result:
+ test = self.assert_
+ else:
+ test = self.assertFalse
+ test(vatnumber.check_vat(code + number), code + number)
def test_vies(self):
'''
@@ -104,5 +199,11 @@ class VatNumberTest(unittest.TestCase):
for vat in VIES_NUMBERS:
self.assert_(vatnumber.check_vies(vat))
+ def test_countries(self):
+ '''
+ Test countries
+ '''
+ vatnumber.countries()
+
if __name__ == '__main__':
unittest.main()
commit 30afeea7d6255ddf53eb2b7bfa5ad8f73b8a35c8
Author: Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Date: Tue Jul 13 00:47:58 2010 +0200
Releasing debian version 0.6-2.
diff --git a/debian/changelog b/debian/changelog
index 6f87363..9527758 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+vatnumber (1:0.6-2) unstable; urgency=low
+
+ [ Mathias Behrle ]
+ * Adding python-suds to Recommends.
+ * Fixing typo in Recommends.
+
+ [ Daniel Baumann ]
+ * Updating standards version to 3.9.0.
+
+ -- Mathias Behrle <mathiasb at mbsolutions.selfip.biz> Tue, 13 Jul 2010 00:46:00 +0200
+
vatnumber (1:0.6-1) unstable; urgency=low
* Merging upstream version 0.6.
commit 87ed228829f3bdff33ff0afdf7ffe32ae875864c
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Jun 28 20:35:31 2010 +0200
Updating standards version to 3.9.0.
diff --git a/debian/control b/debian/control
index e0fcd64..9b452bf 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders:
Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 7), python, python-setuptools, python-support
-Standards-Version: 3.8.4
+Standards-Version: 3.9.0
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
commit 60f761f4129f368c2eb0b3c4e5ca4705a67a21e8
Author: Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Date: Sat Jun 5 17:39:46 2010 +0200
Fixing typo in Recommends.
diff --git a/debian/control b/debian/control
index 6c112d1..e0fcd64 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
Package: python-vatnumber
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources
-Recommends: python-sud
+Recommends: python-suds
XB-Python-Version: ${python:Versions}
Description: Python module to validate VAT numbers
This is a Python module to check the validity of Value Added Tax (VAT) numbers
commit f7d2623b2184a4ace47d7fcd5a47b50e6ccc1ff8
Author: Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Date: Sat Jun 5 12:56:25 2010 +0200
Adding python-suds to Recommends.
diff --git a/debian/control b/debian/control
index 207c6e1..6c112d1 100644
--- a/debian/control
+++ b/debian/control
@@ -15,6 +15,7 @@ Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
Package: python-vatnumber
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources
+Recommends: python-sud
XB-Python-Version: ${python:Versions}
Description: Python module to validate VAT numbers
This is a Python module to check the validity of Value Added Tax (VAT) numbers
commit aeff50b23ae55a4ebc436fc1d823bc2692a0a64d
Author: Daniel Baumann <daniel at debian.org>
Date: Mon May 31 08:17:34 2010 +0200
Releasing debian version 0.6-1.
diff --git a/debian/changelog b/debian/changelog
index 0dd9bb5..6f87363 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (1:0.6-1) unstable; urgency=low
+
+ * Merging upstream version 0.6.
+ * Updating year in copyright file.
+
+ -- Daniel Baumann <daniel at debian.org> Mon, 31 May 2010 08:17:23 +0200
+
vatnumber (1:0.5-3) unstable; urgency=low
* Adding Dm-Upload-Allowed in control in preparation for Mathias.
commit 6db947d17afa02bbf60e154896ad6f15bb12ad54
Author: Daniel Baumann <daniel at debian.org>
Date: Mon May 31 08:17:10 2010 +0200
Updating year in copyright file.
diff --git a/debian/copyright b/debian/copyright
index 2aa5825..a116829 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -7,8 +7,8 @@ Maintainer-Homepage: http://tryton.debian-maintainers.org/
Files: *
Copyright:
- (C) 2008-2009 Cedric Krier
- (C) 2008-2009 B2CK
+ (C) 2008-2010 Cedric Krier
+ (C) 2008-2010 B2CK
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
commit 6b041fae0cafd9c2e0117b07af50a3d47c3b373d
Author: Daniel Baumann <daniel at debian.org>
Date: Mon May 31 08:16:14 2010 +0200
Merging upstream version 0.6.
diff --git a/CHANGELOG b/CHANGELOG
index 7fd1a12..97507d5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,11 @@
+Version 0.6 - 2010-05-30
+* Add generic check_vat method
+* Replace SOAPpy by suds
+* Add GB validation for {GB,HA}888 8xxx yy format
+* Add GB validation for branch traders 12 digits
+* Update vies SOAP URL and add unittest
+* Add Check Russia VAT number
+
Version 0.5 - 2009-11-13
* Add Check Chile RUT number for issue5
* Add Check Colombian RUT number for issue4
diff --git a/COPYRIGHT b/COPYRIGHT
index 9f89bf3..636799b 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (c) 2008-2009 Cédric Krier.
-Copyright (c) 2008-2009 B2CK.
+Copyright (c) 2008-2010 Cédric Krier.
+Copyright (c) 2008-2010 B2CK.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/INSTALL b/INSTALL
index f86c8aa..499bfa0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -5,7 +5,7 @@ Prerequisites
-------------
* Python (http://www.python.org/)
- * SOAPpy (http://pywebsvcs.sourceforge.net/)
+ * suds (https://fedorahosted.org/suds/)
Installation
------------
diff --git a/PKG-INFO b/PKG-INFO
index 0fd16d5..76bfeaa 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,13 +1,37 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.5
+Version: 0.6
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
Author-email: info at b2ck.com
License: GPL-3
Download-URL: http://code.google.com/p/vatnumber/downloads/
-Description: UNKNOWN
+Description: vatnumber
+ =========
+
+ Python module to validate VAT numbers.
+
+ Nutshell
+ --------
+
+ Here a simple example to validate VAT numbers format::
+
+ >>> import vatnumber
+ >>> vatnumber.check_vat('BE0123456749')
+ True
+
+ Here a simple example to validate European VAT through VIES service::
+
+ >>> import vatnumber
+ >>> vatnumber.check_vies('BE0897290877')
+ True
+
+
+ For more information please visit the `vatnumber website_`.
+
+ .. _vatnumber website: http://code.google.com/p/vatnumber/
+
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
diff --git a/README b/README
index ced6901..0696fe0 100644
--- a/README
+++ b/README
@@ -3,6 +3,22 @@ vatnumber
Python module to validate VAT numbers.
-For more information please visit the vatnumber web site:
+Nutshell
+--------
- <http://code.google.com/p/vatnumber/>
+Here a simple example to validate VAT numbers format::
+
+ >>> import vatnumber
+ >>> vatnumber.check_vat('BE0123456749')
+ True
+
+Here a simple example to validate European VAT through VIES service::
+
+ >>> import vatnumber
+ >>> vatnumber.check_vies('BE0897290877')
+ True
+
+
+For more information please visit the `vatnumber website_`.
+
+.. _vatnumber website: http://code.google.com/p/vatnumber/
diff --git a/setup.py b/setup.py
index b5423d8..e726086 100644
--- a/setup.py
+++ b/setup.py
@@ -2,17 +2,22 @@
#This file is part of vatnumber. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
-from setuptools import setup
+import os
+from setuptools import setup, find_packages
import vatnumber
+def read(fname):
+ return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
setup(name='vatnumber',
version=vatnumber.__version__,
author='B2CK',
author_email='info at b2ck.com',
url="http://code.google.com/p/vatnumber/",
description="Python module to validate VAT numbers",
+ long_description=read('README'),
download_url="http://code.google.com/p/vatnumber/downloads/",
- py_modules=['vatnumber'],
+ packages=find_packages(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
@@ -24,5 +29,8 @@ setup(name='vatnumber',
'Topic :: Software Development :: Libraries :: Python Modules',
],
license='GPL-3',
- test_suite="tests",
+ extras_require={
+ 'suds': ['suds'],
+ },
+ test_suite="vatnumber.tests",
)
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index 0fd16d5..76bfeaa 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,13 +1,37 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.5
+Version: 0.6
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
Author-email: info at b2ck.com
License: GPL-3
Download-URL: http://code.google.com/p/vatnumber/downloads/
-Description: UNKNOWN
+Description: vatnumber
+ =========
+
+ Python module to validate VAT numbers.
+
+ Nutshell
+ --------
+
+ Here a simple example to validate VAT numbers format::
+
+ >>> import vatnumber
+ >>> vatnumber.check_vat('BE0123456749')
+ True
+
+ Here a simple example to validate European VAT through VIES service::
+
+ >>> import vatnumber
+ >>> vatnumber.check_vies('BE0897290877')
+ True
+
+
+ For more information please visit the `vatnumber website_`.
+
+ .. _vatnumber website: http://code.google.com/p/vatnumber/
+
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
diff --git a/vatnumber.egg-info/SOURCES.txt b/vatnumber.egg-info/SOURCES.txt
index 639f54a..93e4a11 100644
--- a/vatnumber.egg-info/SOURCES.txt
+++ b/vatnumber.egg-info/SOURCES.txt
@@ -5,8 +5,10 @@ LICENSE
MANIFEST.in
README
setup.py
-vatnumber.py
+vatnumber/__init__.py
+vatnumber/tests.py
vatnumber.egg-info/PKG-INFO
vatnumber.egg-info/SOURCES.txt
vatnumber.egg-info/dependency_links.txt
+vatnumber.egg-info/requires.txt
vatnumber.egg-info/top_level.txt
\ No newline at end of file
diff --git a/vatnumber.egg-info/requires.txt b/vatnumber.egg-info/requires.txt
new file mode 100644
index 0000000..6449f6c
--- /dev/null
+++ b/vatnumber.egg-info/requires.txt
@@ -0,0 +1,4 @@
+
+
+[suds]
+suds
\ No newline at end of file
diff --git a/vatnumber.py b/vatnumber/__init__.py
similarity index 93%
rename from vatnumber.py
rename to vatnumber/__init__.py
index 9b8f6a5..c205c16 100644
--- a/vatnumber.py
+++ b/vatnumber/__init__.py
@@ -6,8 +6,8 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.5'
-VIES_URL='http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl'
+__version__ = '0.6'
+VIES_URL='http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl'
def countries():
'''
@@ -536,48 +536,61 @@ def check_vat_gb(vat):
return False
return True
return False
- elif len(vat) in (9, 10):
+ elif len(vat) == 11 \
+ and vat[0:6] in ('GD8888', 'HA8888'):
+ try:
+ int(vat[6:11])
+ except ValueError:
+ return False
+ if vat[0:2] == 'GD' \
+ and int(vat[6:9]) >= 500:
+ return False
+ elif vat[0:2] == 'HA' \
+ and int(vat[6:9]) < 500:
+ return False
+ if int(vat[6:9]) % 97 == int(vat[9:11]):
+ return True
+ return False
+ elif len(vat) in (12, 13) \
+ and vat[0:3] in ('000', '001'):
try:
int(vat)
except ValueError:
return False
- if int(vat[0:7]) < 1:
+ if int(vat[3:10]) < 1:
return False
- if int(vat[0:7]) > 19999 and int(vat[0:7]) < 1000000:
+ if int(vat[3:10]) > 19999 and int(vat[3:10]) < 1000000:
return False
- if int(vat[7:9]) > 97:
+ if int(vat[10:12]) > 97:
return False
- if len(vat) == 10 and int(vat[9]) != 3:
+ if len(vat) == 13 and int(vat[12]) != 3:
return False
- check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
- 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
- 2 * int(vat[6]) + 10 * int(vat[7]) + int(vat[8])
+ check_sum = 8 * int(vat[3]) + 7 * int(vat[4]) + 6 * int(vat[5]) + \
+ 5 * int(vat[6]) + 4 * int(vat[7]) + 3 * int(vat[8]) + \
+ 2 * int(vat[9]) + 10 * int(vat[10]) + int(vat[11])
if check_sum % 97 != 0:
return False
return True
- elif len(vat) in (12, 13):
+ elif len(vat) in (9, 10, 12):
try:
int(vat)
except ValueError:
return False
- if int(vat[0:3]) not in (0, 1):
- return False
-
- if int(vat[3:10]) < 1:
+ if int(vat[0:7]) < 1:
return False
- if int(vat[3:10]) > 19999 and int(vat[3:10]) < 1000000:
+ if int(vat[0:7]) > 19999 and int(vat[0:7]) < 1000000:
return False
- if int(vat[10:12]) > 97:
+ if int(vat[7:9]) > 97:
return False
- if len(vat) == 13 and int(vat[12]) != 3:
+ if len(vat) == 10 and int(vat[9]) != 3:
return False
- check_sum = 8 * int(vat[3]) + 7 * int(vat[4]) + 6 * int(vat[5]) + \
- 5 * int(vat[6]) + 4 * int(vat[7]) + 3 * int(vat[8]) + \
- 2 * int(vat[9]) + 10 * int(vat[10]) + int(vat[11])
+ check_sum = 8 * int(vat[0]) + 7 * int(vat[1]) + 6 * int(vat[2]) + \
+ 5 * int(vat[3]) + 4 * int(vat[4]) + 3 * int(vat[5]) + \
+ 2 * int(vat[6]) + 10 * int(vat[7]) + int(vat[8])
if check_sum % 97 != 0:
return False
return True
@@ -1088,13 +1101,57 @@ def check_vat_uk(vat):
'''
return check_vat_gb(vat)
+def check_vat_ru(vat):
+ '''
+ Check Russia VAT number.
+ '''
+ if len(vat) != 10 and len(vat) != 12:
+ return False
+ try:
+ int(vat)
+ except ValueError:
+ return False
+
+ if len(vat) == 10:
+ check_sum = 2 * int(vat[0]) + 4 * int(vat[1]) + 10 * int(vat[2]) + \
+ 3 * int(vat[3]) + 5 * int(vat[4]) + 9 * int(vat[5]) + \
+ 4 * int(vat[6]) + 6 * int(vat[7]) + 8 * int(vat[8])
+ check = check_sum % 11
+ if check % 10 != int(vat[9]):
+ return False
+ else:
+ check_sum1 = 7 * int(vat[0]) + 2 * int(vat[1]) + 4 * int(vat[2]) + \
+ 10 * int(vat[3]) + 3 * int(vat[4]) + 5 * int(vat[5]) + \
+ 9 * int(vat[6]) + 4 * int(vat[7]) + 6 * int(vat[8]) + \
+ 8 * int(vat[9])
+ check = check_sum1 % 11
+
+ if check != int(vat[10]):
+ return False
+ check_sum2 = 3 * int(vat[0]) + 7 * int(vat[1]) + 2 * int(vat[2]) + \
+ 4 * int(vat[3]) + 10 * int(vat[4]) + 3 * int(vat[5]) + \
+ 5 * int(vat[6]) + 9 * int(vat[7]) + 4 * int(vat[8]) + \
+ 6 * int(vat[9]) + 8 * int(vat[10])
+ check = check_sum2 % 11
+ if check != int(vat[11]):
+ return False
+ return True
+
+def check_vat(vat):
+ '''
+ Check VAT number.
+ '''
+ code = vat[:2].lower()
+ number = vat[2:]
+ return globals()['check_vat_%s' % code](number)
+
def check_vies(vat):
'''
Check VAT number for EU member state using the SOAP Service
'''
- from SOAPpy import WSDL
+ from suds.client import Client
+ client = Client(VIES_URL)
code = vat[:2]
number = vat[2:]
- server = WSDL.Proxy(VIES_URL)
- res = server.checkVat(code, number)
+ res = client.service.checkVat(countryCode=code, vatNumber=number)
return bool(res['valid'])
diff --git a/vatnumber/tests.py b/vatnumber/tests.py
new file mode 100644
index 0000000..2152edb
--- /dev/null
+++ b/vatnumber/tests.py
@@ -0,0 +1,108 @@
+#This file is part of vatnumber. The COPYRIGHT file at the top level of
+#this repository contains the full copyright notices and license terms.
+'''
+Unit test for vatnumber
+'''
+
+import unittest
+import vatnumber
+
+VAT_NUMBERS = [
+ ('AT', 'U12345675'),
+ ('AL', 'K99999999L'),
+ ('BE', '0123456749'),
+ ('BG', '1234567892'),
+ ('BG', '175074752'),
+ ('BG', '131202360'),
+ ('BG', '040683212'),
+ ('CL', '334441113'),
+ ('CO', '9001279338'),
+ ('CY', '12345678F'),
+ ('CZ', '12345679'),
+ ('CZ', '612345670'),
+ ('CZ', '991231123'),
+ ('CZ', '6306150004'),
+ ('DE', '123456788'),
+ ('DK', '12345674'),
+ ('EE', '123456780'),
+ ('ES', 'A12345674'),
+ ('ES', 'P1234567D'),
+ ('ES', 'K1234567L'),
+ ('ES', 'R9600075G'),
+ ('ES', 'W4003922D'),
+ ('ES', 'V99218067'),
+ ('ES', 'U99216632'),
+ ('ES', 'J99216582'),
+ ('ES', 'U99216426'),
+ ('ES', '12345678Z'),
+ ('ES', 'X5277343Q'),
+ ('ES', 'Y5277343F'),
+ ('ES', 'Z5277343K'),
+ ('FI', '12345671'),
+ ('FR', '32123456789'),
+ ('FR', '2H123456789'),
+ ('GB', 'GD123'),
+ ('GB', 'GD888812326'),
+ ('GB', 'HA567'),
+ ('GB', 'HA888856782'),
+ ('GB', '123456782'),
+ ('GB', '1234567823'),
+ ('GB', '001123456782'),
+ ('GB', '0011234567823'),
+ ('GB', '242338087388'),
+ ('GR', '12345670'),
+ ('GR', '123456783'),
+ ('HU', '12345676'),
+ ('IE', '7A12345J'),
+ ('IE', '1234567T'),
+ ('IT', '12345670017'),
+ ('LT', '123456715'),
+ ('LT', '123456789011'),
+ ('LU', '12345613'),
+ ('LV', '41234567891'),
+ ('LV', '15066312345'),
+ ('MT', '12345634'),
+ ('NL', '123456782B90'),
+ ('PL', '1234567883'),
+ ('PT', '123456789'),
+ ('RO', '24736200'),
+ ('RO', '1234567897'),
+ ('RO', '1630615123457'),
+ ('RU', '5505035011'),
+ ('RU', '550501929014'),
+ ('SE', '123456789701'),
+ ('SI', '12345679'),
+ ('SK', '0012345675'),
+ ('SK', '0012345678'),
+ ('SK', '531231123'),
+ ('SK', '6306151234'),
+ ('SM', '12345'),
+ ('UA', '12345678'),
+]
+
+VIES_NUMBERS = [
+ 'BE0897290877',
+]
+
+
+class VatNumberTest(unittest.TestCase):
+ '''
+ Test Case for vatnumber
+ '''
+
+ def test_vat_numbers(self):
+ '''
+ Test VAT numbers
+ '''
+ for code, number in VAT_NUMBERS:
+ self.assert_(vatnumber.check_vat(code + number), code + number)
+
+ def test_vies(self):
+ '''
+ Test vies
+ '''
+ for vat in VIES_NUMBERS:
+ self.assert_(vatnumber.check_vies(vat))
+
+if __name__ == '__main__':
+ unittest.main()
commit 49d8418dcda5ead6d4bc8213ab7ee91ae49b8b18
Author: Daniel Baumann <daniel at debian.org>
Date: Thu May 13 22:17:42 2010 +0200
Releasing debian version 0.5-3.
diff --git a/debian/changelog b/debian/changelog
index 19a5114..0dd9bb5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+vatnumber (1:0.5-3) unstable; urgency=low
+
+ * Adding Dm-Upload-Allowed in control in preparation for Mathias.
+
+ -- Daniel Baumann <daniel at debian.org> Thu, 13 May 2010 22:17:39 +0200
+
vatnumber (1:0.5-2) unstable; urgency=low
* Adding explicit debian source version 1.0 until switch to 3.0.
commit a95d7b6e2542391d70d833cba4f32c7ecc434554
Author: Daniel Baumann <daniel at debian.org>
Date: Fri Apr 9 14:31:33 2010 +0200
Adding Dm-Upload-Allowed in control in preparation for Mathias.
diff --git a/debian/control b/debian/control
index eb29ba4..207c6e1 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
Uploaders:
Daniel Baumann <daniel at debian.org>,
Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
+Dm-Upload-Allowed: yes
Build-Depends: debhelper (>= 7), python, python-setuptools, python-support
Standards-Version: 3.8.4
Homepage: http://code.google.com/p/vatnumber/
commit a1cb4c91d0b31af7f510669cc5f84a164caf023b
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Feb 20 11:09:00 2010 +0100
Releasing debian version 0.5-2.
diff --git a/debian/changelog b/debian/changelog
index 6ffc687..19a5114 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+vatnumber (1:0.5-2) unstable; urgency=low
+
+ * Adding explicit debian source version 1.0 until switch to 3.0.
+ * Updating year in copyright file.
+ * Removing unneeded python-all-dev from build-depends.
+ * Updating to standards 3.8.4.
+ * Updating README.source.
+
+ -- Daniel Baumann <daniel at debian.org> Sat, 20 Feb 2010 11:08:57 +0100
+
vatnumber (1:0.5-1) unstable; urgency=low
* Merging upstream version 0.5.
commit 323755d4b70b24669583ed8635632e3e5f7a9272
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Feb 20 11:08:41 2010 +0100
Updating README.source.
diff --git a/debian/README.source b/debian/README.source
index dcc7ba3..18b6b24 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -32,6 +32,6 @@ upstream source. Changes, if any, are stored in the source package as diffs in
debian/diff and are applied during the build. Current modifications can be
applied to the source tree with:
- $ quilt push -a
+ $ QUILT_PATCHES=debian/patches quilt push -a
More information about Quilt can be found in the quilt package.
commit ac6f480e473de2a4c380a8487ac51cc607795825
Author: Daniel Baumann <daniel at debian.org>
Date: Thu Jan 28 07:53:22 2010 +0100
Updating to standards 3.8.4.
diff --git a/debian/control b/debian/control
index 5757c56..eb29ba4 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Uploaders:
Daniel Baumann <daniel at debian.org>,
Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Build-Depends: debhelper (>= 7), python, python-setuptools, python-support
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
commit a8cfd15176073601b24bec5159e03f9b617d6a5a
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Jan 25 10:12:28 2010 +0100
Removing unneeded python-all-dev from build-depends.
diff --git a/debian/control b/debian/control
index 4642557..5757c56 100644
--- a/debian/control
+++ b/debian/control
@@ -5,8 +5,7 @@ Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
Uploaders:
Daniel Baumann <daniel at debian.org>,
Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
-Build-Depends:
- debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
+Build-Depends: debhelper (>= 7), python, python-setuptools, python-support
Standards-Version: 3.8.3
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
commit 6842197cb2f2917b5fed2bf44c1676d113d7939e
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Jan 2 11:35:53 2010 +0100
Updating year in copyright file.
diff --git a/debian/copyright b/debian/copyright
index f30c387..2aa5825 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -27,7 +27,7 @@ License: GPL-3+
can be found in /usr/share/common-licenses/GPL-3 file.
Files: debian/*
-Copyright: (C) 2009 Daniel Baumann <daniel at debian.org>
+Copyright: (C) 2009-2010 Daniel Baumann <daniel at debian.org>
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
commit 1c05913ada293a1ffbc0ff35eebe9ea74a2ec2e6
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Dec 12 10:06:54 2009 +0100
Adding explicit debian source version 1.0 until switch to 3.0.
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..d3827e7
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+1.0
commit a7854b6ba946c583dab96bd17bb27f0daeb573d6
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Nov 16 20:33:36 2009 +0100
Releasing debian version 0.5-1.
diff --git a/debian/changelog b/debian/changelog
index 2be063c..6ffc687 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (1:0.5-1) unstable; urgency=low
+
+ * Merging upstream version 0.5.
+ * Updating year in copyright file.
+
+ -- Daniel Baumann <daniel at debian.org> Mon, 16 Nov 2009 20:33:28 +0100
+
vatnumber (1:0.4-5) unstable; urgency=low
* Correcting spelling error in package long-description.
commit a9b65492e07768b271a92bcc21c9f79000223998
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Nov 16 20:32:51 2009 +0100
Updating year in copyright file.
diff --git a/debian/copyright b/debian/copyright
index 8e9c97a..f30c387 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -7,8 +7,8 @@ Maintainer-Homepage: http://tryton.debian-maintainers.org/
Files: *
Copyright:
- (C) 2008 Cedric Krier
- (C) 2008 B2CK
+ (C) 2008-2009 Cedric Krier
+ (C) 2008-2009 B2CK
License: GPL-3+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
commit 74a90e49504d6242d6ffbda828dbeaa6fd4354d9
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Nov 16 20:31:58 2009 +0100
Merging upstream version 0.5.
diff --git a/CHANGELOG b/CHANGELOG
index bfab834..7fd1a12 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+Version 0.5 - 2009-11-13
+* Add Check Chile RUT number for issue5
+* Add Check Colombian RUT number for issue4
+* Fix Portugal VAT when check number is 11
+
Version 0.4 - 2009-03-30
* Update Spain test for issue3 thanks to carlos at pemas.es
* Add VIES check with the SOAP Service of EU
diff --git a/COPYRIGHT b/COPYRIGHT
index 1e5eeaa..9f89bf3 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (c) 2008 Cedric Krier.
-Copyright (c) 2008 B2CK.
+Copyright (c) 2008-2009 Cédric Krier.
+Copyright (c) 2008-2009 B2CK.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index 4d895b9..0fd16d5 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.4
+Version: 0.5
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index 4d895b9..0fd16d5 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.4
+Version: 0.5
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.py b/vatnumber.py
index e5b08f6..9b8f6a5 100644
--- a/vatnumber.py
+++ b/vatnumber.py
@@ -6,7 +6,7 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.4'
+__version__ = '0.5'
VIES_URL='http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl'
def countries():
@@ -113,6 +113,46 @@ def check_vat_bg(vat):
return False
return True
+def check_vat_cl(rut):
+ '''
+ Check Chile RUT number.
+ '''
+ try:
+ int(str(rut)[:len(str(rut))-1])
+ except ValueError:
+ return False
+ sum = 0
+ RUTLen = len(str(rut))
+ for i in range (RUTLen - 2, -1, -1):
+ sum += int(str(rut)[i]) * (((RUTLen - 2 - i) % 6) + 2)
+ check = 11 - (sum % 11)
+ if check == 11:
+ return str(rut)[len(str(rut)) -1] == '0'
+ elif check == 10:
+ return str(rut)[len(str(rut)) -1].upper() == 'K'
+ else:
+ return str(check) == str(rut)[len(str(rut)) -1]
+
+def check_vat_co(rut):
+ '''
+ Check Colombian RUT number.
+ '''
+ if len(str(rut)) != 10:
+ return False
+ try:
+ int(rut)
+ except ValueError:
+ return False
+ nums = [3, 7, 13, 17, 19, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71]
+ sum = 0
+ RUTLen = len(str(rut))
+ for i in range (RUTLen - 2, -1, -1):
+ sum += int(str(rut)[i]) * nums [RUTLen - 2 - i]
+ if sum % 11 > 1:
+ return str(rut)[RUTLen - 1] == str(11 - (sum % 11))
+ else:
+ return str(rut)[RUTLen - 1] == str(sum % 11)
+
def check_vat_cy(vat):
'''
Check Cyprus VAT number.
@@ -869,7 +909,7 @@ def check_vat_pt(vat):
6 * int(vat[3]) + 5 * int(vat[4]) + 4 * int(vat[5]) + \
3 * int(vat[6]) + 2 * int(vat[7])
check = 11 - (check_sum % 11)
- if check == 10:
+ if check == 10 or check == 11:
check = 0
if check != int(vat[8]):
return False
commit 40607249971ae2fa1e9e1a441c37bbd746d5da9b
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Sep 5 09:36:41 2009 +0200
Releasing debian version 0.4-5.
diff --git a/debian/changelog b/debian/changelog
index d3717b6..2be063c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+vatnumber (1:0.4-5) unstable; urgency=low
+
+ * Correcting spelling error in package long-description.
+ * Updating to standards version 3.8.3.
+ * Adding maintainer homepage field to control.
+ * Adding README.source.
+ * Moving maintainer homepage field to copyright.
+ * Updating README.source.
+
+ -- Daniel Baumann <daniel at debian.org> Sat, 05 Sep 2009 09:36:23 +0200
+
vatnumber (1:0.4-4) unstable; urgency=low
[ Mathias Behrle ]
commit 8c4840d541cdbef741aeeb8da6fa05384fd15eba
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Sep 5 09:31:18 2009 +0200
Updating README.source.
diff --git a/debian/README.source b/debian/README.source
index 259f923..dcc7ba3 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -4,7 +4,7 @@ Package Repositories
Backports for the current stable debian distribution as well as snapshots of
unreleased versions may be available in repositories listed on the maintainers
homepage. The current URL of the maintainer homepage can be seen in
-debian/control.
+debian/copyright.
Source Access
commit ed412d683abf8938f283c58ba136a5449b64e8b0
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Sep 5 08:54:54 2009 +0200
Moving maintainer homepage field to copyright.
diff --git a/debian/control b/debian/control
index e9ed44e..4642557 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,6 @@ Standards-Version: 3.8.3
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
-XSBC-Maintainer-Homepage: http://tryton.debian-maintainers.org/
Package: python-vatnumber
Architecture: all
diff --git a/debian/copyright b/debian/copyright
index 6c4f243..8e9c97a 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,7 +1,9 @@
-Authors:
- Cedric Krier
- Bertrand Chenal
+Upstream-Contact:
+ Cedric Krier <cedric.krier at b2ck.com>
+ Bertrand Chenal <bertrand.chenal at b2ck.com>
Download: http://code.google.com/p/vatnumber/
+Maintainer-Contact: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
+Maintainer-Homepage: http://tryton.debian-maintainers.org/
Files: *
Copyright:
commit 21096b12545d1ce6fa05e35f4de2ec44f0f19a66
Author: Daniel Baumann <daniel at debian.org>
Date: Tue Aug 25 08:18:47 2009 +0200
Adding README.source.
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..259f923
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,37 @@
+Package Repositories
+--------------------
+
+Backports for the current stable debian distribution as well as snapshots of
+unreleased versions may be available in repositories listed on the maintainers
+homepage. The current URL of the maintainer homepage can be seen in
+debian/control.
+
+
+Source Access
+-------------
+
+You can obtain the sources of this package with:
+
+ $ apt-get source ${PACKAGE}
+
+whereas '${PACKAGE}' has to be replaced with the actual name of the package.
+
+This package is maintained with the Git version control system. The current git
+source tree can be obtained with:
+
+ $ git clone ${GIT_URI}
+
+whereas '${GIT_URI}' has to be replaced with the actual URI for the Git
+repository. The current Git URI can be seen in debian/control in the extracted
+package sources.
+
+More information about Git can be found in the git-core package.
+
+This package may use the Quilt patch system to manage all modifications to the
+upstream source. Changes, if any, are stored in the source package as diffs in
+debian/diff and are applied during the build. Current modifications can be
+applied to the source tree with:
+
+ $ quilt push -a
+
+More information about Quilt can be found in the quilt package.
commit 77f7616eb8363b94165bb5e59d4b05f36080a817
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Aug 24 17:51:39 2009 +0200
Adding maintainer homepage field to control.
diff --git a/debian/control b/debian/control
index 4642557..e9ed44e 100644
--- a/debian/control
+++ b/debian/control
@@ -11,6 +11,7 @@ Standards-Version: 3.8.3
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
+XSBC-Maintainer-Homepage: http://tryton.debian-maintainers.org/
Package: python-vatnumber
Architecture: all
commit 86dde481584baa59168b8b01361c90ebdaa39cd6
Author: Daniel Baumann <daniel at debian.org>
Date: Sun Aug 16 10:13:47 2009 +0200
Updating to standards version 3.8.3.
diff --git a/debian/control b/debian/control
index 4baef88..4642557 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders:
Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Build-Depends:
debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
-Standards-Version: 3.8.2
+Standards-Version: 3.8.3
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
commit 71f1dba51ba2267db7403e040c7c6472dd5b72fc
Author: Daniel Baumann <daniel at debian.org>
Date: Tue Aug 11 21:30:06 2009 +0200
Correcting spelling error in package long-description.
diff --git a/debian/control b/debian/control
index 54d8ab9..4baef88 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@ Description: Python module to validate VAT numbers
This is a Python module to check the validity of Value Added Tax (VAT) numbers
of States inside the European Union. It uses the validation rules according to
http://sima-pc.com/nif.php.
- Additionaly this module provides a function for online validation of given VAT
+ Additionally this module provides a function for online validation of given VAT
numbers by the VIES VAT number validation (SOAP Service) of the Taxation and
Customs Union:
http://ec.europa.eu/taxation_customs/vies/vieshome.do
commit 79094ef8cf7e0da1eb954aeadabbeed56de1453f
Author: Daniel Baumann <daniel at debian.org>
Date: Tue Aug 11 21:27:37 2009 +0200
Releasing debian version 0.4-4.
diff --git a/debian/changelog b/debian/changelog
index cef4d90..d3717b6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (1:0.4-4) unstable; urgency=low
+
+ [ Mathias Behrle ]
+ * Updating package description (Closes: #520099).
+
+ -- Daniel Baumann <daniel at debian.org> Tue, 11 Aug 2009 21:27:32 +0200
+
vatnumber (1:0.4-3) unstable; urgency=low
* Updating maintainer field.
commit 84cfb461c725cf4c69142650b619f14cbee7ebaa
Author: Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Date: Tue Aug 11 13:41:44 2009 +0200
Updating package description (Closes: #520099).
diff --git a/debian/control b/debian/control
index 67c2857..54d8ab9 100644
--- a/debian/control
+++ b/debian/control
@@ -17,5 +17,10 @@ Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources
XB-Python-Version: ${python:Versions}
Description: Python module to validate VAT numbers
- This is a Python module to check Value Added Tax (VAT) numbers for their
- validity.
+ This is a Python module to check the validity of Value Added Tax (VAT) numbers
+ of States inside the European Union. It uses the validation rules according to
+ http://sima-pc.com/nif.php.
+ Additionaly this module provides a function for online validation of given VAT
+ numbers by the VIES VAT number validation (SOAP Service) of the Taxation and
+ Customs Union:
+ http://ec.europa.eu/taxation_customs/vies/vieshome.do
commit b628b0a31deefadc31f0db09b7b9f795bca574ea
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Aug 10 20:32:45 2009 +0200
Releasing debian version 0.4-3.
diff --git a/debian/changelog b/debian/changelog
index 3cced02..cef4d90 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+vatnumber (1:0.4-3) unstable; urgency=low
+
+ * Updating maintainer field.
+ * Updating vcs fields.
+ * Adding Mathias as co-maintainer.
+ * Wrapping lines in control.
+
+ -- Daniel Baumann <daniel at debian.org> Mon, 10 Aug 2009 20:32:44 +0200
+
vatnumber (1:0.4-2) unstable; urgency=low
* Using correct rfc-2822 date formats in changelog.
commit b422d0c0780fc1efc779caa39ba2a9d4b37262f1
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Aug 10 20:32:40 2009 +0200
Wrapping lines in control.
diff --git a/debian/control b/debian/control
index 479c08b..67c2857 100644
--- a/debian/control
+++ b/debian/control
@@ -2,8 +2,11 @@ Source: vatnumber
Section: python
Priority: optional
Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
-Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
-Build-Depends: debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
+Uploaders:
+ Daniel Baumann <daniel at debian.org>,
+ Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
+Build-Depends:
+ debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
Standards-Version: 3.8.2
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
commit 644ba6942a75a994d608277a90e4c0877baefe60
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Aug 10 12:35:07 2009 +0200
Adding Mathias as co-maintainer.
diff --git a/debian/control b/debian/control
index c7ba9b1..479c08b 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: vatnumber
Section: python
Priority: optional
Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
-Uploaders: Daniel Baumann <daniel at debian.org>
+Uploaders: Daniel Baumann <daniel at debian.org>, Mathias Behrle <mathiasb at mbsolutions.selfip.biz>
Build-Depends: debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
Standards-Version: 3.8.2
Homepage: http://code.google.com/p/vatnumber/
commit a1654bf263f413edc2a2ad93d929bd9544674f24
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Aug 8 23:26:50 2009 +0200
Updating vcs fields.
diff --git a/debian/control b/debian/control
index bf824eb..c7ba9b1 100644
--- a/debian/control
+++ b/debian/control
@@ -6,8 +6,8 @@ Uploaders: Daniel Baumann <daniel at debian.org>
Build-Depends: debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
Standards-Version: 3.8.2
Homepage: http://code.google.com/p/vatnumber/
-Vcs-Browser: http://git.debian.net/?p=debian/vatnumber.git
-Vcs-Git: git://git.debian.net/git/debian/vatnumber.git
+Vcs-Browser: http://git.debian-maintainers.org/?p=tryton/vatnumber.git
+Vcs-Git: git://git.debian-maintainers.org/git/tryton/vatnumber.git
Package: python-vatnumber
Architecture: all
commit f5c1c028c188980e3e3b63d51c579a46440d09f2
Author: Daniel Baumann <daniel at debian.org>
Date: Sat Aug 8 23:19:31 2009 +0200
Updating maintainer field.
diff --git a/debian/control b/debian/control
index 972493b..bf824eb 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,8 @@
Source: vatnumber
Section: python
Priority: optional
-Maintainer: Daniel Baumann <daniel at debian.org>
+Maintainer: Debian Tryton Maintainers <tryton at lists.debian-maintainers.org>
+Uploaders: Daniel Baumann <daniel at debian.org>
Build-Depends: debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
Standards-Version: 3.8.2
Homepage: http://code.google.com/p/vatnumber/
commit ed7bd43cdd01287e56e0a19b42a6bca34fe7db3d
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Jul 27 14:51:40 2009 +0200
Releasing debian version 0.4-2.
diff --git a/debian/changelog b/debian/changelog
index 3598f26..3cced02 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+vatnumber (1:0.4-2) unstable; urgency=low
+
+ * Using correct rfc-2822 date formats in changelog.
+ * Updating to standards version 3.8.2.
+ * Minimizing rules file.
+
+ -- Daniel Baumann <daniel at debian.org> Mon, 27 Jul 2009 14:51:33 +0200
+
vatnumber (0.4-1) unstable; urgency=low
* Merging upstream version 0.4.
commit 2bb8808a14bc0d538a21308e675dc88091b71a52
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Jul 27 14:49:59 2009 +0200
Minimizing rules file.
diff --git a/debian/rules b/debian/rules
index 05dd8a1..000210b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,43 +1,4 @@
#!/usr/bin/make -f
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
-
- python setup.py clean
- rm -rf dist build vatnumber.egg-info
- find . -type f -name "*.pyc" | xargs rm -f
-
- dh_clean
-
-build:
-
-install:
- dh_testdir
- dh_testroot
- dh_prep
- dh_installdirs
-
- python setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/python-vatnumber --install-lib /usr/share/python-support/python-vatnumber
-
- find debian/python-vatnumber -type f -name "*.pyc" | xargs rm -f
-
-binary: binary-indep
-
-binary-arch:
-
-binary-indep: install
- dh_testdir
- dh_testroot
- dh_installchangelogs CHANGELOG
- dh_installdocs
- dh_pysupport
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-.PHONY: clean build install binary binary-arch binary-indep
+%:
+ dh ${@}
commit 758cb5e013febeb7edd50d0468ccd8787dee46b4
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Jul 27 14:49:54 2009 +0200
Updating to standards version 3.8.2.
diff --git a/debian/control b/debian/control
index a3bd154..972493b 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: python
Priority: optional
Maintainer: Daniel Baumann <daniel at debian.org>
Build-Depends: debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
-Standards-Version: 3.8.1
+Standards-Version: 3.8.2
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian.net/?p=debian/vatnumber.git
Vcs-Git: git://git.debian.net/git/debian/vatnumber.git
commit 8608a64959788d575d96889c7aec8610d964fbfd
Author: Daniel Baumann <daniel at debian.org>
Date: Mon May 4 11:47:45 2009 +0200
Using correct rfc-2822 date formats in changelog.
diff --git a/debian/changelog b/debian/changelog
index 7a88921..3598f26 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,7 +16,7 @@ vatnumber (0.2-2) unstable; urgency=low
* Correcting typo in control, architecture should have been arch all,
not any.
- -- Daniel Baumann <daniel at debian.org> Wed, 4 Feb 2009 20:41:00 +0100
+ -- Daniel Baumann <daniel at debian.org> Wed, 04 Feb 2009 20:41:00 +0100
vatnumber (0.2-1) unstable; urgency=low
commit f21dfc3ac019947545d403ad656e225738f6c4ba
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Mar 30 11:04:29 2009 +0200
Releasing debian version 0.4-1.
diff --git a/debian/changelog b/debian/changelog
index 6cd73a2..7a88921 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+vatnumber (0.4-1) unstable; urgency=low
+
+ * Merging upstream version 0.4.
+
+ -- Daniel Baumann <daniel at debian.org> Mon, 30 Mar 2009 11:04:00 +0200
+
vatnumber (0.3-1) unstable; urgency=low
* Updating to standards version 3.8.1.
commit db8e0bae9ff9577c55d7f458f81df401d32466f0
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Mar 30 11:03:23 2009 +0200
Merging upstream version 0.4.
diff --git a/CHANGELOG b/CHANGELOG
index a40c6e2..bfab834 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+Version 0.4 - 2009-03-30
+* Update Spain test for issue3 thanks to carlos at pemas.es
+* Add VIES check with the SOAP Service of EU
+* Add test for Bulgaria VAT number with length of 9
+
Version 0.3 - 2009-03-23
* Fix check_vat_ro for vat number with less than 10 digits
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..f86c8aa
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,26 @@
+Installing vatnumber
+====================
+
+Prerequisites
+-------------
+
+ * Python (http://www.python.org/)
+ * SOAPpy (http://pywebsvcs.sourceforge.net/)
+
+Installation
+------------
+
+Once you've downloaded and unpacked the vatnumber source release, enter the
+directory where the archive was unpacked, and run:
+
+ python setup.py install
+
+Note that you may need administrator/root privileges for this step, as
+this command will by default attempt to install module to the Python
+site-packages directory on your system.
+
+For advanced options, please refer to the easy_install and/or the distutils
+documentation:
+
+ http://peak.telecommunity.com/DevCenter/EasyInstall
+ http://docs.python.org/inst/inst.html
diff --git a/MANIFEST.in b/MANIFEST.in
index 7fbc498..57aaa1a 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,3 +2,4 @@ include LICENSE
include COPYRIGHT
include README
include CHANGELOG
+include INSTALL
diff --git a/PKG-INFO b/PKG-INFO
index f910dfd..4d895b9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.3
+Version: 0.4
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index f910dfd..4d895b9 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.3
+Version: 0.4
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.egg-info/SOURCES.txt b/vatnumber.egg-info/SOURCES.txt
index 79c6e7d..639f54a 100644
--- a/vatnumber.egg-info/SOURCES.txt
+++ b/vatnumber.egg-info/SOURCES.txt
@@ -1,5 +1,6 @@
CHANGELOG
COPYRIGHT
+INSTALL
LICENSE
MANIFEST.in
README
diff --git a/vatnumber.py b/vatnumber.py
index cb61493..e5b08f6 100644
--- a/vatnumber.py
+++ b/vatnumber.py
@@ -6,7 +6,8 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.3'
+__version__ = '0.4'
+VIES_URL='http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl'
def countries():
'''
@@ -88,6 +89,9 @@ def check_vat_bg(vat):
'''
Check Bulgaria VAT number.
'''
+ if len(vat) == 9:
+ #XXX don't know any rules for this length
+ return True
if len(vat) != 10:
return False
try:
@@ -344,7 +348,7 @@ def check_vat_es(vat):
23: 'E',
}
- if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'):
+ if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'U', 'V'):
try:
int(vat[1:])
except ValueError:
@@ -359,7 +363,7 @@ def check_vat_es(vat):
if check != int(vat[8]):
return False
return True
- elif vat[0] in ('N', 'P', 'Q', 'S'):
+ elif vat[0] in ('N', 'P', 'Q', 'R', 'S', 'W'):
try:
int(vat[1:8])
except ValueError:
@@ -373,12 +377,19 @@ def check_vat_es(vat):
if check != vat[8]:
return False
return True
- elif vat[0] in ('K', 'L', 'M', 'X'):
+ elif vat[0] in ('K', 'L', 'M', 'X', 'Y', 'Z'):
+ if vat[0] == 'Y':
+ check_value = '1' + vat[1:8]
+ elif vat[0] == 'Z':
+ check_value = '2' + vat[1:8]
+ else:
+ check_value = vat[1:8]
+
try:
- int(vat[1:8])
+ int(check_value)
except ValueError:
return False
- check = 1 + (int(vat[1:8]) % 23)
+ check = 1 + (int(check_value) % 23)
check = conv[check]
if check != vat[8]:
@@ -1036,3 +1047,14 @@ def check_vat_uk(vat):
Check United Kingdom VAT number.
'''
return check_vat_gb(vat)
+
+def check_vies(vat):
+ '''
+ Check VAT number for EU member state using the SOAP Service
+ '''
+ from SOAPpy import WSDL
+ code = vat[:2]
+ number = vat[2:]
+ server = WSDL.Proxy(VIES_URL)
+ res = server.checkVat(code, number)
+ return bool(res['valid'])
commit 8ea52dd0037893d5d160a81bf954569dc3e8becc
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Mar 30 11:01:27 2009 +0200
Releasing debian version 0.3-1.
diff --git a/debian/changelog b/debian/changelog
index ff64077..6cd73a2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (0.3-1) unstable; urgency=low
+
+ * Updating to standards version 3.8.1.
+ * Merging upstream version 0.3.
+
+ -- Daniel Baumann <daniel at debian.org> Mon, 30 Mar 2009 11:01:00 +0200
+
vatnumber (0.2-2) unstable; urgency=low
* Correcting typo in control, architecture should have been arch all,
commit bb98310cab631afc8819032430e91d24b8fd757a
Author: Daniel Baumann <daniel at debian.org>
Date: Mon Mar 30 11:00:37 2009 +0200
Merging upstream version 0.3.
diff --git a/CHANGELOG b/CHANGELOG
index 86ba200..a40c6e2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 0.3 - 2009-03-23
+* Fix check_vat_ro for vat number with less than 10 digits
+
Version 0.2 - 2008-09-29
* Add check_vat_uk function
* Improve Belgium vat check as first number must be 0
diff --git a/PKG-INFO b/PKG-INFO
index 4b122ad..f910dfd 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.2
+Version: 0.3
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.egg-info/PKG-INFO b/vatnumber.egg-info/PKG-INFO
index 4b122ad..f910dfd 100644
--- a/vatnumber.egg-info/PKG-INFO
+++ b/vatnumber.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: vatnumber
-Version: 0.2
+Version: 0.3
Summary: Python module to validate VAT numbers
Home-page: http://code.google.com/p/vatnumber/
Author: B2CK
diff --git a/vatnumber.py b/vatnumber.py
index 147261d..cb61493 100644
--- a/vatnumber.py
+++ b/vatnumber.py
@@ -6,7 +6,7 @@ http://sima-pc.com/nif.php
http://en.wikipedia.org/wiki/Vat_number
'''
-__version__ = '0.2'
+__version__ = '0.3'
def countries():
'''
@@ -873,7 +873,8 @@ def check_vat_ro(vat):
except ValueError:
return False
- if len(vat) == 10:
+ if len(vat) >= 2 and len(vat) <= 10:
+ vat = (10 - len(vat)) * '0' + vat
check_sum = 7 * int(vat[0]) + 5 * int(vat[1]) + 3 * int(vat[2]) + \
2 * int(vat[3]) + 1 * int(vat[4]) + 7 * int(vat[5]) + \
5 * int(vat[6]) + 3 * int(vat[7]) + 2 * int(vat[8])
commit d4208ed05b22e86b0fd358dc373fa29cbdd78dc9
Author: Daniel Baumann <daniel at debian.org>
Date: Fri Mar 20 07:28:39 2009 +0100
Updating to standards version 3.8.1.
diff --git a/debian/control b/debian/control
index e1c442a..a3bd154 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: python
Priority: optional
Maintainer: Daniel Baumann <daniel at debian.org>
Build-Depends: debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
-Standards-Version: 3.8.0
+Standards-Version: 3.8.1
Homepage: http://code.google.com/p/vatnumber/
Vcs-Browser: http://git.debian.net/?p=debian/vatnumber.git
Vcs-Git: git://git.debian.net/git/debian/vatnumber.git
commit c438fb53120e4a5b90e50ebec532effe88172bc4
Author: Daniel Baumann <daniel at debian.org>
Date: Wed Feb 4 20:42:04 2009 +0100
Releasing debian version 0.2-2.
diff --git a/debian/changelog b/debian/changelog
index eefb103..ff64077 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vatnumber (0.2-2) unstable; urgency=low
+
+ * Correcting typo in control, architecture should have been arch all,
+ not any.
+
+ -- Daniel Baumann <daniel at debian.org> Wed, 4 Feb 2009 20:41:00 +0100
+
vatnumber (0.2-1) unstable; urgency=low
* Initial release.
commit 18540576cf5c1e1dd5f617548adbcac8d52847e4
Author: Daniel Baumann <daniel at debian.org>
Date: Wed Feb 4 20:41:18 2009 +0100
Correcting typo in control, architecture should have been arch all, not any.
diff --git a/debian/control b/debian/control
index 97ca949..e1c442a 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Vcs-Browser: http://git.debian.net/?p=debian/vatnumber.git
Vcs-Git: git://git.debian.net/git/debian/vatnumber.git
Package: python-vatnumber
-Architecture: any
+Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources
XB-Python-Version: ${python:Versions}
Description: Python module to validate VAT numbers
commit 8b1837ccdf7f5178f9c9f6125132bd461ddc538f
Author: Daniel Baumann <daniel at debian.org>
Date: Tue Jan 13 03:39:16 2009 +0100
Adding debian version 0.2-1.
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..eefb103
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+vatnumber (0.2-1) unstable; urgency=low
+
+ * Initial release.
+
+ -- Daniel Baumann <daniel at debian.org> Mon, 12 Jan 2009 15:49:00 -0500
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..97ca949
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,17 @@
+Source: vatnumber
+Section: python
+Priority: optional
+Maintainer: Daniel Baumann <daniel at debian.org>
+Build-Depends: debhelper (>= 7), python, python-all-dev, python-setuptools, python-support
+Standards-Version: 3.8.0
+Homepage: http://code.google.com/p/vatnumber/
+Vcs-Browser: http://git.debian.net/?p=debian/vatnumber.git
+Vcs-Git: git://git.debian.net/git/debian/vatnumber.git
+
+Package: python-vatnumber
+Architecture: any
+Depends: ${misc:Depends}, ${python:Depends}, python-pkg-resources
+XB-Python-Version: ${python:Versions}
+Description: Python module to validate VAT numbers
+ This is a Python module to check Value Added Tax (VAT) numbers for their
+ validity.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..6c4f243
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,44 @@
+Authors:
+ Cedric Krier
+ Bertrand Chenal
+Download: http://code.google.com/p/vatnumber/
+
+Files: *
+Copyright:
+ (C) 2008 Cedric Krier
+ (C) 2008 B2CK
+License: GPL-3+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General Public License
+ can be found in /usr/share/common-licenses/GPL-3 file.
+
+Files: debian/*
+Copyright: (C) 2009 Daniel Baumann <daniel at debian.org>
+License: GPL-3+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General Public License
+ can be found in /usr/share/common-licenses/GPL-3 file.
diff --git a/debian/pycompat b/debian/pycompat
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/debian/pycompat
@@ -0,0 +1 @@
+2
diff --git a/debian/pyversions b/debian/pyversions
new file mode 100644
index 0000000..8b253bc
--- /dev/null
+++ b/debian/pyversions
@@ -0,0 +1 @@
+2.4-
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..05dd8a1
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,43 @@
+#!/usr/bin/make -f
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ python setup.py clean
+ rm -rf dist build vatnumber.egg-info
+ find . -type f -name "*.pyc" | xargs rm -f
+
+ dh_clean
+
+build:
+
+install:
+ dh_testdir
+ dh_testroot
+ dh_prep
+ dh_installdirs
+
+ python setup.py install --single-version-externally-managed --root=$(CURDIR)/debian/python-vatnumber --install-lib /usr/share/python-support/python-vatnumber
+
+ find debian/python-vatnumber -type f -name "*.pyc" | xargs rm -f
+
+binary: binary-indep
+
+binary-arch:
+
+binary-indep: install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs CHANGELOG
+ dh_installdocs
+ dh_pysupport
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+.PHONY: clean build install binary binary-arch binary-indep
--
vatnumber
More information about the tryton-debian-vcs
mailing list