Verificar cancelación con certificados en CD

This commit is contained in:
El Mau 2022-01-22 22:16:52 -06:00
parent 65851182c3
commit 0e7db2b711
2 changed files with 5 additions and 4 deletions

View File

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

View File

@ -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)