borni-dhifi / vatnumber

Automatically exported from code.google.com/p/vatnumber
GNU General Public License v3.0
0 stars 0 forks source link

GB VAT Checks fails on VIES-validated GB003232345 #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
>>> vatnumber.check_vat('GB003232345')
False

>>> vatnumber.check_vies('GB003232345')
True
>>> 

What is the expected output?
>>> vatnumber.check_vat('GB003232345')
True

What version of the product are you using?
rev f8e25cd17789

Please provide any additional information below.

The algorithm from http://sima-pc.com/nif.php seems to specify that 9-digit 
number may not have the main 7-digit number between 20000 and 1000000.
However valid numbers seem to fall in that range, such as GB003232345 (32323 > 
20000). Perhaps this rule is wrong, or perhaps it's obsolete, I don't know if 
anyone has more input about that?

In any case, it seems better to accept a few invalid numbers than to refuse 
valid ones. For example the local check methods cannot verify that a number is 
truly allocated, that's fine, it's just a quick check.

If that helps, here is a Javascript VAT validation library[1] that seems 
reasonably maintained, and does not have this 20k-1000k range restriction. It 
validates GB003232345 (it also validates the number for issue #17 btw)

So here's a patch that drops the range restriction.

Thanks!

[1] http://www.braemoor.co.uk/software/vat.shtml

Original issue reported on code.google.com by o...@openerp.com on 21 Sep 2011 at 11:52

Attachments:

GoogleCodeExporter commented 8 years ago
The javascript library indeed doesn't validate IOM numbers so we can not get 
information from this one.
So in the wikipedia page there is no reference to this constraint and as there 
is an example of number that is validated by the VIES services. I think it is 
ok to drop the check.
Could you provide a patch with only the remove of the code and a message 
following the convention defined at 
https://code.google.com/p/tryton/wiki/HowtoContribute

Original comment by cedric.krier@b2ck.com on 21 Sep 2011 at 12:14

GoogleCodeExporter commented 8 years ago
Here is the updated patch

Original comment by o...@openerp.com on 21 Sep 2011 at 1:20

Attachments:

GoogleCodeExporter commented 8 years ago
Or the same patch with the test sample located next to those with the same 
length, if that matters (patch applies on top of the one of issue17)

Original comment by o...@openerp.com on 21 Sep 2011 at 1:55

Attachments:

GoogleCodeExporter commented 8 years ago
Applied in r9e68c6a5e671

Original comment by cedric.krier@b2ck.com on 28 Sep 2011 at 10:34