This commit is contained in:
2025-10-05 17:33:54 -06:00
parent cf181023bd
commit 8b151a6fe9
4 changed files with 57 additions and 70 deletions

View File

@@ -74,6 +74,13 @@ async def consume_ws_get_pedimento_completo(**kwargs) -> Dict[str, Any]:
if soap_error(soap_response):
logger.error(f"Error en respuesta SOAP: {soap_response.text if hasattr(soap_response, 'text') else 'Sin detalles'}")
document_response = await pedimento_rest_controller.post_document(
soap_response=None,
organizacion=pedimento_data.get('organizacion'),
pedimento=pedimento_data.get('id'),
file_name=f"vu_PC_{pedimento_data.get('pedimento_app', 'unknown')}_ERROR.xml",
document_type=10,
)
raise HTTPException(status_code=500, detail="Error en la respuesta del servicio SOAP")
# Extraer datos del XML
@@ -88,23 +95,13 @@ async def consume_ws_get_pedimento_completo(**kwargs) -> Dict[str, Any]:
# Enviar documento
try:
if soap_error(soap_response):
document_response = await pedimento_rest_controller.post_document(
soap_response=None,
organizacion=pedimento_data.get('organizacion'),
pedimento=pedimento_data.get('id'),
file_name=f"vu_PC_{pedimento_data.get('pedimento_app', 'unknown')}_ERROR.xml",
document_type=10,
)
raise HTTPException(status_code=500, detail="Error en la respuesta del servicio SOAP")
else:
document_response = await pedimento_rest_controller.post_document(
soap_response=soap_response,
organizacion=pedimento_data.get('organizacion'),
pedimento=pedimento_data.get('id'),
file_name=file_name,
document_type=2,
)
document_response = await pedimento_rest_controller.post_document(
soap_response=soap_response,
organizacion=pedimento_data.get('organizacion'),
pedimento=pedimento_data.get('id'),
file_name=file_name,
document_type=2,
)
except Exception as e:
logger.error(f"Error al enviar documento: {e}")
raise HTTPException(status_code=500, detail="Error al guardar documento")