Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.0
current_version = 0.3.0
commit = True
tag = True

Expand Down
13 changes: 9 additions & 4 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
History
-------

unreleased (YYYY-MM-DD)
0.3.0 (2019-04-05)
+++++++++++++++++++++++

* (PR #11, 2019-04-05) dte: add module ``parse``
* (PR #10, 2019-04-05) dte: add module ``data_models``
* (PR #9, 2019-04-05) libs: add module ``xml_utils``
* (PR #8, 2019-04-05) add sub-package ``rcv``

0.2.0 (2019-04-04)
+++++++++++++++++++++++

- (PR #6, 2019-04-04) data.ref: add XML schemas of "factura electrónica"
- (PR #5, 2019-04-04) extras: add 'RutField' for Django models, DRF and MM
- (PR #4, 2019-04-04) Config CircleCI
* (PR #6, 2019-04-04) data.ref: add XML schemas of "factura electrónica"
* (PR #5, 2019-04-04) extras: add 'RutField' for Django models, DRF and MM
* (PR #4, 2019-04-04) Config CircleCI

0.1.0 (2019-04-04)
+++++++++++++++++++++++
Expand Down
60 changes: 60 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,78 @@
cl-sii Python lib
=================

.. image:: https://img.shields.io/pypi/v/cl-sii.svg
:target: https://pypi.python.org/pypi/cl-sii
:alt: PyPI package version

.. image:: https://img.shields.io/pypi/pyversions/cl-sii.svg
:target: https://pypi.python.org/pypi/cl-sii
:alt: Python versions

.. image:: https://img.shields.io/pypi/l/cl-sii.svg
:target: https://pypi.python.org/pypi/cl-sii
:alt: License

Python library for Servicio de Impuestos Internos (SII) of Chile.

Documentation
-------------

The full documentation is at https://lib-cl-sii-python.readthedocs.io.

Status
-------------

.. image:: https://circleci.com/gh/fyndata/lib-cl-sii-python/tree/develop.svg?style=shield
:target: https://circleci.com/gh/fyndata/lib-cl-sii-python/tree/develop
:alt: CI status

.. image:: https://codecov.io/gh/fyndata/lib-cl-sii-python/branch/develop/graph/badge.svg
:target: https://codecov.io/gh/fyndata/lib-cl-sii-python
:alt: Code coverage

.. image:: https://api.codeclimate.com/v1/badges/74408e5f8811f750ff3f/maintainability
:target: https://codeclimate.com/github/fyndata/lib-cl-sii-python/maintainability
:alt: Code Climate maintainability

.. image:: https://readthedocs.org/projects/lib-cl-sii-python/badge/?version=latest
:target: https://lib-cl-sii-python.readthedocs.io/en/latest/?badge=latest
:alt: Documentation

Supported Python versions
-------------------------

Only Python 3.7. Python 3.6 and below will not work because we use some features introduced in
Python 3.7.

Quickstart
----------

Install package::

pip install cl-sii

And TODO

Features
--------

* TODO

Tests
+++++

Requirements::

pip install -r requirements/test.txt

Run test suite for all supported Python versions and run tools for
code style analysis, static type check, etc::

make test-all
make lint

Check code coverage of tests::

make test-coverage
make test-coverage-report-console
2 changes: 1 addition & 1 deletion cl_sii/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"""


__version__ = '0.2.0'
__version__ = '0.3.0'
Empty file.
17 changes: 17 additions & 0 deletions cl_sii/contribuyente/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Contribuyente-related constants.

Source: XML types 'RznSocLargaType' and 'RznSocCortaType' in official schema
'SiiTypes_v10.xsd'.
https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/SiiTypes_v10.xsd#L635-L651

"""


# TODO: RAZON_SOCIAL_LONG_REGEX = re.compile(r'^...$')

RAZON_SOCIAL_LONG_MAX_LENGTH = 100
""""Razón Social" max length ("long version")."""

RAZON_SOCIAL_SHORT_MAX_LENGTH = 40
""""Razón Social" max length ("short version")."""
Empty file added cl_sii/dte/__init__.py
Empty file.
100 changes: 100 additions & 0 deletions cl_sii/dte/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"""
DTE-related constants.

Sources: official XML schemas 'SiiTypes_v10.xsd' and 'DTE_v10.xsd'.
https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/

"""
import enum


###############################################################################
# DTE fields / Folio
###############################################################################

# XML element 'DTEDefType/Documento/Encabezado/IdDoc/Folio'
# - description: "Folio del Documento Electronico"
# - XML type: 'FolioType'
# - source:
# https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/DTE_v10.xsd#L52-L56
# XML type 'FolioType' in official schema 'SiiTypes_v10.xsd'.
# - source:
# https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/SiiTypes_v10.xsd#L153-L160

DTE_FOLIO_FIELD_TYPE = int
"""DTE field 'Folio' type."""
DTE_FOLIO_FIELD_MIN_VALUE = 1
"""DTE field 'Folio' min value."""
DTE_FOLIO_FIELD_MAX_VALUE = 10 ** 10
"""DTE field 'Folio' max value."""


###############################################################################
# DTE fields / Monto Total
###############################################################################

# XML element 'DTEDefType/Documento/Encabezado/Totales/MntTotal'
# - description: "Monto Total del DTE"
# - XML type: 'MontoType'
# - source:
# https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/DTE_v10.xsd#L1160-L1164
# XML type 'MontoType' in official schema 'SiiTypes_v10.xsd'
# - source:
# https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/SiiTypes_v10.xsd#L563-L570

DTE_MONTO_TOTAL_FIELD_TYPE = int
"""DTE field 'Monto Total' type."""
DTE_MONTO_TOTAL_FIELD_MIN_VALUE = 0
"""DTE field 'Monto Total' min value."""
DTE_MONTO_TOTAL_FIELD_MAX_VALUE = 10 ** 18
"""DTE field 'Monto Total' max value."""


###############################################################################
# DTE fields / Tipo de DTE
###############################################################################

# XML element 'DTEDefType/Documento/Encabezado/IdDoc/TipoDTE'
# - description: "Tipo de DTE"
# - XML type: 'DTEType'
# - source:
# https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/DTE_v10.xsd#L47-L51

DTE_TIPO_DTE_FIELD_TYPE = int
"""DTE field 'Tipo de DTE' type."""
DTE_TIPO_DTE_FIELD_MIN_VALUE = 1
"""DTE field 'Tipo de DTE' min value."""
# DTE_TIPO_DTE_FIELD_MAX_VALUE = ?
# """DTE field 'Tipo de DTE' max value."""


@enum.unique
class TipoDteEnum(enum.IntEnum):

"""
Enum of Tipo de DTE.

Source: XML type ``DTEType`` (enum) in official schema ``SiiTypes_v10.xsd``.
https://github.com/fyndata/lib-cl-sii-python/blob/8b51350/cl_sii/data/ref/factura_electronica/schema_dte/SiiTypes_v10.xsd#L63-L99

"""

FACTURA_ELECTRONICA = 33
"""Factura Electrónica."""

FACTURA_NO_AFECTA_O_EXENTA_ELECTRONICA = 34
"""Factura no Afecta o Exenta Electrónica."""
# aka 'Factura Electrónica de Venta de Bienes y Servicios No afectos o Exento de IVA'

FACTURA_COMPRA_ELECTRONICA = 46
"""Factura de Compra Electrónica."""
# Name should have been 'Factura Electrónica de Compra'.

GUIA_DESPACHO_ELECTRONICA = 52
"""Guía de Despacho Electrónica."""

NOTA_DEBITO_ELECTRONICA = 56
"""Nota de Débito Electrónica."""

NOTA_CREDITO_ELECTRONICA = 61
"""Nota de Crédito Electrónica."""
Loading