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 = """"""