Example #1
0
        private async void btnDecGenEwbByIRN_Click(object sender, EventArgs e)
        {
            //string strJson = File.ReadAllText(WorkingFilesPath + @"\SampleJsonGenEwbByIRN.txt");

            ReqPlGenEwbByIRN reqPlGenEwbByIRN = new ReqPlGenEwbByIRN();

            reqPlGenEwbByIRN.Irn        = "cc47964d094e5efa9813ca1f5d1822a67e55995c5800f979598dac8669ab5d51";
            reqPlGenEwbByIRN.TransId    = "27AACFM5833D1ZH";//12AWGPV7107B1Z1
            reqPlGenEwbByIRN.TransMode  = "1";
            reqPlGenEwbByIRN.TransDocNo = "DOC113";
            reqPlGenEwbByIRN.TransDocDt = "21/09/2020"; //
            reqPlGenEwbByIRN.VehNo      = "ka123458";   //
            reqPlGenEwbByIRN.Distance   = 100;
            reqPlGenEwbByIRN.VehType    = "R";          //R
            reqPlGenEwbByIRN.TransName  = "DFHGF";

            // RestClient client = new RestClient("https://api.taxprogsp.co.in/eiewb/dec/v1.03/ewaybill?aspid=************&password=************&Gstin=************&AuthToken=sxvB4Ocu1kikcSuu4dwDE75RN&user_name=************");
            RestClient client = new RestClient("https://api.taxprogsp.co.in/eiewb/dec/v1.03/ewaybill?aspid=************&password=************&Gstin=************&AuthToken=jSNGkXqh8RshEAf91CAFMMdcp&user_name=************");

            //RestClient client = new RestClient("http://testapi.taxprogsp.co.in/eiewb/dec/v1.03/ewaybill?aspid=************&password=************&Gstin=************&AuthToken=7wTMc7VccewQSqraD46qz2lCd&user_name=************");
            RestRequest request = new RestRequest(Method.POST);

            //request.AddHeader("Gstin", "************");
            //request.AddHeader("user_name", "************");
            request.AddHeader("Gstin", "************");
            request.AddHeader("user_name", "************");
            request.AddHeader("AuthToken", "jSNGkXqh8RshEAf91CAFMMdcp");
            request.AddHeader("aspid", "************");
            request.AddHeader("password", "************");
            request.AddHeader("Content-Type", "application/json; charset=utf-8");
            request.RequestFormat = DataFormat.Json;
            //ReqPlGenIRN reqPlGenIRN = new ReqPlGenIRN();
            //reqPlGenIRN = JsonConvert.DeserializeObject<ReqPlGenIRN>(strJson);
            //request.AddBody(reqPlGenIRN);
            string jsonStr = JsonConvert.SerializeObject(reqPlGenEwbByIRN);

            request.AddBody(reqPlGenEwbByIRN);
            IRestResponse response = await client.ExecuteTaskAsync(request);



            RespPl respPl = new RespPl();

            respPl = JsonConvert.DeserializeObject <RespPl>(response.Content);

            RespPlGenEwbByIRN resp = new RespPlGenEwbByIRN();

            resp = JsonConvert.DeserializeObject <RespPlGenEwbByIRN>(respPl.Data.Replace("\"{", "{").Replace("}\"", "}").Replace("\\\"", "\""));

            rtbResponce.Text = JsonConvert.SerializeObject(resp);
        }
Example #2
0
        private async void btnDecGenIRN_Click(object sender, EventArgs e)
        {
            //string strJson = File.ReadAllText(WorkingFilesPath + @"\SandBoxSampleJsonGenIRN.txt");
            string     strJson = File.ReadAllText(WorkingFilesPath + @"\ProductionSampleJsonGenIRN.txt");
            RestClient client  = new RestClient("https://api.taxprogsp.co.in/eicore/dec/v1.03/Invoice?aspid=************&password=************&Gstin=************&AuthToken=jSNGkXqh8RshEAf91CAFMMdcp&user_name=************&QrCodeSize=250");
            //RestClient client = new RestClient("http://testapi.taxprogsp.co.in/eicore/dec/v1.03/Invoice?aspid=************&password=************&Gstin=************&AuthToken=7wTMc7VccewQSqraD46qz2lCd&user_name=************&QrCodeSize=150");

            RestRequest request = new RestRequest(Method.POST);

            request.AddHeader("Gstin", "************");
            request.AddHeader("user_name", "************");

            //request.AddHeader("Gstin", "************");
            //request.AddHeader("user_name", "************");
            request.AddHeader("AuthToken", "jSNGkXqh8RshEAf91CAFMMdcp");
            request.AddHeader("aspid", "************");
            request.AddHeader("password", "************");
            request.AddHeader("Content-Type", "application/json; charset=utf-8");
            request.RequestFormat = DataFormat.Json;
            //ReqPlGenIRN reqPlGenIRN = new ReqPlGenIRN();
            //reqPlGenIRN = JsonConvert.DeserializeObject<ReqPlGenIRN>(strJson);
            //request.AddBody(reqPlGenIRN);
            request.AddParameter("application/json", strJson, ParameterType.RequestBody);
            IRestResponse response = await client.ExecuteTaskAsync(request);

            RespPl respPl = new RespPl();

            respPl = JsonConvert.DeserializeObject <RespPl>(response.Content);

            RespPlGenIRNDec respPlGenIRNDec = new RespPlGenIRNDec();

            respPlGenIRNDec  = JsonConvert.DeserializeObject <RespPlGenIRNDec>(respPl.Data);
            rtbResponce.Text = respPlGenIRNDec.Irn;

            byte[]        qrImg   = Convert.FromBase64String(respPlGenIRNDec.QrCodeImage);
            TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Bitmap));
            Bitmap        bitmap1 = (Bitmap)tc.ConvertFrom(qrImg);


            bitmap1.Save(WorkingFilesPath + @"\qr.png");
        }
Example #3
0
        private async void btnGetEinvDetailByDec_Click(object sender, EventArgs e)
        {
            RestClient  client  = new RestClient("http://testapi.taxprogsp.co.in/gstcore/dec/v1.01/Invoice/irn/b27676323d37f357c02495580677d434be958a77870b7b5636d6d551c479818b?aspid=******&password=******&Gstin=************&AuthToken=fBM4dCRuLSrMI8SwyR1kYm0Mc&user_name=************");
            RestRequest request = new RestRequest(Method.GET);

            request.AddHeader("Gstin", "************");
            request.AddHeader("user_name", "************");
            request.AddHeader("AuthToken", "fBM4dCRuLSrMI8SwyR1kYm0Mc");
            request.AddHeader("aspid", "******");
            request.AddHeader("password", "*******");
            request.AddHeader("Content-Type", "application/json; charset=utf-8");
            request.RequestFormat = DataFormat.Json;
            IRestResponse response = await client.ExecuteTaskAsync(request);

            RespPl respPl = new RespPl();

            respPl = JsonConvert.DeserializeObject <RespPl>(response.Content);

            RespPlGenIRNDec respPlGenIRNDec = new RespPlGenIRNDec();

            respPlGenIRNDec  = JsonConvert.DeserializeObject <RespPlGenIRNDec>(respPl.Data);
            rtbResponce.Text = JsonConvert.SerializeObject(respPlGenIRNDec);
        }