arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
498 stars 206 forks source link

vatin incompatible with switzerland #245

Closed alexis-via closed 3 years ago

alexis-via commented 3 years ago

It seems to me that this is a bug:

Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import stdnum
>>> stdnum.__version__
'1.14'
>>> from stdnum.vatin import is_valid
>>> is_valid('CHE-109.298.651 TVA')
False
>>> from stdnum.ch.vat import is_valid
>>> is_valid('CHE-109.298.651 TVA')
True

The description of vatin says "This module supports all VAT numbers that are supported in python-stdnum." cf https://github.com/arthurdejong/python-stdnum/blob/master/stdnum/vatin.py#L27 So either the description of vatin should be updated to say that it excludes Switzerland, or it should be able to validate swiss VAT numbers.

arthurdejong commented 3 years ago

Thanks for pointing this out. A fix has been committed as c74e322.