Skip to content

Commit 142e2de

Browse files
committed
data.ref: versioning XML schemas of "factura electrónica"
The contents of the `schemas-xml` directory are separated into subdirectories, according to the sources used to build the set. The subdirectories are named considering the source used and the most recent modification timestamp present between the files in the set. Extra: New enum `cl_sii.base.constants.XmlSchemasVersionEnum` to define the available XML schema versions
1 parent 5e20833 commit 142e2de

33 files changed

+9284
-17
lines changed

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ include LICENSE
33
include README.rst
44
recursive-include cl_sii *py
55
recursive-include cl_sii/data/cte/schemas-json *.schema.json
6-
recursive-include cl_sii/data/ref/factura_electronica/schemas-xml *.xsd
6+
recursive-include cl_sii/data/ref/factura_electronica/schemas-xml/2013_02_07_sii_official *.xsd
7+
recursive-include cl_sii/data/ref/factura_electronica/schemas-xml/2017_10_23_libre_dte *.xsd
78
include cl_sii/py.typed

cl_sii/base/constants.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
================
44
55
"""
6+
from __future__ import annotations
7+
8+
import enum
9+
610
import pytz
711

812
from cl_sii.libs.tz_utils import PytzTimezone
@@ -11,3 +15,48 @@
1115
TZ_CL_SANTIAGO: PytzTimezone = pytz.timezone('America/Santiago')
1216

1317
SII_OFFICIAL_TZ = TZ_CL_SANTIAGO
18+
19+
20+
class XmlSchemasVersionEnum(enum.Enum):
21+
"""
22+
Enum of "SII XML Schema Version".
23+
The version name is selected considering the last updated timestamp
24+
of the files in the set
25+
26+
"""
27+
28+
V2017_10_23_LIBRE_DTE = '2017_10_23_libre_dte'
29+
"""
30+
Incremental update to version V2013_02_07_SII_OFFICIAL, from an unofficial
31+
source since the files available on the SII website are outdated with respect
32+
to the regulations (and even the documentation PDFs published alongside)
33+
34+
Source: repository/project "LibreDTE" at https://github.com/LibreDTE/libredte-lib
35+
36+
Most recent modification timestamp of the XML schemas: 2017-10-23
37+
"""
38+
39+
V2013_02_07_SII_OFFICIAL = '2013_02_07_sii_official'
40+
"""
41+
Official schemas of entities related to these domain concepts:
42+
- DTE (Documento Tributario Electrónico)
43+
- IECV (Información Electrónica de Libros de Compra y Venta)
44+
- LCE (Libros Contables Electrónicos)
45+
- RTC (Registro de Transferencia de Crédito)
46+
47+
All the files have been preserved as they were; schemas are in their
48+
original text encoding (ISO-8859-1) and have not been modified in the
49+
slightest way.
50+
51+
Sources (2021-04-19):
52+
http://www.sii.cl/factura_electronica/schema_dte.zip
53+
http://www.sii.cl/factura_electronica/schema_iecv.zip
54+
http://www.sii.cl/factura_electronica/schema_cesion.zip
55+
56+
Most recent modification timestamp of the XML schemas: 2013-02-07
57+
"""
58+
59+
@classmethod
60+
def latest(cls) -> XmlSchemasVersionEnum:
61+
"""Reference to the latest version available"""
62+
return cls.V2017_10_23_LIBRE_DTE

0 commit comments

Comments
 (0)