arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
499 stars 208 forks source link

Add Spanish CAE Number #446

Open quiqueporta opened 3 months ago

quiqueporta commented 3 months ago

The CAE (Código de Actividad y Establecimiento) number is a 13-digit number and that allows you to identify an activity and the establishment in which it is carried out.

This is the official BOE (Boletín Oficial del Estado) about the CAE number: https://www.boe.es/boe/dias/2006/12/28/pdfs/A46098-46100.pdf

This is the offical web site about the CAE number: https://sede.agenciatributaria.gob.es/Sede/impuestos-especiales-medioambientales/censo-impuestos-especiales-medioambientales/registro-impuestos-especiales-fabricacion.html?faqId=3cc75c714b11c710VgnVCM100000dc381e0aRCRD

Antonio-Vela commented 2 months ago

Antonio-Vela commented 1 month ago

arthurdejong commented 1 week ago

Hi @quiqueporta,

Thanks for providing this and sorry it took a while for me to get around to this. The link in the code appear to be broken:

https://www2.agenciatributaria.gob.es/wlpl/inwinvoc/es.aeat.dit.adu.adce.cae.cw.AccW

I get "Error en la recuperación de la acción seleccionada. (Se esperaba fAccion)".

This page suggests additional checks that can be performed:

Do you have any idea of what the check digit function would be? Searching for hints on the check digit algorithm is generally easier in the applicable language (and I read Spanish through Google Translate). Without an actual reference to what the algorithm is it is sometimes possible to reverse-engineer the check digit algorithm from a large number of valid numbers (also see https://github.com/arthurdejong/python-stdnum/blob/master/CONTRIBUTING.md)

Thanks,

quiqueporta commented 1 week ago

@arthurdejong Ok, I will chek it and make the appropriate changes if needed Thanks

quiqueporta commented 3 days ago

Regardless of the check digit, you cannot check it through the official web page because it only checks if the CAE is registered in its database, not the format itself.