Package: verify-vat-number
Verify VAT registration numberThe module for verificationVAT registration numberin EU andVAT identification numberin Czechia. This module is used in theDjango Verify VAT registration numbermodule and then in theDjangoCMS Verify VAT registration numbermodule.VIESVIES VAT number validation for European union. It is an electronic mean of validating VAT-identification numbers of economic operators registered in the European Union for cross border transactions on goods or services.Supported countries:AT - Austria
BE - Belgium
BG - Bulgaria
CY - Cyprus
CZ - Czechia
DE - Germany
DK - Denmark
EE - Estonia
EL - Greece
ES - Spain
FI - Finland
FR - France
HR - Croatia
HU - Hungary
IE - Ireland
IT - Italy
LT - Lithuania
LU - Luxembourg
LV - Latvia
MT - Malta
NL - The Netherlands
PL - Poland
PT - Portugal
RO - Romania
SE - Sweden
SI - Slovenia
SK - Slovakia
XI - Northern IrelandARESARES- Access to Registers of Economic Subjects / Entities is an information system allowing a retrieval of information on economic entities registered in the Czech Republic. This system intermediates a display of data from particular registers of the state administration (called source registers) in which the data concerned is kept.InstallationThis library is available on PyPI, it's recommended to install it usingpip:pipinstallverify-vat-numberUsagefromverify_vat_number.aresimportget_from_cz_aresfromverify_vat_number.viesimportget_from_eu_viesfromverify_vat_number.exceptionsimportVatNotFound,VerifyVatException,UnsupportedCountryCodedefdump_reg(vat):print('\nVAT-REG-NUM:',vat)try:data=get_from_eu_vies(vat)exceptVatNotFound:print("VAT not found for",vat)exceptUnsupportedCountryCodeaserr:print("Unsupported country code:",err)exceptVerifyVatExceptionaserr:print(err)print(err.source)else:print(data)defdump_vid(ic):print('\nVAT-ID-NUM:',ic)try:data=get_from_cz_ares(ic)exceptVatNotFound:print("IC not found for",ic)exceptVerifyVatExceptionaserr:print(err)print(err.source)else:print(data)forvatin("CZ67985726","DE306401413","SK2020317068","CZ67985728","BE0404616494","BE0400853488","BG127015636","XX67985726"):dump_reg(vat)foricin("67985726","67985728","456456456"):dump_vid(ic)VAT-REG-NUM:CZ67985726
VerifiedCompany(company_name='CZ.NIC, z.s.p.o.',address='Milešovská 1136/5\nPRAHA 3 - VINOHRADY\n130 00  PRAHA 3',street_and_num='Milešovská 1136/5',city='PRAHA 3',postal_code='130 00',district='PRAHA 3 - VINOHRADY',country_code='CZ',legal_form=None)VAT-REG-NUM:DE306401413
VerifiedCompany(company_name='',address=None,street_and_num=None,city=None,postal_code=None,district=None,country=None,legal_form=None)VAT-REG-NUM:SK2020317068
VerifiedCompany(company_name='ESET, spol. s r.o.',address='Einsteinova 24\n85101 Bratislava - mestská časť Petržalka\nSlovensko',street_and_num='Einsteinova 24',city='Bratislava - mestská časť Petržalka',postal_code='85101',district=None,country_code='SK',legal_form=None)VAT-REG-NUM:CZ67985728
VATnotfoundforCZ67985728

VAT-REG-NUM:BE0404616494
VerifiedCompany(company_name='NV ACKERMANS & VAN HAAREN',address='Begijnenvest 113\n2000 Antwerpen',street_and_num='Begijnenvest 113',city='Antwerpen',postal_code='2000',district=None,country_code='BE',legal_form=None)VAT-REG-NUM:BE0400853488
VerifiedCompany(company_name='NV BRUSSELS AIRLINES',address='Ringbaan 26\n1831 Machelen (Brab.)',street_and_num='Ringbaan 26',city='Machelen (Brab.)',postal_code='1831',district=None,country_code='BE',legal_form=None)VAT-REG-NUM:BG127015636
VerifiedCompany(company_name='КАРЛСБЕРГ БЪЛГАРИЯ - АД',address='жк МЛАДОСТ 4БИЗНЕС ПАРК СОФИЯ  №1 бл.сграда 10 ет.4 обл.СОФИЯ, гр.СОФИЯ 1715',street_and_num='жк МЛАДОСТ 4БИЗНЕС ПАРК СОФИЯ  №1 бл.сграда 10 ет.4 обл.СОФИЯ',city='гр.СОФИЯ',postal_code='1715',district=None,country_code='BG',legal_form=None)VAT-REG-NUM:XX67985726
Unsupportedcountrycode:XX

VAT-ID-NUM:67985726VerifiedCompany(company_name='CZ.NIC, z.s.p.o.',address='Milešovská 1136/5\n13000 Praha 3',street_and_num='Milešovská 1136/5',city='Praha 3',postal_code='13000',district='Praha 3 - Vinohrady',country_code='CZ',legal_form=751)VAT-ID-NUM:67985728ICnotfoundfor67985728VAT-ID-NUM:456456456Thenumbercannotbemorethan8digitslong.
NoneWork with logging:importsysimportloggingfromverify_vat_number.aresimportget_from_cz_aresfromverify_vat_number.viesimportget_from_eu_viesfromverify_vat_number.exceptionsimportVatNotFoundlogger=logging.getLogger('verify_vat_number.vies')logger.addHandler(logging.StreamHandler(sys.stdout))logger.setLevel(logging.DEBUG)get_from_eu_vies("CZ67985726")https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdlCountrycode:CZVAT:67985726<ns0:Envelopexmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types"><ns0:Body><ns1:checkVat><ns1:countryCode>CZ</ns1:countryCode><ns1:vatNumber>67985726</ns1:vatNumber></ns1:checkVat></ns0:Body>
</ns0:Envelope>

<ns0:Envelopexmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types"><ns0:Body><ns1:checkVatResponse><ns1:countryCode>CZ</ns1:countryCode><ns1:vatNumber>67985726</ns1:vatNumber><ns1:requestDate>2022-05-20+02:00</ns1:requestDate><ns1:valid>true</ns1:valid><ns1:name>CZ.NIC,z.s.p.o.</ns1:name><ns1:address>Milešovská1136/5
PRAHA3-VINOHRADY13000PRAHA3</ns1:address></ns1:checkVatResponse></ns0:Body>
</ns0:Envelope>

VerifiedCompany(company_name='CZ.NIC, z.s.p.o.',address='Milešovská 1136/5\n13000 Praha 3',street_and_num='Milešovská 1136/5',city='Praha 3',postal_code='13000',district='Praha 3 - Vinohrady',country_code='CZ',legal_form=None)logger=logging.getLogger('verify_vat_number.ares')logger.addHandler(logging.StreamHandler(sys.stdout))logger.setLevel(logging.DEBUG)try:get_from_cz_ares("67985728")exceptVatNotFound:print('VAT not found.')https://ares.gov.cz/ekonomicke-subjekty-v-be/rest/ekonomicke-subjekty/67985728/
VATnotfound.Multiple ARES output: Economic entity / Public registryTheget_from_cz_aresfunction is an umbrella function for individual registers.
It currently covers the Economic entity (get_from_cz_ares_ee) and the Public registry (get_from_cz_ares_vr).
The default is the Economic entity. Data from the Public registry is returned using theregister_typeattribute with the valueRegisterType.PUBLIC_REGISTER.
The Public registry contains information about owners and members of notable governing bodies.fromverify_vat_number.aresimportget_from_cz_ares,get_from_cz_ares_vr,RegisterTypeget_from_cz_ares("67985726",RegisterType.PUBLIC_REGISTER)# orget_from_cz_ares_vr("67985726")VerifiedCompanyPublicRegister(company_name='CZ.NIC, z.s.p.o.',address='Milešovská 1136/5\n13000 Praha 3',street_and_num='Milešovská 1136/5',city='Praha 3',postal_code='13000',district='Praha 3 - Vinohrady',country_code='CZ',company_entities=[CompanyEntity(entity_type=<CompanyEntityType.GOVERNING_BODY:'Statutární orgán'>,name='Statutární orgán - Představenstvo',members=[Member(role=<MemberRoleType.STATUTORY_BODY_MEMBER:'STATUTARNI_ORGAN_CLEN'>,identity=NaturalPerson(first_name='Josef',last_name='Novák',date_of_birth=datetime.date(1992,11,8))),Member(role=<MemberRoleType.STATUTORY_BODY_MEMBER:'STATUTARNI_ORGAN_CLEN'>,identity=NaturalPerson(first_name='Jana',last_name='Novotná',date_of_birth=datetime.date(1962,9,17))),Member(role=<MemberRoleType.STATUTORY_BODY_MEMBER:'STATUTARNI_ORGAN_CLEN'>,identity=NaturalPerson(first_name='Karel',last_name='Svoboda',date_of_birth=datetime.date(1981,12,3))),Member(role=<MemberRoleType.STATUTORY_BODY_MEMBER:'STATUTARNI_ORGAN_CLEN'>,identity=NaturalPerson(first_name='Hana',last_name='Horáková',date_of_birth=datetime.date(1974,4,12))),Member(role=<MemberRoleType.STATUTORY_BODY_MEMBER:'STATUTARNI_ORGAN_CLEN'>,identity=NaturalPerson(first_name='Jiří',last_name='Dvořák',date_of_birth=datetime.date(1978,6,21)))]),CompanyEntity(entity_type=<CompanyEntityType.OTHER:'Jiný orgán'>,name='Kontrolní orgán - Dozorčí rada',members=[Member(role=<MemberRoleType.AUDIT_COMMITTEE_MEMBER:'KONTROLNI_KOMISE_CLEN'>,identity=NaturalPerson(first_name='Eva',last_name='Kopecká',date_of_birth=datetime.date(1982,8,12))),Member(role=<MemberRoleType.AUDIT_COMMITTEE_MEMBER:'KONTROLNI_KOMISE_CLEN'>,identity=NaturalPerson(first_name='Milan',last_name='Dostál',date_of_birth=datetime.date(1985,7,10))),Member(role=<MemberRoleType.AUDIT_COMMITTEE_MEMBER:'KONTROLNI_KOMISE_CLEN'>,identity=NaturalPerson(first_name='Jan',last_name='Beneš',date_of_birth=datetime.date(1952,11,12)))])],legal_form=751)ARES - various registryARES data are drawn from a variety of sources. Currently two are implemented:Economic entitiesPublic registerEconomic entities are obtained by the functionget_from_cz_ares_ee(VAT), which is the same as calling the functionget_from_cz_ares(VAT).
Data from Public register are given by the functionget_from_cz_ares_vr(VAT), which is almost same as calling the functionget_from_cz_ares(VAT, RegisterType.PUBLIC_REGISTER). The difference is that if the data is not found in the Public Register,
the data is returned from the default register Economic entities.
Thus, theget_from_cz_ares_eefunction may raise aVatNotFoundexception, while theget_from_cz_aresfunction will return a record of the company, but of course, without entities.ARES - Lowercase names of persons in entitiesUnfortunately, ARES Public register returns the names of people with capital letters. The program converts them back to lower case.
If you wish to keep the original data, you can disable this conversion with theARES_KEEP_CASEenvironment variable.python -c 'from verify_vat_number.ares import get_from_cz_ares_vr;print(get_from_cz_ares_vr("67985726"))'VerifiedCompanyPublicRegister(company_name='CZ.NIC, z.s.p.o.',...company_entities=[CompanyEntity(entity_type=<CompanyEntityType.GOVERNING_BODY:'Statutární orgán'>,name='Statutární orgán',members=[Member(role=<MemberRoleType.STATUTORY_BODY_MEMBER:'STATUTARNI_ORGAN_CLEN'>,identity=NaturalPerson(first_name='Josef',last_name='Novák',...)),......)ARES_KEEP_CASE=y python -c 'from verify_vat_number.ares import get_from_cz_ares_vr;print(get_from_cz_ares_vr("67985726"))'VerifiedCompanyPublicRegister(company_name='CZ.NIC, z.s.p.o.',...company_entities=[CompanyEntity(entity_type=<CompanyEntityType.GOVERNING_BODY:'Statutární orgán'>,name='Statutární orgán',members=[Member(role=<MemberRoleType.STATUTORY_BODY_MEMBER:'STATUTARNI_ORGAN_CLEN'>,identity=NaturalPerson(first_name='JOSEF',last_name='NOVÁK',...)),......)LicenseGPLv3+