Error al cancelar con Finkok

This commit is contained in:
El Mau 2022-02-01 21:31:06 -06:00
parent b19d087d10
commit edf35aa5ce
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,7 @@
v 1.46.2 [31-Ene-2022]
----------------------
- Error: Al generar Carta Porte sin remolque.
- Error: Al cancelar con Finkok.
v 1.46.1 [29-Ene-2022]

View File

@ -768,9 +768,18 @@ 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}
contra = ''
try:
contra = decrypt(bytes(certificado.p12).decode(), certificado.serie)
except Exception as e:
log.error(e)
if auth['pac'] == 'comercio':
msg = 'Es necesario subir de nuevo los certificados de sello'
data = {'ok': False, 'msg': msg, 'row': {}}
return data
info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'cer_ori': cert.cer,
'key_enc': certificado.key, 'pass': decrypt(bytes(certificado.p12).decode(), certificado.serie), 'args': args}
'key_enc': certificado.key, 'pass': contra, 'args': args}
result = pac.cancel(invoice.xml, info, auth)
if pac.error: