private void ValidateOTP(HttpContext context) { JObject validateObj = new JObject(); string txnID = context.Request.Headers["TxnID"]; if (context.Request["Otp"] == null || context.Request["MobileNumber"] == null) { validateObj = new JObject(new JProperty("Success", false), new JProperty("Message", "Unable to read OTP/MobileNumber")); context.Response.Write(validateObj); return; } try { string mobile = context.Request["MobileNumber"].ToString(); Login_V120 loginObj = new Login_V120(); validateObj = loginObj.ValidateOTP(MyConf.MyConnectionString, mobile, context.Request["Otp"].ToString(), txnID); } catch (Exception ex) { Logger.ExceptionLog("Exception in Appservice_v2 is " + ex.ToString()); } context.Response.Write(validateObj); //Logger.TraceLog("ValidateOTP response " + validateObj); HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(validateObj.ToString())); //RMQClient.enQueueApiStat(); }
public void OtpCall(HttpContext context) { JObject responseObj = new JObject(); context.Request.InputStream.Position = 0; StreamReader _IS = new StreamReader(context.Request.InputStream); string _Payload = _IS.ReadToEnd(); JObject _ParamObj = JObject.Parse(_Payload); if (_ParamObj.SelectToken("MobileNumber") == null) { responseObj = new JObject(new JProperty("Success", false), new JProperty("Message", "Unable to read MobileNumber")); context.Response.Write(responseObj); return; } try { Login_V120 loginObj = new Login_V120(); responseObj = loginObj.OtpCall(MyConf.MyConnectionString, _ParamObj.SelectToken("MobileNumber").ToString()); } catch (Exception ex) { responseObj = new JObject(new JProperty("Success", false), new JProperty("Message", ex.ToString())); context.Response.Write(responseObj); } context.Response.Write(responseObj); //Logger.TraceLog("OtpCall response " + responseObj); HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(responseObj.ToString())); //RMQClient.enQueueApiStat(); }
public void Registration(HttpContext context) { JObject paramObj = new JObject(); JObject registrationReq = new JObject(); HttpContext.Current.Request.InputStream.Position = 0; StreamReader _IS = new StreamReader(HttpContext.Current.Request.InputStream); string payload = _IS.ReadToEnd(); Boolean isResend = false; try { try { paramObj = JObject.Parse(payload); } catch (Exception ex) { Logger.ExceptionLog(ex.StackTrace); context.Response.Write("Invalid Request"); context.Response.End(); } string txnID = context.Request.Headers["TxnID"]; string clientIpAddress = helperObj.ClientIpAddress; if (context.Request["IsResend"] != null) { isResend = true; } if (paramObj.SelectToken("MobileNumber").ToString().Replace(" ", "").StartsWith("+1")) { countryID = 241; } else if (paramObj.SelectToken("MobileNumber").ToString().Replace(" ", "").StartsWith("+971")) { countryID = 239; } else if (paramObj.SelectToken("MobileNumber").ToString().Replace(" ", "").StartsWith("+973")) { countryID = 19; } else { countryID = 108; } Login_V120 loginObj = new Login_V120(); registrationReq = loginObj.Registration(MyConf.MyConnectionString, paramObj, clientIpAddress, txnID, isResend, countryID); } catch (Exception ex) { Logger.ExceptionLog("Exception in Appservice_v2 is " + ex.ToString()); //Logger.TraceLog(ex.ToString()); } context.Response.Write(registrationReq); //Logger.TraceLog("Registration response " + registrationReq); HttpContext.Current.Items.Add("OutBytes", System.Text.Encoding.UTF8.GetByteCount(registrationReq.ToString())); //RMQClient.enQueueApiStat(); }