forked from elmau/empresa-libre
Verificar cancelación con certificados en CD
This commit is contained in:
parent
65851182c3
commit
0e7db2b711
|
@ -28,7 +28,8 @@ class SATCertificate(object):
|
||||||
self._init_values()
|
self._init_values()
|
||||||
self._get_data_cer(cer)
|
self._get_data_cer(cer)
|
||||||
self._get_data_key(key, password)
|
self._get_data_key(key, password)
|
||||||
self._test()
|
if not password:
|
||||||
|
self._test()
|
||||||
|
|
||||||
def _test(self):
|
def _test(self):
|
||||||
key = self._get_key('')
|
key = self._get_key('')
|
||||||
|
|
|
@ -781,8 +781,8 @@ def _cancel_with_cert(invoice, args, auth, certificado):
|
||||||
|
|
||||||
|
|
||||||
def cancel_xml_sign(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)
|
return _cancel_with_cert(invoice, args, auth, certificado)
|
||||||
|
|
||||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||||
pac = PACS[auth['pac']]()
|
pac = PACS[auth['pac']]()
|
||||||
|
@ -799,7 +799,7 @@ def cancel_xml_sign(invoice, args, auth, certificado):
|
||||||
template = TEMPLATE_CANCEL.format(**data)
|
template = TEMPLATE_CANCEL.format(**data)
|
||||||
tree = ET.fromstring(template.encode())
|
tree = ET.fromstring(template.encode())
|
||||||
sign_xml = cert.sign_xml(tree)
|
sign_xml = cert.sign_xml(tree)
|
||||||
print(sign_xml)
|
# ~ print(sign_xml)
|
||||||
|
|
||||||
result = pac.cancel_xml(sign_xml, auth, invoice.xml)
|
result = pac.cancel_xml(sign_xml, auth, invoice.xml)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue