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']]()