Example #1
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 #2
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);
        }