Fix in cancel with Finkok

This commit is contained in:
el Mau 2023-02-08 21:43:38 -06:00
commit 434e15bb5b
1 changed files with 10 additions and 2 deletions

View File

@ -47,7 +47,7 @@ logging.getLogger('zeep').setLevel(logging.ERROR)
TIMEOUT = 10 TIMEOUT = 10
DEBUG_SOAP = True DEBUG_SOAP = False
class DebugPlugin(Plugin): class DebugPlugin(Plugin):
@ -190,11 +190,18 @@ class PACFinkok(object):
return data return data
def _get_data_cancel(self, cfdi): def _get_data_cancel(self, cfdi):
VERSIONS = {
'3.3': 'http://www.sat.gob.mx/cfd/3',
'4.0': 'http://www.sat.gob.mx/cfd/4',
}
NS_CFDI = { NS_CFDI = {
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital', 'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
} }
tree = ET.fromstring(cfdi.encode()) tree = ET.fromstring(cfdi.encode())
version = tree.attrib['Version']
NS_CFDI['cfdi'] = VERSIONS[version]
rfc_emisor = tree.xpath( rfc_emisor = tree.xpath(
'string(//cfdi:Comprobante/cfdi:Emisor/@Rfc)', 'string(//cfdi:Comprobante/cfdi:Emisor/@Rfc)',
namespaces=NS_CFDI) namespaces=NS_CFDI)
@ -223,6 +230,7 @@ class PACFinkok(object):
'Motivo': info['args']['reason'], 'Motivo': info['args']['reason'],
} }
# ~ 'UUIDS': uuid_type(uuids=sa(string=cfdi_uuid)), # ~ 'UUIDS': uuid_type(uuids=sa(string=cfdi_uuid)),
args = { args = {
'UUIDS': uuid_type(ns1_uuid(**data_uuid)), 'UUIDS': uuid_type(ns1_uuid(**data_uuid)),
'username': auth['user'], 'username': auth['user'],