Cambio de método de cancelación

This commit is contained in:
Mauricio Baeza 2017-12-28 01:08:49 -06:00
parent ea8f88ef1d
commit ce53a65c66
2 changed files with 11 additions and 2 deletions

View File

@ -1313,6 +1313,15 @@ def upload_file(rfc, opt, file_obj):
return {'status': 'error', 'ok': False}
def _get_pem_from_pfx(cert):
tmp_p12 = save_temp(cert.p12)
args = "openssl pkcs12 -in '{}' -clcerts -nodes -nocerts " \
"-passin pass:'{}' | openssl rsa".format(tmp_p12, _get_md5(cert.rfc))
result = _call(args)
_kill(tmp_p12)
return result.encode()
def cancel_xml(auth, uuid, certificado):
from .pac import Finkok as PAC
@ -1328,7 +1337,7 @@ def cancel_xml(auth, uuid, certificado):
data = {'ok': True, 'msg': msg, 'row': {'estatus': 'Cancelada'}}
pac = PAC(auth)
result = pac.cancel_xml(certificado.rfc, str(uuid).upper(),
certificado.cer_pem.encode(), certificado.key_enc.encode())
certificado.cer_pem.encode(), _get_pem_from_pfx(certificado))
if result:
codes = {None: '',
'Could not get UUID Text': 'UUID no encontrado',

View File

@ -117,4 +117,4 @@ IMPUESTOS = {
DEFAULT_SAT_PRODUCTO = '01010101'
DIR_FACTURAS = 'facturas'
USAR_TOKEN = False
CANCEL_SIGNATURE = True
CANCEL_SIGNATURE = False