public string GetText()
        {
            // var str = "4cdf7b17b7db00d7911498dec913d3e4 1e55c4e950b772685ccfdb831c82fede SCQXvM7GeKxP0jLtX5xbuF0WvBC/C81wwxtYNduUe9lVzaYztaJ8ifivjaCBWd7O2zSa+/A+vtFfdSWSnN5+RcjWka42QQl4f+yZ8C1Y/efIsUlDVXBXmSEjSUp/4sflXNz7qg62Ka+atpj0aiG6QvU+T5tnafmsDhx/M3zE+Tg=";

            RequestClass obj = new RequestClass();

            obj.flag          = "RECH";
            obj.etcCustId     = "";
            obj.vrn           = "KT01AA1152";
            obj.rechargeTxnid = "KARN000000000093674";
            obj.rechargeAmt   = "500.00";

            string json             = JsonConvert.SerializeObject(obj);
            var    encryptedMessage = encryptMessage(json);
            var    decrypMessage    = decryptMessage(encryptedMessage);



            return(decrypMessage);
        }
Example #2
0
        //public string GetData()
        //{


        //        var URL = 'some url';
        //        var json = new StringBuilder();

        //        json.Append("\"flag\": \"" + "RECH" + "\",");
        //        json.Append("\"vrn\": \"KA19\",");
        //        json.Append("\"rechargeTxnid\": \"1234\",");
        //        json.Append("\"rechargeAmt\": \"200.00\"");
        //        var data = new StringContent(json.ToString(), Encoding.UTF8, "application/json");
        //        var client = new HttpClient();
        //        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        //        try
        //        {
        //            var response = await client.PostAsJsonAsync(URL, data);
        //            string result = response.Content.ReadAsStringAsync().Result;
        //            return result;
        //        }
        //        catch (Exception e)
        //        {

        //            return "Exception" + e.Message;
        //        }

        //    }


        public void GetData()
        {
            try
            {
                string ContactUs         = "https://125.19.66.195/kbxwnetc/RechargeCustomerAccount";
                string MyProxyHostString = "172.16.240.153";
                int    MyProxyPort       = 8080;
                var    request           = (HttpWebRequest)WebRequest.Create(ContactUs);
                request.Proxy       = new WebProxy(MyProxyHostString, MyProxyPort);
                request.Method      = "POST";
                request.ContentType = "application/json";
                request.Accept      = "application/json";

                RequestClass obj = new RequestClass();

                obj.flag          = "RECH";
                obj.etcCustId     = "";
                obj.vrn           = "KA19";
                obj.rechargeTxnid = "1234";
                obj.rechargeAmt   = "120.00";

                string       json          = JsonConvert.SerializeObject(obj);
                StreamWriter requestWriter = new StreamWriter(request.GetRequestStream());
                requestWriter.Write(json);
                requestWriter.Close();
                StreamReader responseReader = new StreamReader(request.GetResponse().GetResponseStream());
                string       responseData   = responseReader.ReadToEnd();
                responseReader.Close();
                request.GetResponse().Close();
                return("");
            }
            catch (Exception e)
            {
                var k = e.Message;
            }
        }
        public async Task <String> GetDetails()
        {
            string ContactUs         = "https://125.19.66.195/kbxwnetc/RechargeCustomerAccount";
            string MyProxyHostString = "172.16.240.153";
            int    MyProxyPort       = 8080;

            //Bypass SSL Verification
            ServicePointManager.ServerCertificateValidationCallback +=
                delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return(true); };

            var request = (HttpWebRequest)WebRequest.Create(ContactUs);

            request.Proxy       = new WebProxy(MyProxyHostString, MyProxyPort);
            request.Method      = "POST";
            request.ContentType = "application/json";
            request.Accept      = "application/json";

            RequestClass obj = new RequestClass();

            obj.flag          = "RECH";
            obj.etcCustId     = "";
            obj.vrn           = "KA19";
            obj.rechargeTxnid = "1234";
            obj.rechargeAmt   = "120.00";

            string json   = JsonConvert.SerializeObject(obj);
            var    client = new HttpClient();

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            var response = await client.PostAsJsonAsync(ContactUs, obj);

            string result = response.Content.ReadAsStringAsync().Result;

            return(null);
        }