Improve validation of Norwegian VAT IDs (#5089)

This commit is contained in:
Raphael Michel
2025-05-12 17:04:58 +02:00
committed by GitHub
parent 1f2a0278c0
commit 1caa71cdbe
2 changed files with 26 additions and 0 deletions

View File

@@ -62,6 +62,9 @@ class VATIDTemporaryError(VATIDError):
def _validate_vat_id_NO(vat_id, country_code):
# Inspired by vat_moss library
if not vat_id.startswith("NO"):
# prefix is not usually used in Norway, but expected by vat_moss library
vat_id = "NO" + vat_id
try:
vat_id = vat_moss.id.normalize(vat_id)
except ValueError: