Verificar cancelación con certificados en CD
This commit is contained in:
parent
0a98338fad
commit
8b91532b82
|
@ -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 = ''
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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']]()
|
||||
|
|
Loading…
Reference in New Issue