Agregar archivos requeridos para CartaPorte 2.0

This commit is contained in:
El Mau 2021-12-03 21:41:37 -06:00
parent 4a84654117
commit 69402e03bb
5 changed files with 43 additions and 38 deletions

View File

@ -162,16 +162,15 @@ class SATCertificate(object):
node = xmlsec.tree.find_node(tree, 'X509Certificate')
node.text = self.cer_txt
node = xmlsec.tree.find_node(tree, 'X509IssuerName')
node.text = self.issuer
# ~ node = xmlsec.tree.find_node(tree, 'X509IssuerName')
# ~ node.text = self.issuer
node = xmlsec.tree.find_node(tree, 'X509SerialNumber')
node.text = self.serial_number2
node = xmlsec.tree.find_node(tree, 'SignatureValue')
node.text = node.text.replace('\n', '')
node.text = self.serial_number
# ~ node = xmlsec.tree.find_node(tree, 'SignatureValue')
# ~ node.text = node.text.replace('\n', '')
xml_signed = ET.tostring(
tree, encoding='utf-8', xml_declaration=True).decode()
# ~ xml_signed = xml_signed.replace("'", '"').replace('utf', 'UTF')
xml_signed = ET.tostring(tree,
xml_declaration=True, encoding='UTF-8').decode()
return xml_signed

View File

@ -682,7 +682,7 @@ def _cancel_with_cert(invoice, auth, certificado):
def cancel_xml_sign(invoice, auth, certificado):
return _cancel_with_cert(invoice, auth, certificado)
# ~ return _cancel_with_cert(invoice, auth, certificado)
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
pac = PACS[auth['pac']]()

View File

@ -250,32 +250,37 @@ DEFAULT_GLOBAL = {
'clave_sat': '01010101',
}
TEMPLATE_CANCEL = """<Cancelacion xmlns="http://cancelacfd.sat.gob.mx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Fecha="{fecha}" RfcEmisor="{rfc}">
<Folios>
<UUID>{uuid}</UUID>
</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>
"""
TEMPLATE_CANCEL = """<Cancelacion xmlns="http://cancelacfd.sat.gob.mx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RfcEmisor="{rfc}" Fecha="{fecha}">
<Folios>
<UUID>{uuid}</UUID>
</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>"""

View File

@ -15,6 +15,7 @@
<xsl:include href="pagos10.xslt"/>
<xsl:include href="divisas.xslt"/>
<xsl:include href="servicioconstruccion.xslt"/>
<xsl:include href="cartaporte20.xslt"/>
<!--
<xsl:include href="ecc11.xslt"/>

View File