lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.11-19-ge1ea8db

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.11-19-ge1ea8db



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  e1ea8db04fb9754b9fc65a7432d088a892110a94 (commit)
      from  817c177dc2699856289821e74abcc1836a02ef7f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=e1ea8db04fb9754b9fc65a7432d088a892110a94

commit e1ea8db04fb9754b9fc65a7432d088a892110a94
Author: Jeffry Jesus De La Rosa <jeffryjesus@gmail.com>
Date:   Fri Jun 14 11:14:15 2019 -0400

    Update Dominican Republic e-CF documents types
    
    The document type values are different from the NCF document types
    
https://dgii.gov.do/contribuyentes/personasFisicas/inicioOperaciones/ComprobantesFiscales/Paginas/comprobantesFiscalesElectronicos.aspx
    
    Closes https://github.com/arthurdejong/python-stdnum/pull/138

diff --git a/stdnum/do/ncf.py b/stdnum/do/ncf.py
index ce53d16..aa4c924 100644
--- a/stdnum/do/ncf.py
+++ b/stdnum/do/ncf.py
@@ -42,9 +42,10 @@ More information:
 
  * https://www.dgii.gov.do/
  * https://dgii.gov.do/legislacion/normas/Documents/Norma05-19.pdf
+ * 
https://dgii.gov.do/contribuyentes/personasFisicas/inicioOperaciones/ComprobantesFiscales/Paginas/comprobantesFiscalesElectronicos.aspx
 
->>> validate('E010000000005')  # format since 2019-04-08
-'E010000000005'
+>>> validate('E310000000005')  # format since 2019-04-08
+'E310000000005'
 >>> validate('B0100000005')  # format since 2018-05-01
 'B0100000005'
 >>> validate('A020010210100000005')  # format before 2018-05-01
@@ -66,7 +67,7 @@ def compact(number):
 
 
 # The following document types are known:
-_document_types = (
+_ncf_document_types = (
     '01',  # invoices for fiscal declaration (or tax reporting)
     '02',  # invoices for final consumer
     '03',  # debit note
@@ -78,6 +79,17 @@ _document_types = (
     '15',  # invoices for the government
 )
 
+_ecf_document_types = (
+    '31',  # invoices for fiscal declaration (or tax reporting)
+    '32',  # invoices for final consumer
+    '33',  # debit note
+    '34',  # credit note (refunds)
+    '41',  # supplier invoices (purchases)
+    '43',  # minor expenses invoices (purchases)
+    '44',  # invoices for special customers (tourists, free zones)
+    '45',  # invoices for the government
+)
+
 
 def validate(number):
     """Check if the number provided is a valid NCF."""
@@ -85,17 +97,17 @@ def validate(number):
     if len(number) == 13:
         if number[0] != 'E' or not isdigits(number[1:]):
             raise InvalidFormat()
-        if number[1:3] not in _document_types:
+        if number[1:3] not in _ecf_document_types:
             raise InvalidComponent()
     elif len(number) == 11:
         if number[0] != 'B' or not isdigits(number[1:]):
             raise InvalidFormat()
-        if number[1:3] not in _document_types:
+        if number[1:3] not in _ncf_document_types:
             raise InvalidComponent()
     elif len(number) == 19:
         if number[0] not in 'AP' or not isdigits(number[1:]):
             raise InvalidFormat()
-        if number[9:11] not in _document_types:
+        if number[9:11] not in _ncf_document_types:
             raise InvalidComponent()
     else:
         raise InvalidLength()

-----------------------------------------------------------------------

Summary of changes:
 stdnum/do/ncf.py | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
python-stdnum