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,6 +28,7 @@ class SATCertificate(object):
self._init_values()
self._get_data_cer(cer)
self._get_data_key(key, password)
if not password:
self._test()
def _test(self):

View File

@ -781,7 +781,7 @@ def _cancel_with_cert(invoice, args, auth, certificado):
def cancel_xml_sign(invoice, args, auth, certificado):
# ~ if auth['pac'] == 'finkok':
if auth['pac'] == 'finkok':
return _cancel_with_cert(invoice, args, auth, certificado)
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
@ -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)