diff --git a/.gitignore b/.gitignore
index 6055b65..4b3ac4a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
conf.py
.pyenv/
__pycache__/
+env/
diff --git a/ejemplos/cfdi_minimo.json b/ejemplos/cfdi_minimo.json
index e1b96d1..9c1dd34 100644
--- a/ejemplos/cfdi_minimo.json
+++ b/ejemplos/cfdi_minimo.json
@@ -1,6 +1,5 @@
{
"comprobante" : {
- "NoCertificado": "20001000000300022815",
"TipoCambio": "1",
"Moneda": "MXN",
"TipoDeComprobante": "I",
@@ -8,15 +7,20 @@
"SubTotal": "1000.00",
"Total": "1160.00",
"FormaPago": "03",
- "MetodoPago": "PUE"
+ "MetodoPago": "PUE",
+ "Exportacion": "01"
},
"emisor": {
- "Rfc": "LAN7008173R5",
+ "Rfc": "EKU9003173C9",
+ "Nombre": "ESCUELA KEMPER URGATE",
"RegimenFiscal": "601"
},
"receptor": {
"Rfc": "BASM740115RW0",
- "UsoCFDI": "G01"
+ "Nombre": "MAURICIO BAEZA SERVIN",
+ "DomicilioFiscalReceptor": "06850",
+ "RegimenFiscalReceptor": "612" ,
+ "UsoCFDI": "G03"
},
"conceptos": [
{
@@ -26,6 +30,7 @@
"Descripcion": "Asesoría en desarrollo",
"ValorUnitario": "1000.00",
"Importe": "1000.00",
+ "ObjetoImp": "02",
"impuestos": {
"traslados": [
{
@@ -43,6 +48,7 @@
"TotalImpuestosTrasladados": "160.00",
"traslados": [
{
+ "Base": "1000.00",
"Impuesto": "002",
"TipoFactor": "Tasa",
"TasaOCuota": "0.160000",
diff --git a/source/cfdi-test.py b/source/cfdi-test.py
index 9b8e89c..0084455 100755
--- a/source/cfdi-test.py
+++ b/source/cfdi-test.py
@@ -46,7 +46,7 @@ def _process_command_line_arguments():
parser.add_argument('-d', '--dir-trabajo', dest='dir_trabajo', default='')
parser.add_argument('-de', '--dir-entrada', dest='dir_entrada', default='')
parser.add_argument('-dg', '--dir-generados', dest='dir_generados', default='')
- parser.add_argument('-dp', '--dir-por-timbrar', dest='dir_por_timbrar', default='')
+ parser.add_argument('-ds', '--dir-sellados', dest='dir_sellados', default='')
parser.add_argument('-dt', '--dir-timbrados', dest='dir_timbrados', default='')
parser.add_argument('-g', '--generar', dest='generar',
@@ -55,8 +55,6 @@ def _process_command_line_arguments():
action='store_true', default=False, required=False)
parser.add_argument('-t', '--timbrar', dest='timbrar',
action='store_true', default=False, required=False)
- parser.add_argument('-c', '--cancelar', dest='cancelar',
- action='store_true', default=False, required=False)
return parser.parse_args()
diff --git a/source/comercio/comercio.py b/source/comercio/comercio.py
index c3d6d95..6149920 100644
--- a/source/comercio/comercio.py
+++ b/source/comercio/comercio.py
@@ -35,16 +35,16 @@ TIMEOUT = 10
class PACComercioDigital(object):
ws = 'https://{}.comercio-digital.mx/{}'
URL = {
- 'timbra': ws.format('ws', 'timbre/timbrarV5.aspx'),
- 'cancel': ws.format('cancela', 'cancela3/cancelarUuid'),
- 'cancelxml': ws.format('cancela', 'cancela3/cancelarXml'),
+ 'timbra': ws.format('ws', 'timbre4/timbrarV5.aspx'),
+ 'cancel': ws.format('cancela', 'cancela4/cancelarUuid'),
+ 'cancelxml': ws.format('cancela', 'cancela4/cancelarXml'),
}
if DEBUG:
ws = 'https://pruebas.comercio-digital.mx/{}'
URL = {
- 'timbra': ws.format('timbre/timbrarV5.aspx'),
- 'cancel': ws.format('cancela3/cancelarUuid'),
- 'cancelxml': ws.format('cancela3/cancelarXml'),
+ 'timbra': ws.format('timbre4/timbrarV5'),
+ 'cancel': ws.format('cancela4/cancelarUuid'),
+ 'cancelxml': ws.format('cancela4/cancelarXml'),
}
def __init__(self):
diff --git a/source/util.py b/source/util.py
index 31c3370..f5ba6c6 100644
--- a/source/util.py
+++ b/source/util.py
@@ -26,11 +26,11 @@ log = logging.getLogger(__name__)
PACs = {
- 'finkok': PACFinkok,
+ # ~ 'finkok': PACFinkok,
'comercio': PACComercioDigital,
}
NS_CFDI = {
- 'cfdi': 'http://www.sat.gob.mx/cfd/3',
+ 'cfdi': 'http://www.sat.gob.mx/cfd/4',
}
@@ -52,10 +52,10 @@ def _join(*paths):
class CFDI(object):
- _version = '3.3'
+ _version = '4.0'
_prefix = 'cfdi'
- _xmlns = 'http://www.sat.gob.mx/cfd/3'
- schema = f'{_xmlns} http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd'
+ _xmlns = 'http://www.sat.gob.mx/cfd/4'
+ schema = f'{_xmlns} http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd'
_pagos = 'http://www.sat.gob.mx/Pagos'
PAGOS = {
'version': '1.0',
diff --git a/source/xslt/cadena.xslt b/source/xslt/cadena.xslt
index 285b0cf..e238e33 100644
--- a/source/xslt/cadena.xslt
+++ b/source/xslt/cadena.xslt
@@ -1,327 +1,401 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |||
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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