vat.vies package¶
Functions¶
-
vat.vies.
check_vat
()¶ Check a VAT number using VIES. Returns a
VIESResponse
on success, or in case of error raises an exception.The complete VAT number, including the two character EU VAT country code.
Note
You should probably use
vat.check_details()
rather than this function.
-
vat.vies.
check_vat_approx
(vat_number, extra={}, requester=None)¶ Check a VAT number using VIES, passing in additional information about the entity being checked. Returns a
VIESApproxResponse
on success, or raises an exception.The complete VAT number, including the two character EU VAT country code.
A dictionary containing additional information to be passed to VIES to check. Available items are:
Key Value name The name of the trader. company-type The company type, if applicable. street The street address of the trader. postcode The postal code of the trader. city The city of the trader. Note that company types are language and country specific.
If the member state does fuzzy matching, passing these details will allow their system to try to match them.
The requester’s VAT number (optional).
Note
You should probably use
vat.check_details()
rather than this function.
Classes¶
-
class
vat.vies.
VIESException
¶ The base class of all exceptions raised by this module.
-
class
vat.vies.
VIESSOAPException
¶ Represents a SOAP fault encountered when trying to talk to VIES.
-
code
¶
The SOAP fault code.
-
string
¶
A description of the fault.
-
actor
¶
Used to indicate the source of the fault.
-
detail
¶
Provides additional information about the fault.
-
-
class
vat.vies.
VIESResponseBase
¶ The base class of all VIES response classes.
-
country
¶
The EU VAT country code.
-
vat_number
¶
The VAT number excluding the country code.
-
request_date
¶
The date on which the request was submitted to VIES.
-
valid
¶
True if the VAT number is valid, False otherwise.
-
-
class
vat.vies.
VIESResponse
¶ Represents the response from VIES to a basic request.
-
name
¶
The trader’s name, if provided (not all member states do).
-
address
¶
The trader’s address, if provided (not all member states do).
-
-
class
vat.vies.
VIESApproxResponse
¶ Represents the response from VIES to a request to verify a complete set of details, including the trader’s name and address.
Note that the details contained in the response are dependent on the member state in question. Some member states try to fuzzy-match the information you pass in; other member states supply the trader information themselves; and there is at least one member state (Germany) that at time of writing does neither and (worse) returns the information you gave it.
-
trader_info
¶
A dictionary containing (any of) the following elements:
Key Value name The name of the trader. company-type The company type, if applicable. address The full address of the trader. street The street address of the trader. postcode The postal code of the trader. city The city of the trader. Note that the address may be specified using either the “address” field or the individual “street”, “postcode” and “city” fields.
-
trader_match_info
¶
A dictionary containing the same keys as above, but for each item the value is one of
Value Meaning MATCH_VALID
The details matched those supplied. MATCH_INVALID
The details did not match those supplied. MATCH_NOT_PROCESSED
The details were not processed. -
request_id
¶
A unique request ID generated by the VIES system. This can be stored and later used as proof that VIES was checked for these details.
-