python-stdnum branch master updated. 1.15-1-gb93d695
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.15-1-gb93d695
- From: Commits of the python-stdnum project <python-stdnum-commits [at] lists.arthurdejong.org>
- To: python-stdnum-commits [at] lists.arthurdejong.org
- Reply-to: python-stdnum-users [at] lists.arthurdejong.org, python-stdnum-commits [at] lists.arthurdejong.org
- Subject: python-stdnum branch master updated. 1.15-1-gb93d695
- Date: Thu, 21 Jan 2021 19:25:45 +0100 (CET)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".
The branch, master has been updated
via b93d69581f35aa18e7fdd52b3f7fdf06770215e3 (commit)
from 6b7f20928d95b8d4d9d40ab2df90c699e7752167 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=b93d69581f35aa18e7fdd52b3f7fdf06770215e3
commit b93d69581f35aa18e7fdd52b3f7fdf06770215e3
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Thu Jan 21 19:23:00 2021 +0100
Support xi country code for Northern Ireland
While Great Brittain is no longer an EU member state some GB VAT numbers
are still valid if the company meets certain requirements.
See
https://www.gov.uk/government/publications/accounting-for-vat-on-goods-moving-between-great-britain-and-northern-ireland-from-1-january-2021/check-when-you-are-trading-under-the-northern-ireland-protocol-if-you-are-vat-registered-business
Closes https://github.com/arthurdejong/python-stdnum/issues/250
diff --git a/stdnum/eu/vat.py b/stdnum/eu/vat.py
index a57948b..074ec89 100644
--- a/stdnum/eu/vat.py
+++ b/stdnum/eu/vat.py
@@ -1,7 +1,7 @@
# vat.py - functions for handling European VAT numbers
# coding: utf-8
#
-# Copyright (C) 2012-2020 Arthur de Jong
+# Copyright (C) 2012-2021 Arthur de Jong
# Copyright (C) 2015 Lionel Elie Mamane
#
# This library is free software; you can redistribute it and/or
@@ -46,10 +46,11 @@ from stdnum.util import clean, get_cc_module,
get_soap_client
MEMBER_STATES = set([
'at', 'be', 'bg', 'cy', 'cz', 'de', 'dk', 'ee', 'es', 'fi', 'fr', 'gr',
'hr', 'hu', 'ie', 'it', 'lt', 'lu', 'lv', 'mt', 'nl', 'pl', 'pt', 'ro',
- 'se', 'si', 'sk',
+ 'se', 'si', 'sk', 'xi',
])
-"""The collection of country codes that are queried. Greece is listed with
-a country code of gr while for VAT purposes el is used instead."""
+"""The collection of country codes that are queried. Greece is listed with a
+country code of gr while for VAT purposes el is used instead. For Northern
+Ireland numbers are prefixed with xi of United Kingdom numbers."""
_country_modules = dict()
@@ -65,6 +66,8 @@ def _get_cc_module(cc):
cc = 'gr'
if cc not in MEMBER_STATES:
return
+ if cc == 'xi':
+ cc = 'gb'
if cc not in _country_modules:
_country_modules[cc] = get_cc_module(cc, 'vat')
return _country_modules[cc]
diff --git a/stdnum/gb/vat.py b/stdnum/gb/vat.py
index 2c09da2..c8f7086 100644
--- a/stdnum/gb/vat.py
+++ b/stdnum/gb/vat.py
@@ -1,6 +1,6 @@
# vat.py - functions for handling United Kingdom VAT numbers
#
-# Copyright (C) 2012-2015 Arthur de Jong
+# Copyright (C) 2012-2021 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -43,7 +43,7 @@ def compact(number):
"""Convert the number to the minimal representation. This strips the
number of any valid separators and removes surrounding whitespace."""
number = clean(number, ' -.').upper().strip()
- if number.startswith('GB'):
+ if number.startswith('GB') or number.startswith('XI'):
number = number[2:]
return number
diff --git a/tests/test_eu_vat.doctest b/tests/test_eu_vat.doctest
index 7e9f258..cde37af 100644
--- a/tests/test_eu_vat.doctest
+++ b/tests/test_eu_vat.doctest
@@ -1,6 +1,6 @@
test_eu_vat.doctest - more detailed doctests for the stdnum.eu.vat module
-Copyright (C) 2012-2020 Arthur de Jong
+Copyright (C) 2012-2021 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -695,6 +695,8 @@ These have been found online and should all be valid
numbers.
... SK 2022193459
... SK2022193459
...
+... XI 432525179
+...
... '''
>>> [x for x in numbers.splitlines() if x and not vat.is_valid(x)]
[]
-----------------------------------------------------------------------
Summary of changes:
stdnum/eu/vat.py | 11 +++++++----
stdnum/gb/vat.py | 4 ++--
tests/test_eu_vat.doctest | 4 +++-
3 files changed, 12 insertions(+), 7 deletions(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 1.15-1-gb93d695,
Commits of the python-stdnum project