From d2bacc3b6b51ec20520407760a02330a468396be Mon Sep 17 00:00:00 2001 From: El Mau Date: Thu, 25 Nov 2021 12:51:49 -0600 Subject: [PATCH] =?UTF-8?q?Agregar=20declaraci=C3=B3n=20de=20encoding=20XM?= =?UTF-8?q?L=20para=20cancelaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 2 ++ source/app/controllers/utils.py | 2 +- source/app/settings.py | 7 +++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index 5af2f57..00ed303 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -4,6 +4,7 @@ import argparse import base64 import datetime import getpass +import hashlib import subprocess from pathlib import Path @@ -170,6 +171,7 @@ class SATCertificate(object): xml_signed = ET.tostring( tree, encoding='utf-8', xml_declaration=True).decode() + xml_signed = xml_signed.replace("'", '"').replace('utf', 'UTF') return xml_signed diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 92ba094..a698e6f 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -695,8 +695,8 @@ def cancel_xml_sign(invoice, auth, certificado): template = TEMPLATE_CANCEL.format(**data) tree = ET.fromstring(template.encode()) sign_xml = cert.sign_xml(tree) - result = pac.cancel_xml(sign_xml, auth, invoice.xml) + if pac.error: data = {'ok': False, 'msg': pac.error, 'row': {}} return data diff --git a/source/app/settings.py b/source/app/settings.py index c70dd3b..4005397 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -286,12 +286,12 @@ TEMPLATE_CANCEL = """ - + - + - + @@ -307,5 +307,4 @@ TEMPLATE_CANCEL = """ - """