From 5b997f78582d61ade20ae8a9d8acc4400b497da1 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 19:34:40 -0600 Subject: [PATCH 01/13] Verificar cancelaion con certificados en CD --- source/app/controllers/pacs/comerciodigital/comercio.py | 2 +- source/app/controllers/utils.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/app/controllers/pacs/comerciodigital/comercio.py b/source/app/controllers/pacs/comerciodigital/comercio.py index 8976496..a9ca6d9 100644 --- a/source/app/controllers/pacs/comerciodigital/comercio.py +++ b/source/app/controllers/pacs/comerciodigital/comercio.py @@ -148,7 +148,7 @@ class PACComercioDigital(object): return data def _get_data_cancel(self, cfdi, info, auth): - info['pass'] = '' + # ~ info['pass'] = '' info['tipo'] = 'cfdi' info['key'] = base64.b64encode(info['key']).decode() info['cer'] = base64.b64encode(info['cer']).decode() diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index b6b8a90..7e608e3 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -765,7 +765,7 @@ 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, 'args': args} + info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': 'p', 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: @@ -779,9 +779,8 @@ def _cancel_with_cert(invoice, args, auth, certificado): def cancel_xml_sign(invoice, args, auth, certificado): - # ~ if DEBUG: - if auth['pac'] == 'finkok': - return _cancel_with_cert(invoice, args, auth, certificado) + # ~ if auth['pac'] == 'finkok': + return _cancel_with_cert(invoice, args, auth, certificado) cert = SATCertificate(certificado.cer, certificado.key_enc.encode()) pac = PACS[auth['pac']]() From d237b33020ad348d93fdb5258193365718121fb6 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 19:47:41 -0600 Subject: [PATCH 02/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 1 + source/app/controllers/utils.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index fe1cf61..c4a549a 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -28,6 +28,7 @@ class SATCertificate(object): self._init_values() self._get_data_cer(cer) self._get_data_key(key, password) + self._p = self._get_hash() def _init_values(self): self._rfc = '' diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 7e608e3..f6bb2a9 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -765,7 +765,8 @@ 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': 'p', 'args': args} + info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': cert._p, 'args': args} + # ~ print(info['pass']) result = pac.cancel(invoice.xml, info, auth) if pac.error: From 0adcd7f30fc1d6db15fac61cf1572b0afa3ad749 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 20:01:53 -0600 Subject: [PATCH 03/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 7 +-- source/app/controllers/utils.py | 8 +-- source/app/settings.py | 69 ++++++++++++------------ 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index c4a549a..ea327ed 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -28,7 +28,6 @@ class SATCertificate(object): self._init_values() self._get_data_cer(cer) self._get_data_key(key, password) - self._p = self._get_hash() def _init_values(self): self._rfc = '' @@ -167,8 +166,10 @@ class SATCertificate(object): # ~ node.text = self.issuer node = xmlsec.tree.find_node(tree, 'X509SerialNumber') node.text = self.serial_number - # ~ node = xmlsec.tree.find_node(tree, 'SignatureValue') - # ~ node.text = node.text.replace('\n', '') + node = xmlsec.tree.find_node(tree, 'SignatureValue') + node.text = node.text.replace('\n', '') + node = xmlsec.tree.find_node(tree, 'Modulus') + node.text = node.text.replace('\n', '') xml_signed = ET.tostring(tree, xml_declaration=True, encoding='UTF-8').decode() diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index f6bb2a9..5d81966 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -765,8 +765,7 @@ 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': cert._p, 'args': args} - # ~ print(info['pass']) + info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: @@ -780,8 +779,8 @@ def _cancel_with_cert(invoice, args, auth, certificado): def cancel_xml_sign(invoice, args, auth, certificado): - # ~ if auth['pac'] == 'finkok': - return _cancel_with_cert(invoice, args, auth, certificado) + if auth['pac'] == 'finkok': + return _cancel_with_cert(invoice, args, auth, certificado) cert = SATCertificate(certificado.cer, certificado.key_enc.encode()) pac = PACS[auth['pac']]() @@ -798,6 +797,7 @@ def cancel_xml_sign(invoice, args, auth, certificado): template = TEMPLATE_CANCEL.format(**data) tree = ET.fromstring(template.encode()) sign_xml = cert.sign_xml(tree) + print(sign_xml) result = pac.cancel_xml(sign_xml, auth, invoice.xml) diff --git a/source/app/settings.py b/source/app/settings.py index f0d70a1..d717108 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -256,37 +256,38 @@ DEFAULT_GLOBAL = { 'clave_sat': '01010101', } -TEMPLATE_CANCEL = """ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -""" +# ~ TEMPLATE_CANCEL = """ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ + # ~ +# ~ """ +TEMPLATE_CANCEL = """""" From dbc8717575cae198071a2f1bb3b99b925a7c5879 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 20:04:12 -0600 Subject: [PATCH 04/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index ea327ed..de63bc8 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -166,10 +166,10 @@ class SATCertificate(object): # ~ node.text = self.issuer node = xmlsec.tree.find_node(tree, 'X509SerialNumber') node.text = self.serial_number - node = xmlsec.tree.find_node(tree, 'SignatureValue') - node.text = node.text.replace('\n', '') - node = xmlsec.tree.find_node(tree, 'Modulus') - node.text = node.text.replace('\n', '') + # ~ node = xmlsec.tree.find_node(tree, 'SignatureValue') + # ~ node.text = node.text.replace('\n', '') + # ~ node = xmlsec.tree.find_node(tree, 'Modulus') + # ~ node.text = node.text.replace('\n', '') xml_signed = ET.tostring(tree, xml_declaration=True, encoding='UTF-8').decode() From 7bcf6d6e3cad1e1e8f207eeaae7061f16db3bd46 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 20:17:42 -0600 Subject: [PATCH 05/13] =?UTF-8?q?Agregar=20columna=20m=C3=A9todo=20de=20pa?= =?UTF-8?q?go=20al=20listado=20de=20facturas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/models/main.py | 1 + source/app/settings.py | 70 ++++++++++++++++----------------- source/static/js/ui/invoices.js | 2 + 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/source/app/models/main.py b/source/app/models/main.py index 3c5c2fb..f9932cb 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -4518,6 +4518,7 @@ class Facturas(BaseModel): (True, 'Si'), (False, 'No'), )).alias('paid'), + Facturas.metodo_pago, Facturas.total, Facturas.moneda.alias('currency'), Facturas.total_mn, diff --git a/source/app/settings.py b/source/app/settings.py index d717108..a209e41 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -256,38 +256,38 @@ DEFAULT_GLOBAL = { 'clave_sat': '01010101', } -# ~ TEMPLATE_CANCEL = """ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ - # ~ -# ~ """ -TEMPLATE_CANCEL = """""" +TEMPLATE_CANCEL = """ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" +# ~ TEMPLATE_CANCEL = """""" diff --git a/source/static/js/ui/invoices.js b/source/static/js/ui/invoices.js index a897c6b..6a05e3c 100644 --- a/source/static/js/ui/invoices.js +++ b/source/static/js/ui/invoices.js @@ -258,6 +258,8 @@ var grid_invoices_cols = [ adjust: "data", sort:"string"}, {id: "paid", header: ["Pagada", {content: "selectFilter"}], adjust: "data", sort:"string"}, + {id: 'metodo_pago', header: ['Método de Pago', {content: 'selectFilter'}], + adjust: 'data', hidden: true}, {id: 'total', header: ['Total', {content: 'numberFilter'}], width: 125, sort: 'int', format: webix.i18n.priceFormat, css: 'right', hidden: true}, From 0a98338fadc1da59187f0b7565bcb12fde845fbd Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 20:24:06 -0600 Subject: [PATCH 06/13] Fix - Issue #40 --- source/app/models/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/app/models/main.py b/source/app/models/main.py index f9932cb..1a4c8f4 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -7636,10 +7636,12 @@ class CfdiPagos(BaseModel): files = (self.get_file_pdf(id), self.get_file_xml(id)) fields = util.make_fields(obj.xml) + starttls = bool(int(values.get('correo_starttls', '0'))) server = { 'servidor': values['correo_servidor'], 'puerto': values['correo_puerto'], 'ssl': bool(int(values['correo_ssl'])), + 'starttls': starttls, 'usuario': values['correo_usuario'], 'contra': utils.decrypt(contra, rfc), } @@ -8888,10 +8890,12 @@ class CfdiNomina(BaseModel): ) message = subject = f"Enviamos tu recibo de nómina" + starttls = bool(int(values.get('correo_starttls', '0'))) server = { 'server': config['correo_servidor'], 'port': config['correo_puerto'], 'ssl': utils.to_bool(config['correo_ssl']), + 'starttls': starttls, 'user': config['correo_usuario'], 'pass': utils.decrypt(contra, emisor.rfc), } From 8b91532b823e6b46beae91580cfaba4c50aa9f5e Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 21:11:18 -0600 Subject: [PATCH 07/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 1 + source/app/controllers/pacs/comerciodigital/comercio.py | 3 +-- source/app/controllers/utils.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index de63bc8..2bacac4 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -28,6 +28,7 @@ class SATCertificate(object): self._init_values() self._get_data_cer(cer) self._get_data_key(key, password) + self._p = self._get_hash() def _init_values(self): self._rfc = '' diff --git a/source/app/controllers/pacs/comerciodigital/comercio.py b/source/app/controllers/pacs/comerciodigital/comercio.py index a9ca6d9..b053c2e 100644 --- a/source/app/controllers/pacs/comerciodigital/comercio.py +++ b/source/app/controllers/pacs/comerciodigital/comercio.py @@ -148,9 +148,8 @@ class PACComercioDigital(object): return data def _get_data_cancel(self, cfdi, info, auth): - # ~ info['pass'] = '' info['tipo'] = 'cfdi' - info['key'] = base64.b64encode(info['key']).decode() + info['key'] = base64.b64encode(info['key_enc']).decode() info['cer'] = base64.b64encode(info['cer']).decode() NS_CFDI = { diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 5d81966..75f3282 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -765,7 +765,9 @@ 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} + # ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args} + info = {'cer': cert.cer_pem, 'key': cert.key_pem, + 'key_enc': cert.key_enc, 'pass': cert._p, 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: @@ -779,8 +781,8 @@ def _cancel_with_cert(invoice, args, auth, certificado): def cancel_xml_sign(invoice, args, auth, certificado): - if auth['pac'] == 'finkok': - return _cancel_with_cert(invoice, args, auth, certificado) + # ~ if auth['pac'] == 'finkok': + return _cancel_with_cert(invoice, args, auth, certificado) cert = SATCertificate(certificado.cer, certificado.key_enc.encode()) pac = PACS[auth['pac']]() From f84721716c6fa55f15d9155f5bbe75fcaa910551 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 21:21:55 -0600 Subject: [PATCH 08/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 75f3282..7ccd468 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -767,7 +767,7 @@ def _cancel_with_cert(invoice, args, auth, certificado): pac = PACS[auth['pac']]() # ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args} info = {'cer': cert.cer_pem, 'key': cert.key_pem, - 'key_enc': cert.key_enc, 'pass': cert._p, 'args': args} + 'key_enc': cert.key_enc, 'pass': cert._p.hex(), 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: From 5a24bc159d75b9cc557a9cd896fb470475e04a33 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 21:35:53 -0600 Subject: [PATCH 09/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 11 +++++++++++ source/app/controllers/utils.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index 2bacac4..210ec53 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -28,7 +28,17 @@ class SATCertificate(object): self._init_values() self._get_data_cer(cer) self._get_data_key(key, password) + self._test() + + def _test(self): self._p = self._get_hash() + key = self._get_key('') + self._key_der = key.private_bytes( + encoding=serialization.Encoding.DER, + format=serialization.PrivateFormat.TraditionalOpenSSL, + encryption_algorithm=serialization.NoEncryption() + ) + return def _init_values(self): self._rfc = '' @@ -45,6 +55,7 @@ class SATCertificate(object): self._cer_pem = '' self._cer_txt = '' self._key_enc = b'' + self._key_der = b'' self._p12 = b'' self._cer_modulus = 0 self._key_modulus = 0 diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 7ccd468..9630edd 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -767,7 +767,7 @@ def _cancel_with_cert(invoice, args, auth, certificado): pac = PACS[auth['pac']]() # ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args} info = {'cer': cert.cer_pem, 'key': cert.key_pem, - 'key_enc': cert.key_enc, 'pass': cert._p.hex(), 'args': args} + 'key_enc': cert._key_der, 'pass': cert._p.hex(), 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: From 2de98b9b925cc576a84dc2c8b87ac8bcf9630d42 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 21:54:31 -0600 Subject: [PATCH 10/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 6 +++--- source/app/controllers/utils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index 210ec53..185bca2 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -31,12 +31,12 @@ class SATCertificate(object): self._test() def _test(self): - self._p = self._get_hash() key = self._get_key('') + self._p = f"{self.rfc}|{self.serial_number}" self._key_der = key.private_bytes( encoding=serialization.Encoding.DER, - format=serialization.PrivateFormat.TraditionalOpenSSL, - encryption_algorithm=serialization.NoEncryption() + format=serialization.PrivateFormat.PKCS8, + encryption_algorithm=serialization.BestAvailableEncryption(self._p.encode()) ) return diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 9630edd..8259af0 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -767,7 +767,7 @@ def _cancel_with_cert(invoice, args, auth, certificado): pac = PACS[auth['pac']]() # ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args} info = {'cer': cert.cer_pem, 'key': cert.key_pem, - 'key_enc': cert._key_der, 'pass': cert._p.hex(), 'args': args} + 'key_enc': cert._key_der, 'pass': cert._p, 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: From 65851182c35bce6d1dc72917433c67d0b4e4c1c5 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 22:02:02 -0600 Subject: [PATCH 11/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index 185bca2..9319da8 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -32,7 +32,7 @@ class SATCertificate(object): def _test(self): key = self._get_key('') - self._p = f"{self.rfc}|{self.serial_number}" + self._p = TOKEN self._key_der = key.private_bytes( encoding=serialization.Encoding.DER, format=serialization.PrivateFormat.PKCS8, From 0e7db2b711450356d5d28a84cce55d51395d312d Mon Sep 17 00:00:00 2001 From: El Mau Date: Sat, 22 Jan 2022 22:16:52 -0600 Subject: [PATCH 12/13] =?UTF-8?q?Verificar=20cancelaci=C3=B3n=20con=20cert?= =?UTF-8?q?ificados=20en=20CD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/app/controllers/pacs/cfdi_cert.py | 3 ++- source/app/controllers/utils.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/app/controllers/pacs/cfdi_cert.py b/source/app/controllers/pacs/cfdi_cert.py index 9319da8..eb5ef5f 100644 --- a/source/app/controllers/pacs/cfdi_cert.py +++ b/source/app/controllers/pacs/cfdi_cert.py @@ -28,7 +28,8 @@ class SATCertificate(object): self._init_values() self._get_data_cer(cer) self._get_data_key(key, password) - self._test() + if not password: + self._test() def _test(self): key = self._get_key('') diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index 8259af0..ef45282 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -781,8 +781,8 @@ def _cancel_with_cert(invoice, args, auth, certificado): def cancel_xml_sign(invoice, args, auth, certificado): - # ~ if auth['pac'] == 'finkok': - return _cancel_with_cert(invoice, args, auth, certificado) + if auth['pac'] == 'finkok': + return _cancel_with_cert(invoice, args, auth, certificado) cert = SATCertificate(certificado.cer, certificado.key_enc.encode()) pac = PACS[auth['pac']]() @@ -799,7 +799,7 @@ def cancel_xml_sign(invoice, args, auth, certificado): template = TEMPLATE_CANCEL.format(**data) tree = ET.fromstring(template.encode()) sign_xml = cert.sign_xml(tree) - print(sign_xml) + # ~ print(sign_xml) result = pac.cancel_xml(sign_xml, auth, invoice.xml) From 7a88c4b97fc87c454884348106e92e0537fa0c18 Mon Sep 17 00:00:00 2001 From: El Mau Date: Sun, 23 Jan 2022 23:10:28 -0600 Subject: [PATCH 13/13] Fix - Issue #40 --- CHANGELOG.md | 5 +++++ VERSION | 2 +- source/app/controllers/utils.py | 6 +++--- source/app/settings.py | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4551661..9910ab1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +v 1.45.3 [23-Ene-2022] +---------------------- + - Error: El enviar por correo CFDI de pago. Ticket #40 + + v 1.45.2 [21-Ene-2022] ---------------------- - Error: Al cancelar un CFDI diff --git a/VERSION b/VERSION index e522f07..1a5c268 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -1.45.2 +1.45.3 diff --git a/source/app/controllers/utils.py b/source/app/controllers/utils.py index ef45282..72312ef 100644 --- a/source/app/controllers/utils.py +++ b/source/app/controllers/utils.py @@ -765,9 +765,9 @@ 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} - info = {'cer': cert.cer_pem, 'key': cert.key_pem, - 'key_enc': cert._key_der, 'pass': cert._p, 'args': args} + info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args} + # ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, + # ~ 'key_enc': cert._key_der, 'pass': cert._p, 'args': args} result = pac.cancel(invoice.xml, info, auth) if pac.error: diff --git a/source/app/settings.py b/source/app/settings.py index a209e41..eecb97a 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -42,7 +42,7 @@ except ImportError: DEBUG = DEBUG -VERSION = '1.45.2' +VERSION = '1.45.3' EMAIL_SUPPORT = ('soporte@empresalibre.mx',) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)