Ejemplo n.º 1
0
        public string Topup(string UserID, string voucher, string pin)
        {
            try
            {
                string soapObj = "";
                MethodName = "refillaccountwithrcv";
                var CustomerID = UserID;

                HttpWebRequest request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName, voucher, pin);
                request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName, voucher, pin);
                //var val = ChekMyIP();
                using (WebResponse response = request.GetResponse())
                {
                    using (StreamReader rd = new StreamReader(response.GetResponseStream()))
                    {
                        soapResult = rd.ReadToEnd();
                        soapResult = soapResult.Replace(@"\", "");
                        var    soapResults = soapResult.Substring(1);
                        string sp          = soapResults.Substring(0, soapResults.Length - 1);
                        // JArray jObj = JArray.Parse(sp);
                        dynamic jObj = JObject.Parse(sp);
                        // ViewBag.Data = jObj.ToList();
                        soapObj = jObj?.soapenvBody?.ns1processResponse?.processReturn?.errorCode;
                    }
                }
                return(soapObj);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Ejemplo n.º 2
0
        public string ChangePlan(string UserID, string plan)
        {
            try
            {
                //453
                MethodName = plan;
                var            CustomerID = UserID;
                var            responses  = "";
                HttpWebRequest request    = Internetserviceprovider.CreateWebReq(CustomerID, MethodName);
                request = Internetserviceprovider.CreateWebReq(CustomerID, MethodName);
                //var val = ChekMyIP();
                using (WebResponse response = request.GetResponse())
                {
                    using (StreamReader rd = new StreamReader(response.GetResponseStream()))
                    {
                        soapResult = rd.ReadToEnd();
                        soapResult = soapResult.Replace(@"\", "");
                        var    soapResults = soapResult.Substring(1);
                        string sp          = soapResults.Substring(0, soapResults.Length - 1);
                        //JArray jObj = JArray.Parse(sp);
                        var jObj = JObject.Parse(sp);
                        responses = jObj.ToString();
                    }
                }


                return(responses);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Ejemplo n.º 3
0
        public ActionResult Buy()
        {
            try
            {
                string Biller = "6";
                TempData["message"]    = LoadImage(Biller);
                TempData["BillerName"] = getDiscoName(Biller);

                Internetserviceprovider.InternetServiceObj cusdataobj =
                    new Internetserviceprovider.InternetServiceObj();
                cusdataobj = (Internetserviceprovider.InternetServiceObj)TempData["cusdataobj"];
                MethodName = "planchangelist";
                var CustomerID = cusdataobj.CustomerID;

                HttpWebRequest request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName);
                request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName);
                //var val = ChekMyIP();
                using (WebResponse response = request.GetResponse())
                {
                    using (StreamReader rd = new StreamReader(response.GetResponseStream()))
                    {
                        soapResult = rd.ReadToEnd();
                        soapResult = soapResult.Replace(@"\", "");
                        var    soapResults = soapResult.Substring(1);
                        string sp          = soapResults.Substring(0, soapResults.Length - 1);
                        JArray jObj        = JArray.Parse(sp);
                        ViewBag.Data = jObj.ToList();

                        // var value = jObj[0];
                    }
                }

                //SoapResult = SoapResult.Replace(@"\", "");
                //JArray jObj = JArray.Parse(SoapResult);
                //ViewBag.Data = jObj;
                return(View(cusdataobj));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Ejemplo n.º 4
0
        public string ValidatePayRequest(string CustomerID)
        {
            try
            {
                dynamic AgentObj = new JObject();
                AgentObj.CustomerID = CustomerID;

                Internetserviceprovider.InternetServiceObj cusdataobj =
                    new Internetserviceprovider.InternetServiceObj();
                string soapResult = "";
                var    Resp       = "";
                string MethodName = "";
                MethodName = ConfigurationManager.AppSettings["Fetchuser"];
                // var CustomerID = AgentObj.CustomerID;

                Internetserviceprovider.CustomerObj ispObject = new Internetserviceprovider.CustomerObj();
                //Customer Validation
                if (string.IsNullOrEmpty(CustomerID))
                {
                    soapResult =
                        new JObject(
                            new JProperty("status", "error"),
                            new JProperty("message", "Empty CustomerID"),
                            new JProperty("data", new JObject(soapResult))).ToString();
                    //return Json(soapResult);
                    return(soapResult.ToString());
                }

                var    req       = Request;
                var    headers   = req.Headers;
                string myAgentID = "";
                try
                {
                    myAgentID = headers.GetValues("agentID").First() ?? "";
                }
                catch
                {
                    WebLog.Log("Cannot Read AgentID as header");
                }

                var agentID   = headers.GetValues("agentID").First() ?? "";
                var agentKey  = headers.GetValues("agentKey").First() ?? "";
                var signature = headers.GetValues("signature").First() ?? "";

                AgentObj.AgentID   = agentID;
                AgentObj.AgentKey  = agentKey;
                AgentObj.Signature = signature;
                var Authenticated = IsTransactionAutheticated(AgentObj);

                if (Authenticated == false)
                {
                    soapResult =
                        new JObject(
                            new JProperty("status", "Error"),
                            new JProperty("message", "Authentication Failed"),
                            new JProperty("data", new JObject())).ToString();
                    // return Json(soapResult);
                    return(soapResult.ToString());
                }
                //var CustomerID = ispObject.CustomerID;
                Internetserviceprovider intnets = new Internetserviceprovider();
                HttpWebRequest          request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName);
                request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName);
                //var val = ChekMyIP();
                using (WebResponse response = request.GetResponse())
                {
                    using (StreamReader rd = new StreamReader(response.GetResponseStream()))
                    {
                        soapResult = rd.ReadToEnd();
                        soapResult = soapResult.Replace(@"\", "");
                        var soapResults = soapResult.Substring(1);
                    }
                }
                if (soapResult == null)
                {
                    //return Json(soapResult);
                    return(soapResult.ToString());
                }
                if (soapResult != null)
                {
                    // return Json(soapResult);
                    return(soapResult.ToString());
                }
                // return Json(soapResult);
                return(soapResult.ToString());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex);
                var obj =
                    new JObject(
                        new JProperty("status", "error"),
                        new JProperty("message", $"{ex.Message}"),
                        new JProperty("data", new JObject()));
                //return Json(obj);
                return(obj.ToString());
            }
        }
Ejemplo n.º 5
0
        public ActionResult Check(FormCollection form)
        {
            try
            {
                Internetserviceprovider.InternetServiceObj cusdataobj =
                    new Internetserviceprovider.InternetServiceObj();
                string soapResult = "";

                MethodName = ConfigurationManager.AppSettings["Fetchuser"];
                var CustomerID = Convert.ToString(form["CustomerId"]);
                Internetserviceprovider.CustomerObj ispObject = new Internetserviceprovider.CustomerObj();

                //var CustomerID = ispObject.CustomerID;
                Internetserviceprovider intnets = new Internetserviceprovider();
                HttpWebRequest          request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName);
                request = Internetserviceprovider.CreateWebRequest(CustomerID, MethodName);
                //var val = ChekMyIP();
                using (WebResponse response = request.GetResponse())
                {
                    using (StreamReader rd = new StreamReader(response.GetResponseStream()))
                    {
                        soapResult = rd.ReadToEnd();
                        soapResult = soapResult.Replace(@"\", "");
                        var soapResults =
                            soapResult.Substring(1);

                        string sp = soapResults.Substring(0, soapResults.Length - 1);
                        // JArray jObj = JArray.Parse(sp);


                        // var value = jObj[0];
                        // soapResult = soapResult.Replace(@"\", "");
                        dynamic jobj = JObject.Parse(sp);
                        if (jobj != null && $"{jobj?.soapenvBody?.ns1processResponse?.processReturn?.errorCode}".ToLower() == "0")
                        {
                            var soapObj   = jobj?.soapenvBody?.ns1processResponse?.processReturn?.keyParam?.keyParam;
                            var lastname  = "";
                            var firstname = "";
                            foreach (var item in soapObj)
                            {
                                var keys = item.key;
                                //if(keys == "lastTotalTime")
                                //{
                                //    var keyvalue = item.value;
                                //}
                                if (keys == "userName")
                                {
                                    cusdataobj.userName = item.value;
                                    var value = item.value;
                                }
                                if (keys == "lastName")
                                {
                                    lastname = item.value;
                                    //var value = item.value;
                                }
                                if (keys == "email")
                                {
                                    cusdataobj.Email = item.value;
                                    var value = item.value;
                                }
                                if (keys == "userId")
                                {
                                    cusdataobj.CustomerID = item.value;
                                }
                                if (keys == "firstName")
                                {
                                    firstname = item.value;
                                    //var value = item.value;
                                }
                                cusdataobj.customerName = firstname + lastname;
                                TempData["cusdataobj"]  = cusdataobj;

                                //return RedirectToAction("");
                            }
                            return(RedirectToAction("Buy"));
                        }
                        else if (jobj == null)
                        {
                            TempData["message"] = "Please Try Again";
                            return(RedirectToAction("Check"));
                        }
                        else if (jobj != null && $"{jobj?.soapenvBody?.ns1processResponse?.processReturn?.errorCode}".ToLower() == "-103")
                        {
                            TempData["Msg"] = $"{jobj?.soapenvBody?.ns1processResponse?.processReturn?.errorMessage}".ToLower();
                            return(RedirectToAction("Check"));
                        }
                    }
                }


                return(View());
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }