Se soluciono efocs

This commit is contained in:
2025-10-05 23:55:35 -06:00
parent a0055de043
commit ad947b884e
3 changed files with 93 additions and 59 deletions

View File

@@ -11,31 +11,34 @@ class EdocVuController(VUCEMController):
def __init__(self):
super().__init__()
def generate_edoc_template(self, **kwargs) -> str:
def generate_edocument_template(self, username: str, password: str, idEDocument: str) -> str:
"""
Genera el template XML de la solicitud SOAP para un edoc.
Genera el template SOAP para consultar un EDocument específico
Args:
username: Usuario de VUCEM
password: Contraseña de VUCEM
idEDocument: ID del EDocument
Returns:
str: Template SOAP XML completo
"""
credencial = kwargs.get("credencial", {})
username = credencial.get("user")
password = credencial.get("password")
# Aquí usamos `numero_documento` en lugar de `idEDocument` para reflejar el esquema de edocs
numero_documento = kwargs['edoc'].get("numero_edocument", "N/A")
soap_template = f'''
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:edoc="http://www.ventanillaunica.gob.mx/consulta/edocs/oxml">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>{username}</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{password}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<edoc:consultaEdocumentoPeticion>
<idEdocument>{numero_documento}</idEdocument>
</edoc:consultaEdocumentoPeticion>
</soapenv:Body>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/">
<soapenv:Header>
<tem:UserName>{username}</tem:UserName>
<tem:Password>{password}</tem:Password>
</soapenv:Header>
<soapenv:Body>
<tem:DocumentoIn>
<tem:Edocument>{idEDocument}</tem:Edocument>
<tem:IsCertificado>1</tem:IsCertificado>
</tem:DocumentoIn>
</soapenv:Body>
</soapenv:Envelope>
'''
return soap_template