fix: nuevos ajustes en enpoints para guardar las petciones a vu

This commit is contained in:
2026-01-02 08:45:46 -07:00
parent b879e5c24d
commit 28d3352543
5 changed files with 100 additions and 0 deletions

View File

@@ -22,6 +22,28 @@ soap_headers = {
async def obtener_acuse(**kwargs): async def obtener_acuse(**kwargs):
soap_xml = acuse_vu_controller.generate_acuse_template(**kwargs) soap_xml = acuse_vu_controller.generate_acuse_template(**kwargs)
# Enviar documento a EFC
try:
pedimento_efc = kwargs.get('pedimento', {})
pedimento_app = pedimento_efc.get('pedimento_app','N/A')
organizacion_efc = pedimento_efc.get("organizacion", None)
pedimento_id_efc = pedimento_efc.get("id", None)
idEdocument_efc = kwargs['edoc'].get('numero_edocument', 'N/A')
file_name_request = f"vu_AC_{pedimento_app}_{idEdocument_efc}_REQUEST.xml"
document_response = await acuse_rest_controller.post_document(
soap_response=soap_xml,
organizacion=organizacion_efc,
pedimento=pedimento_id_efc,
file_name=file_name_request,
document_type=25, # Tipo de documento para request de acuse VU
)
except Exception as e:
logger.error(f"Error al enviar solicitud SOAP: {e}")
response = await acuse_vu_controller.make_request_async( response = await acuse_vu_controller.make_request_async(
"ventanilla-acuses-HA/ConsultaAcusesServiceWS?wsdl", "ventanilla-acuses-HA/ConsultaAcusesServiceWS?wsdl",
data=soap_xml, data=soap_xml,

View File

@@ -88,6 +88,19 @@ async def consume_ws_get_cove(**kwargs):
cove=cove, cove=cove,
) )
# Enviar documento de request a EFC
try:
file_name_request = f"vu_COVE_{pedimento_app}_{cove}_REQUEST.xml"
document_response = await coves_rest_controller.post_document(
soap_response=soap_xml,
organizacion=kwargs.get('pedimento').get('organizacion'),
pedimento=kwargs.get('pedimento').get('id'),
file_name=file_name_request,
document_type=19,
)
except Exception as e:
logger.error(f"Error al enviar documento request: {e}")
soap_headers = { soap_headers = {
'Content-Type': 'text/xml; charset=utf-8', 'Content-Type': 'text/xml; charset=utf-8',
'SOAPAction': '', 'SOAPAction': '',
@@ -189,6 +202,19 @@ async def consume_ws_get_acuse_cove(**kwargs):
cove=kwargs['cove'].get('cove', None), cove=kwargs['cove'].get('cove', None),
) )
# Enviar documento de request a EFC
try:
file_name_request = f"vu_AC_COVE_{kwargs.get('pedimento', {}).get('pedimento_app', 'N/A')}_{kwargs['cove'].get('cove', 'N/A')}_REQUEST.xml"
document_response = await coves_rest_controller.post_document(
soap_response=soap_xml,
organizacion=kwargs.get('pedimento').get('organizacion'),
pedimento=kwargs.get('pedimento').get('id'),
file_name=file_name_request,
document_type=23,
)
except Exception as e:
logger.error(f"Error al enviar documento request de acuse cove: {e}")
response = await coves_vu_controller.make_request_async( response = await coves_vu_controller.make_request_async(
"ventanilla-acuses-HA/ConsultaAcusesServiceWS?wsdl", "ventanilla-acuses-HA/ConsultaAcusesServiceWS?wsdl",
data=soap_xml, data=soap_xml,

View File

@@ -38,6 +38,28 @@ async def obtener_edoc(**kwargs):
'SOAPAction': 'http://tempuri.org/IServicioEdocument/GetDocumento' 'SOAPAction': 'http://tempuri.org/IServicioEdocument/GetDocumento'
} }
soap_xml = edocs_vu_controller.generate_edocument_template(username=usuario, password=password, idEDocument=numero_documento) soap_xml = edocs_vu_controller.generate_edocument_template(username=usuario, password=password, idEDocument=numero_documento)
# Enviar documento a EFC
try:
pedimento_efc = kwargs.get('pedimento', {})
pedimento_app = pedimento_efc.get('pedimento_app', 'N/A')
organizacion_efc = pedimento_efc.get('organizacion', None)
pedimento_id_efc = pedimento_efc.get("id", None)
file_name_request = f"VU_ED_{pedimento_app}_{numero_documento}_REQUEST.xml"
document_response = await edocs_rest_controller.post_document(
soap_response=soap_xml,
organizacion=organizacion_efc,
pedimento=pedimento_id_efc,
file_name=file_name_request,
document_type=21 # Tipo de documento para request de e-document,
)
except Exception as e:
logger.error(f"Error al enviar documento request: {e}")
response = await edocs_vu_controller.make_request_async( response = await edocs_vu_controller.make_request_async(
"Ventanilla-HA/ServicioEdocument/ServicioEdocument.svc", "Ventanilla-HA/ServicioEdocument/ServicioEdocument.svc",
data=soap_xml, data=soap_xml,

View File

@@ -54,6 +54,21 @@ async def consume_ws_get_partida(**kwargs):
partida=partida.get('numero', '') partida=partida.get('numero', '')
) )
# Enviar documento de request a EFC
try:
file_name_request = f"vu_PT_{pedimento_app}_{partida.get('numero', '')}_REQUEST.xml"
document_response = await partida_rest_controller.post_document(
soap_response=soap_xml,
organizacion=kwargs.get('pedimento').get('organizacion'),
pedimento=kwargs.get('pedimento').get('id'),
file_name=file_name_request,
document_type=17, # Tipo de documento para petición de partidas
)
except Exception as e:
logger.error(f"Error al enviar documento request: {e}")
soap_headers = { soap_headers = {
'Content-Type': 'text/xml; charset=utf-8' 'Content-Type': 'text/xml; charset=utf-8'
} }

View File

@@ -60,6 +60,21 @@ async def obtener_remesa(**kwargs) -> Dict[str, Any]:
numero_operacion=pedimento_data.get('numero_operacion', '') numero_operacion=pedimento_data.get('numero_operacion', '')
) )
# Enviar documento EFC
try:
file_name_request = f"vu_RM_{pedimento_data.get('pedimento_app', 'unknown')}_REQUEST.xml"
document_response = await remesa_rest_controller.post_document(
soap_response=soap_xml,
organizacion=pedimento_data.get('organizacion'),
pedimento=pedimento_data.get('id'),
file_name=file_name_request,
document_type=15,
)
except Exception as e:
logger.error(f"Error al enviar documento de solicitud: {e}")
soap_headers = { soap_headers = {
'Content-Type': 'text/xml; charset=utf-8' 'Content-Type': 'text/xml; charset=utf-8'
} }