示例#1
0
        private SecurityResponseBody dummyKinacuImplementation(IMovilwayApiRequest request, SaleInterface kinacuWS, string sessionID)
        {
            string result = "";



            logger.InfoLow("[KIN] " + base.LOG_PREFIX + "[GetSessionProvider] [SEND-DATA] loginParameters {accessId=" + request.AuthenticationData.Username + ",password=******,accessType=" + request.DeviceType + "}");

            int newSessionResponse = kinacuWS.Login(request.AuthenticationData.Username, request.AuthenticationData.Password, request.DeviceType, out result);

            logger.InfoLow("[KIN] " + base.LOG_PREFIX + "[GetSessionProvider] [RECV-DATA] loginResult {response=" + newSessionResponse + ",result=" + result + "}");

            SecurityResponseBody response = new SecurityResponseBody()
            {
                ResponseCode  = newSessionResponse != 0 ? 0 : GetResponseCode(result),
                TransactionID = 0,
                SessionID     = newSessionResponse.ToString()
            };

            if (newSessionResponse == 0)
            {
                response.ResponseMessage = result;
            }


            return(response);
        }
示例#2
0
        public override DataContract.Common.IMovilwayApiResponse PerformKinacuOperation(DataContract.Common.IMovilwayApiRequest requestObject, KinacuWebService.SaleInterface kinacuWS, string sessionID)
        {
            // throw new NotImplementedException();
            ValidateDeviceRequestBody  request  = (ValidateDeviceRequestBody)requestObject;
            ValidateDeviceResponseBody response = new ValidateDeviceResponseBody();

            response.LastVersion = "";

            try
            {
                // int idUser = Utils.GetUserId(request.AuthenticationData.Username, cons.ACCESS_POSWEB);


                GenericApiResult <TrustedDevice> device = Utils.GetDeviceByKey(request.TokenToValidate, requestObject.AuthenticationData.Username);


                if (device.IsObjectValidResult())
                {
                    GenericApiResult <bool> result = Utils.IsActiveDevice(device.ObjectResult); //Utils.ValidateDevice(request.TokenToValidate, idUser);

                    response.IsValid         = result.ObjectResult;
                    response.ResponseCode    = result.ResponseCode;
                    response.ResponseMessage = result.ResponseMessage;//"ERROR INESPERADO";

                    /// SE CAMBIO A A ESTADO SI NO ES ACTIVO Y SI ES TEMPORAL
                    if (!result.ObjectResult && device.ObjectResult.Status == cons.DEVICE_TEMPORAL)
                    {
                        //CAMBIAR A SERVICE EXCUTE DELEGATOR
                        string ERROR = "[NO SE PUDO CAMBIAR ESTADO A DISPOSITIVO TEMPORAL]";
                        try
                        {
                            //SE CAMBIA EL ESTADO BORRANDO
                            device.ObjectResult.Status = cons.DEVICE_DELETE;
                            if (!
                                Utils.SetStatusDevice(device.ObjectResult)//;
                                )
                            {
                                string mensaje = String.Concat("[API] ", base.LOG_PREFIX, "[ValidateDeviceProvider] ", ERROR);
                                logger.InfoLow(mensaje);
                            }
                        }
                        catch (Exception ex)
                        {
                            string mensaje = String.Concat("[API] ", base.LOG_PREFIX, "[ValidateDeviceProvider] ", ERROR, ". Exception: ", ex.Message, ". ", ex.StackTrace);
                            logger.ErrorLow(mensaje);
                            response.ResponseMessage = String.Concat(response.ResponseMessage, " ", ERROR);
                        }
                    }



                    if (device.ObjectResult.IdType != cons.DEVICE_TYPE_WEB)
                    {
                        response.LastVersion = System.Configuration.ConfigurationManager.AppSettings[String.Concat("VERSION_APP_", device.ObjectResult.IdType)] ?? System.Configuration.ConfigurationManager.AppSettings["VERSION_APP"] ?? "0";
                    }
                }
                else
                {
                    // RESPONSE CODE


                    response.ResponseCode    = 100;
                    response.ResponseMessage = device.ResponseMessage; //"ERROR INESPERADO";
                                                                       // response.LastVersion =   System.Configuration.ConfigurationManager.AppSettings["VERSION_APP"] ?? "0";
                }
            }
            catch (Exception ex)
            {
                response.ResponseCode    = 500;
                response.ResponseMessage = ex.Message;//"ERROR INESPERADO";
                response.TransactionID   = 0;

                string mensaje = String.Concat("[API] ", base.LOG_PREFIX, "[ValidateDeviceProvider] ", ". Exception: ", ex.Message, ". ", ex.StackTrace);
                logger.ErrorLow(mensaje);
            }
            return(response);
        }