forked from elmau/empresa-libre
Prueba de cancelación con UUID
This commit is contained in:
parent
12774af7ac
commit
0422eece40
|
@ -181,8 +181,8 @@ class SATCertificate(object):
|
||||||
node.text = self.serial_number
|
node.text = self.serial_number
|
||||||
node = xmlsec.tree.find_node(tree, 'SignatureValue')
|
node = xmlsec.tree.find_node(tree, 'SignatureValue')
|
||||||
node.text = node.text.replace('\n', '')
|
node.text = node.text.replace('\n', '')
|
||||||
# ~ node = xmlsec.tree.find_node(tree, 'Modulus')
|
node = xmlsec.tree.find_node(tree, 'Modulus')
|
||||||
# ~ node.text = node.text.replace('\n', '')
|
node.text = node.text.replace('\n', '')
|
||||||
|
|
||||||
# ~ xml_signed = ET.tostring(tree,
|
# ~ xml_signed = ET.tostring(tree,
|
||||||
# ~ xml_declaration=True, encoding='UTF-8').decode()
|
# ~ xml_declaration=True, encoding='UTF-8').decode()
|
||||||
|
|
|
@ -765,9 +765,9 @@ def get_pac_by_rfc(cfdi):
|
||||||
def _cancel_with_cert(invoice, args, auth, certificado):
|
def _cancel_with_cert(invoice, args, auth, certificado):
|
||||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||||
pac = PACS[auth['pac']]()
|
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,
|
info = {'cer': cert.cer_pem, 'key': cert.key_pem,
|
||||||
# ~ 'key_enc': cert._key_der, 'pass': cert._p, 'args': args}
|
'key_enc': cert._key_der, 'pass': cert._p, 'args': args}
|
||||||
|
|
||||||
result = pac.cancel(invoice.xml, info, auth)
|
result = pac.cancel(invoice.xml, info, auth)
|
||||||
if pac.error:
|
if pac.error:
|
||||||
|
@ -781,8 +781,8 @@ def _cancel_with_cert(invoice, args, auth, certificado):
|
||||||
|
|
||||||
|
|
||||||
def cancel_xml_sign(invoice, args, auth, certificado):
|
def cancel_xml_sign(invoice, args, auth, certificado):
|
||||||
if auth['pac'] == 'finkok':
|
# ~ if auth['pac'] == 'finkok':
|
||||||
return _cancel_with_cert(invoice, args, auth, certificado)
|
return _cancel_with_cert(invoice, args, auth, certificado)
|
||||||
|
|
||||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||||
pac = PACS[auth['pac']]()
|
pac = PACS[auth['pac']]()
|
||||||
|
|
|
@ -293,5 +293,4 @@ DEFAULT_GLOBAL = {
|
||||||
# ~ </Cancelacion>
|
# ~ </Cancelacion>
|
||||||
# ~ </CancelaCFD>"""
|
# ~ </CancelaCFD>"""
|
||||||
|
|
||||||
# ~ TEMPLATE_CANCEL = """<CancelaCFD xmlns="http://cancelacfd.sat.gob.mx"><Cancelacion xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RfcEmisor="{rfc}" Fecha="{fecha}"><Folios><Folio UUID="{uuid}" Motivo="{motivo}"{folio}/></Folios><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue/></Reference></SignedInfo><SignatureValue/><KeyInfo><X509Data><X509IssuerSerial><X509IssuerName/><X509SerialNumber/></X509IssuerSerial><X509Certificate/></X509Data><KeyValue><RSAKeyValue><Modulus/><Exponent/></RSAKeyValue></KeyValue></KeyInfo></Signature></Cancelacion></CancelaCFD>"""
|
TEMPLATE_CANCEL = """<CancelaCFD xmlns="http://cancelacfd.sat.gob.mx"><Cancelacion xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RfcEmisor="{rfc}" Fecha="{fecha}"><Folios><Folio UUID="{uuid}" Motivo="{motivo}"{folio}/></Folios><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue/></Reference></SignedInfo><SignatureValue/><KeyInfo><X509Data><X509IssuerSerial><X509IssuerName/><X509SerialNumber/></X509IssuerSerial><X509Certificate/></X509Data><KeyValue><RSAKeyValue><Modulus/><Exponent/></RSAKeyValue></KeyValue></KeyInfo></Signature></Cancelacion></CancelaCFD>"""
|
||||||
TEMPLATE_CANCEL = """<CancelaCFD xmlns="http://cancelacfd.sat.gob.mx"><Cancelacion xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RfcEmisor="{rfc}" Fecha="{fecha}"><Folios><Folio UUID="{uuid}" Motivo="{motivo}"{folio}/></Folios><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue/></Reference></SignedInfo><SignatureValue/><KeyInfo><X509Data><X509IssuerSerial><X509IssuerName/><X509SerialNumber/></X509IssuerSerial><X509Certificate/></X509Data></KeyInfo></Signature></Cancelacion></CancelaCFD>"""
|
|
||||||
|
|
Loading…
Reference in New Issue