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)