public IHttpActionResult CustodyRequestFromPlatform() { try { // Parameters sent by platform (GET) var request = Request; string ani = functions.GetQueryString(request, "ani"); string text = functions.GetQueryString(request, "text"); string nc = functions.GetQueryString(request, "nc"); string op = functions.GetQueryString(request, "op"); string id = functions.GetQueryString(request, "id"); string cfield1 = functions.GetQueryString(request, "cfield1"); string lista = functions.GetQueryString(request, "lista"); string campEnvio1 = functions.GetQueryString(request, "campEnvio1"); string campEnvio2 = functions.GetQueryString(request, "campEnvio2"); string campCobro = functions.GetQueryString(request, "campCobro"); // Custom params string idProduct = functions.GetQueryString(request, "idProduct"); string value = functions.GetQueryString(request, "value"); // value to be stored // Check for vital data if (idProduct == null || ani == null || value == null) { throw new NotEnoughAttributesException("No se han recibido todos los parámetros requeridos"); } // Create object to send it to business layer and process it CustodyRequest req = new CustodyRequest(); req.idProduct = (int)Int32.Parse(idProduct); req.value = value; req.valChannel = ani; req.sendSms = true; // Business's logic controllers, core CustodyController core = new CustodyController(); ActionResponse action = core.CustodyRequestFromPlatformAction(req.idProduct.Value, ani, value); if (action.code == (int)CodeStatusEnum.OK) { return(ResponseOk(action.data)); } // OK else { return(ResponseError(action.code, action.message)); } // NOK } catch (NotValidDataException e) { logger.Error(e.Message); return(ResponseError((int)CodeStatusEnum.BAD_REQUEST, e.Message)); } catch (NotEnoughAttributesException e) { logger.Error(e.Message); return(ResponseError((int)CodeStatusEnum.BAD_REQUEST, e.Message)); } catch (Exception ex) { logger.Error(ex.Message); return(ResponseError((int)CodeStatusEnum.INTERNAL_ERROR, "Error desconocido en el sistema")); } }