Errores
This commit is contained in:
@@ -69,34 +69,18 @@ async def obtener_remesa(**kwargs) -> Dict[str, Any]:
|
||||
data=soap_xml,
|
||||
headers=soap_headers
|
||||
)
|
||||
|
||||
if not soap_response:
|
||||
raise HTTPException(status_code=500, detail="No se recibió respuesta del servicio SOAP")
|
||||
|
||||
if soap_error(soap_response):
|
||||
logger.error(f"Error en respuesta SOAP: {soap_response.text if hasattr(soap_response, 'text') else 'Sin detalles'}")
|
||||
raise HTTPException(status_code=500, detail="Error en la respuesta del servicio SOAP")
|
||||
|
||||
|
||||
# Extraer datos del XML
|
||||
try:
|
||||
remesas_data = remesa_xml_scraper.extract_remesas(soap_response.text)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error al extraer datos XML: {e}")
|
||||
raise HTTPException(status_code=500, detail="Error al procesar respuesta XML")
|
||||
|
||||
# Generar nombre de archivo
|
||||
file_name = f"vu_RM_{pedimento_data.get('pedimento_app', 'unknown')}.xml"
|
||||
|
||||
# Enviar documento
|
||||
try:
|
||||
if soap_error(soap_response):
|
||||
file_name = f"vu_RM_{pedimento_data.get('pedimento_app', 'unknown')}.xml"
|
||||
document_response = await remesa_rest_controller.post_document(
|
||||
soap_response=None,
|
||||
soap_response=soap_response,
|
||||
organizacion=pedimento_data.get('organizacion'),
|
||||
pedimento=pedimento_data.get('id'),
|
||||
file_name=f"vu_RM_{pedimento_data.get('pedimento_app', 'unknown')}_ERROR.xml",
|
||||
file_name=file_name,
|
||||
document_type=10,
|
||||
)
|
||||
raise HTTPException(status_code=500, detail="Error en la respuesta del servicio SOAP")
|
||||
@@ -108,11 +92,20 @@ async def obtener_remesa(**kwargs) -> Dict[str, Any]:
|
||||
file_name=file_name,
|
||||
document_type=3,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error al enviar documento: {e}")
|
||||
raise HTTPException(status_code=500, detail="Error al guardar documento")
|
||||
|
||||
# Extraer datos del XML
|
||||
try:
|
||||
remesas_data = remesa_xml_scraper.extract_remesas(soap_response.text)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error al extraer datos XML: {e}")
|
||||
raise HTTPException(status_code=500, detail="Error al procesar respuesta XML")
|
||||
|
||||
|
||||
logger.info(f"Remesa procesada exitosamente: {pedimento_data.get('pedimento')}")
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user