From b19d087d10696c46e1a084199842b192c152dd65 Mon Sep 17 00:00:00 2001 From: El Mau Date: Mon, 31 Jan 2022 18:48:43 -0600 Subject: [PATCH 1/2] Error al generar Carta Porte sin remolque --- CHANGELOG.md | 5 +++++ VERSION | 2 +- source/app/controllers/cfdi_xml.py | 3 ++- source/app/settings.py | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebc3041..d9d865d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +v 1.46.2 [31-Ene-2022] +---------------------- + - Error: Al generar Carta Porte sin remolque. + + v 1.46.1 [29-Ene-2022] ---------------------- - Error: Issue #49 diff --git a/VERSION b/VERSION index 40453c5..0c0f059 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -1.46.1 +1.46.2 diff --git a/source/app/controllers/cfdi_xml.py b/source/app/controllers/cfdi_xml.py index 787cfbf..d3264c7 100644 --- a/source/app/controllers/cfdi_xml.py +++ b/source/app/controllers/cfdi_xml.py @@ -506,7 +506,8 @@ class CFDI(object): sub_node = ET.SubElement(node, f'{prefix}:Autotransporte', autotransporte) ET.SubElement(sub_node, f'{prefix}:IdentificacionVehicular', identificacion) ET.SubElement(sub_node, f'{prefix}:Seguros', seguros) - if remolque['SubTipoRem'] and remolque['Placa']: + if 'SubTipoRem' in remolque and 'Placa' in remolque \ + and remolque['SubTipoRem'] and remolque['Placa']: tmp = ET.SubElement(sub_node, f'{prefix}:Remolques') ET.SubElement(tmp, f'{prefix}:Remolque', remolque) diff --git a/source/app/settings.py b/source/app/settings.py index 7f0d30e..d473d2d 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -42,7 +42,7 @@ except ImportError: DEBUG = DEBUG -VERSION = '1.46.1' +VERSION = '1.46.2' EMAIL_SUPPORT = ('soporte@empresalibre.mx',) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION) From edf35aa5ce709a7a918545072bb00041bd4e7ec3 Mon Sep 17 00:00:00 2001 From: El Mau Date: Tue, 1 Feb 2022 21:31:06 -0600 Subject: [PATCH 2/2] Error al cancelar con Finkok --- CHANGELOG.md | 1 + source/app/controllers/utils.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9d865d..caba239 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ v 1.46.2 [31-Ene-2022] ---------------------- - Error: Al generar Carta Porte sin remolque. + - Error: Al cancelar con Finkok. v 1.46.1 [29-Ene-2022] diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 2fee82f..6df126f 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -768,9 +768,18 @@ def get_pac_by_rfc(cfdi): def _cancel_with_cert(invoice, args, auth, certificado): cert = SATCertificate(certificado.cer, certificado.key_enc.encode()) pac = PACS[auth['pac']]() - # ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args} + contra = '' + try: + contra = decrypt(bytes(certificado.p12).decode(), certificado.serie) + except Exception as e: + log.error(e) + if auth['pac'] == 'comercio': + msg = 'Es necesario subir de nuevo los certificados de sello' + data = {'ok': False, 'msg': msg, 'row': {}} + return data + info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'cer_ori': cert.cer, - 'key_enc': certificado.key, 'pass': decrypt(bytes(certificado.p12).decode(), certificado.serie), 'args': args} + 'key_enc': certificado.key, 'pass': contra, 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: