Merge branch 'develop'
Cambio de método de cancelación. Mensaje al cancelar 3.2.
This commit is contained in:
commit
37c3b00362
|
@ -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',
|
||||
|
|
|
@ -2292,6 +2292,11 @@ class Facturas(BaseModel):
|
|||
auth = Emisor.get_auth()
|
||||
certificado = Certificado.select()[0]
|
||||
obj = Facturas.get(Facturas.id==id)
|
||||
|
||||
if obj.version == '3.2':
|
||||
msg = 'No es posible cancelar CFDI 3.2'
|
||||
return {'ok': False, 'msg': msg}
|
||||
|
||||
data, result = util.cancel_xml(auth, obj.uuid, certificado)
|
||||
if data['ok']:
|
||||
obj.estatus = 'Cancelada'
|
||||
|
|
|
@ -117,4 +117,4 @@ IMPUESTOS = {
|
|||
DEFAULT_SAT_PRODUCTO = '01010101'
|
||||
DIR_FACTURAS = 'facturas'
|
||||
USAR_TOKEN = False
|
||||
CANCEL_SIGNATURE = True
|
||||
CANCEL_SIGNATURE = False
|
Loading…
Reference in New Issue