public GSTNReturnsClient(IGSTNAuthProvider AuthProvider, string pathsuffix, string gstin, string userid, string ret_period, string apicategory) : base(gstin, AuthProvider.credential().code, AuthProvider.credential().Env, "TaxPayer") { this.username = userid.Trim(); this.ret_period = ret_period; provider = AuthProvider; this.SetPathTemplate(provider.PathTemplate(), pathsuffix, apicategory); }
private static void TestGSTR1Get(IGSTNAuthProvider client, string gstin, string userid, string fp) { GSTR1.GSTR1Total model = new GSTR1.GSTR1Total(); GSTR1ApiClient client2 = new GSTR1ApiClient(client, gstin, userid, fp); model = client2.GetSection("B2B", "", "", "").Data; }
private static void TestGSTR1Save(IGSTNAuthProvider auth, string gstin, string userid, string fp, string ctin, string etin) { var filename = "sampledatatp\\gstr1.json"; if (String.IsNullOrEmpty(ctin)) { System.Console.Write("Enter CTIN:"); ctin = System.Console.ReadLine(); } if (String.IsNullOrEmpty(etin)) { System.Console.Write("Enter ETIN:"); etin = System.Console.ReadLine(); } var str1 = File.ReadAllText(filename).Replace("%ctin%", ctin).Replace("%etin%", etin); var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; GSTR1.GSTR1Total model = JsonConvert.DeserializeObject <GSTR1.GSTR1Total>(str1, settings); model.gstin = gstin; model.fp = fp; GSTR1ApiClient client2 = new GSTR1ApiClient(auth, gstin, userid, fp); var str2 = client2.Serialize(model); var info = client2.Save(model); System.Console.WriteLine("Reference_ID: " + info.Data.reference_id); var status = client2.GetStatus(info.Data.reference_id); System.Console.WriteLine(JsonConvert.SerializeObject(status.Data)); }
private static void TestGSTR3(string gstin, string gsp, string userid, string fp) { IGSTNAuthProvider client = GetAuth(gstin, gsp, userid); GSTR3.GSTR3Total model = new GSTR3.GSTR3Total(); GSTR3ApiClient client2 = new GSTR3ApiClient(client, gstin, userid, fp); var info = client2.Generate(fp).Data; model = client2.GetDetails(fp).Data; }
private static void RegisterDSC(string gstin, string gsp, string userid, string pan) { IGSTNAuthProvider client = GetAuth(gstin, gsp, userid); GSTNDSClient client2 = new GSTNDSClient(client, gstin); var cert = DSCUtils.getCertificate(); byte[] data = Encoding.UTF8.GetBytes(pan); var sign = Convert.ToBase64String(DSCUtils.SignCms(data, cert)); var result = client2.RegisterDSC(pan, sign); }
private static void TestGSTR2Get(IGSTNAuthProvider auth, string gstin, string userid, string fp) { GSTR2.GSTR2Total model = new GSTR2.GSTR2Total(); GSTR2ApiClient client2 = new GSTR2ApiClient(auth, gstin, userid, fp); System.Console.Write("Action Required? Y/N/Enter"); string action = System.Console.ReadLine(); model = client2.GetSection("B2B", "", action, "").Data; var model2 = client2.GetSummary().Data; }
private static void RunSave(string[] args) { var gstin = "33GSPTN0192G1ZA"; var userid = "risersoft.tn.2"; var fp = "122018"; var gsp = "GSTN"; IGSTNAuthProvider auth9 = GetAuth(gstin, gsp, userid); TestGSTR1Save2(auth9, gstin, userid, fp, "", ""); auth9.Logout(); }
private static void FileGSTR1WithDSC(string gstin, string gsp, string userid, string fp, string pan) { IGSTNAuthProvider client = GetAuth(gstin, gsp, userid); GSTR1ApiClient client2 = new GSTR1ApiClient(client, gstin, userid, fp); var model2 = client2.GetSummary().Data; var base64PayLoad = Convert.ToBase64String(Encoding.UTF8.GetBytes(client2.dicParams["ResponsePayload"])); var PayLoadHash = Encoding.UTF8.GetBytes(EncryptionUtils.convertByteArrayToString(EncryptionUtils.sha256_hash(base64PayLoad))); var cert = DSCUtils.getCertificate(); var json4 = Convert.ToBase64String(DSCUtils.SignCms(PayLoadHash, cert)); var result4 = client2.File(model2, json4, "DSC", pan); }
private static string TestCSV(string gstin, string gsp, string userid, string fp) { IGSTNAuthProvider client = GetAuth(gstin, gsp, userid); GSTR1.GSTR1Total model = new GSTR1.GSTR1Total(); GSTR1ApiClient client2 = new GSTR1ApiClient(client, gstin, userid, fp); model = client2.GetSection("B2B", "", "Y", "").Data; var client3 = new MxApiClient("http://www.maximprise.com/api/gst"); string str1 = client3.Json2CSV(client2.dicParams["ResponsePayload"], "gstr1", "b2b").Data; return(str1); }
private static void TestGSTR1Save2(IGSTNAuthProvider auth, string gstin, string userid, string fp, string ctin, string etin) { GSTR1.GSTR1Total model = new GSTR1.GSTR1Total(); model.gstin = gstin; model.fp = fp; model.b2cs = new List <GSTR1.B2csOutward> { new GSTR1.B2csOutward { rt = 5, iamt = 100 } }; GSTR1ApiClient client2 = new GSTR1ApiClient(auth, gstin, userid, fp); var str2 = client2.Serialize(model); var info = client2.Save(model); System.Console.WriteLine("Reference_ID: " + info.Data.reference_id); var status = client2.GetStatus(info.Data.reference_id); System.Console.WriteLine(JsonConvert.SerializeObject(status.Data)); }
private static void TestGSTR2Save(string gstin, string gsp, string userid, string fp, string ctin) { IGSTNAuthProvider auth = GetAuth(gstin, gsp, userid); var filename = "sampledatatp\\b2bin.json"; if (String.IsNullOrEmpty(ctin)) { System.Console.Write("Enter CTIN:"); ctin = System.Console.ReadLine(); } var str1 = File.ReadAllText(filename).Replace("%ctin%", ctin); GSTR2.GSTR2Total model = JsonConvert.DeserializeObject <GSTR2.GSTR2Total>(str1); model.gstin = gstin; model.fp = fp; GSTR2ApiClient client2 = new GSTR2ApiClient(auth, gstin, userid, fp); var info = client2.Save(model); System.Console.WriteLine("Reference_ID: " + info.Data.reference_id); var status = client2.GetStatus(info.Data.reference_id); System.Console.WriteLine(JsonConvert.SerializeObject(status.Data)); }
private static void FileGSTR1WithESign(string gstin, string gsp, string userid, string fp, string aadhaarnum, string transactionId, string Otp) { IGSTNAuthProvider client = GetAuth(gstin, gsp, userid); GSTR1ApiClient client2 = new GSTR1ApiClient(client, gstin, userid, fp); var model2 = client2.GetSummary().Data; //https://groups.google.com/forum/#!searchin/gst-suvidha-provider-gsp-discussion-group/authorized|sort:relevance/gst-suvidha-provider-gsp-discussion-group/9-_Mk7LatDs/eQ6_1kHTBAAJ //https://groups.google.com/forum/#!searchin/gst-suvidha-provider-gsp-discussion-group/authorized|sort:relevance/gst-suvidha-provider-gsp-discussion-group/acd-F7XPYz4/7z83KM4IBgAJ var Base64Payload = Convert.ToBase64String(Encoding.UTF8.GetBytes(client2.dicParams["ResponsePayload"])); var Base64Hash = EncryptionUtils.convertByteArrayToString(EncryptionUtils.sha256_hash(Base64Payload)); AuthMetaDetails MetaDetails = new AuthMetaDetails(); MetaDetails.fdc = "NA"; MetaDetails.udc = "NA";//Unique device code. MetaDetails.pip = "NA"; MetaDetails.lot = "P"; MetaDetails.lov = "560103"; MetaDetails.idc = "NA"; var json4 = eSignObj.SignText(aadhaarnum, Otp, transactionId, Base64Hash, MetaDetails); var result4 = client2.File(model2, json4.SignedText, "Esign", aadhaarnum); }
//action_required=“Y|N“ public GSTR2AApiClient(IGSTNAuthProvider provider, string gstin, string userid, string ret_period) : base(provider, "/gstr2a", gstin, userid, ret_period, "GSTR2A") { }
public GSTNDSClient(IGSTNAuthProvider provider, string gstin) : base("/taxpayerapi/v0.2/registerdsc", gstin) { this.provider = provider; }
public GSTNPublicApiClient(IGSTNAuthProvider provider) : base("", provider.credential().code, provider.credential().Env, "PUBLIC") { this.provider = provider; }
public EWBApiClientBase(IGSTNAuthProvider AuthProvider, string gstin) : base(gstin, AuthProvider.credential().code, AuthProvider.credential().Env, "EWB") { this.provider = AuthProvider; dicHeaders = new Dictionary <string, string>(); this.SetPathTemplate(provider.PathTemplate(), "", "EWB"); }
//action_required=“Y|N“ public LedgerApiClient(IGSTNAuthProvider provider, string gstin) : base(provider, "/taxpayerapi/v0.2/returns/ledgers", gstin, "") { }
//action_required=“Y|N“ public LedgerApiClient(IGSTNAuthProvider provider, string gstin, string userid, string ret_period) : base(provider, "/ledgers", gstin, userid, ret_period, "LEDGER") { }
//action_required=“Y|N“ public GSTNReturnsClient(IGSTNAuthProvider AuthProvider, string path, string gstin, string ret_period) : base(path, gstin) { this.ret_period = ret_period; provider = AuthProvider; }
public AspOneEWBApiClient(IGSTNAuthProvider AuthProvider, string gstin) : base(AuthProvider, gstin) { }
public GSTR3ApiClient(IGSTNAuthProvider provider, string gstin, string ret_period) : base(provider, "/taxpayerapi/v0.2/returns/gstr3", gstin, ret_period) { }
//action_required=“Y|N“ public ANX02ApiClient(IGSTNAuthProvider provider, string gstin, string userid, string ret_period) : base(provider, "/anx02", gstin, userid, ret_period, "ANX02") { }
public AspOnePublicApiClient(IGSTNAuthProvider provider) : base(provider) { }
private static void RunConsole(string[] args) { string gstin = "", gsp = "", userid = "", fp = "", filename = "", ctin = "", etin = ""; if ((args != null) && (args.Count() > 0) && (System.IO.File.Exists(args[0]))) { filename = args[0]; } else { System.Console.Write("Enter input filename [Press Enter for None]:"); filename = System.Console.ReadLine(); } if (!String.IsNullOrEmpty(filename) && (System.IO.File.Exists(filename))) { var fileContents = File.ReadAllText(filename); string[] arr = Microsoft.VisualBasic.Strings.Split(fileContents, Microsoft.VisualBasic.Constants.vbCrLf); gsp = arr[0]; userid = arr[1]; gstin = arr[2]; fp = arr[3]; ctin = arr[4]; etin = arr[5]; } else { System.Console.Write("Enter GSP:"); gsp = System.Console.ReadLine(); System.Console.Write("Enter UserID:"); userid = System.Console.ReadLine(); System.Console.Write("Enter GSTIN:"); gstin = System.Console.ReadLine(); System.Console.Write("Enter FP:"); fp = System.Console.ReadLine(); System.Console.Write("Enter CTIN:"); ctin = System.Console.ReadLine(); System.Console.Write("Enter ETIN:"); etin = System.Console.ReadLine(); } System.Console.WriteLine("1=GSTR1 Get, 2=GSTR2 Get, 3=GSTR3 Get, 4=Ledger, " + "5=File with eSign, 6=CSV conversion, 7=PGP, 8=File With DSC, " + "9=GSTR1 Save, 10=GSTR2 Save, 11=GSTR3 Save, 12=Refresh Token, 13=Register DSC, " + "14=Search, 15= EWB, 16=TOKEN"); string selection = System.Console.ReadLine(); switch (selection) { case "1": IGSTNAuthProvider auth1 = GetAuth(gstin, gsp, userid); TestGSTR1Get(auth1, gstin, userid, fp); auth1.Logout(); break; case "2": IGSTNAuthProvider auth2 = GetAuth(gstin, gsp, userid); TestGSTR2Get(auth2, gstin, userid, fp); auth2.Logout(); break; case "3": TestGSTR3(gstin, gsp, userid, fp); break; case "4": TestLedger(gstin, gsp, userid, fp, "19-08-2016", "20-09-2016"); break; case "5": System.Console.Write("Enter path to license file:"); string path = System.Console.ReadLine(); System.Console.Write("Enter your Aadhar Num:"); string aadhaarnum = System.Console.ReadLine(); string transactionid = GetUIDAIOtp(path, aadhaarnum); System.Console.Write("Enter OTP:"); string otp = System.Console.ReadLine(); FileGSTR1WithESign(gstin, gsp, userid, fp, aadhaarnum, transactionid, otp); break; case "6": TestCSV(gstin, gsp, userid, fp); break; case "7": TestPGP("the quick brown fox jumped over the lazy dog"); break; case "8": System.Console.Write("Enter your PAN:"); string pan = System.Console.ReadLine(); FileGSTR1WithDSC(gstin, gsp, userid, fp, pan); break; case "9": IGSTNAuthProvider auth9 = GetAuth(gstin, gsp, userid); TestGSTR1Save(auth9, gstin, userid, fp, ctin, etin); auth9.Logout(); break; case "10": TestGSTR2Save(gstin, gsp, userid, fp, ctin); break; case "12": IGSTNAuthProvider auth12 = GetAuth(gstin, gsp, userid); auth12.RefreshToken(); break; case "13": System.Console.Write("Enter your PAN:"); string pan2 = System.Console.ReadLine(); RegisterDSC(gstin, gsp, userid, pan2); break; case "14": SearchGSTIN(gstin, gsp, "PROD"); break; case "15": TestEWBAspOne(gstin, userid); break; case "16": TestEWBTokenKpmg(gstin, userid); break; } System.Console.WriteLine("Press any key to end this program"); System.Console.ReadKey(false); }
public KpmgEWBApiClient(IGSTNAuthProvider AuthProvider, string gstin) : base(AuthProvider, gstin) { string template = "/test/ewb"; if (myUtils.IsInList(this.credential.Env, "prod")) template = "/ewb"; this.SetPathTemplate(template, "/ewayapi", "EWB"); }
private static void TestLedger(string gstin, string gsp, string userid, string fp, string fr_dt, string to_dt) { IGSTNAuthProvider client = GetAuth(gstin, gsp, userid); LedgerApiClient client2 = new LedgerApiClient(client, gstin, userid, fp); var info = client2.GetCashDtl(fr_dt, to_dt).Data; }
//action_required=“Y|N“ public ITC4ApiClient(IGSTNAuthProvider provider, string gstin, string userid, string ret_period) : base(provider, "/itc04", gstin, userid, ret_period, "ITC04") { }
public GSTNDSClient(IGSTNAuthProvider provider, string gstin) : base(gstin, provider.credential().code, provider.credential().Env, "TaxPayer") { this.provider = provider; this.SetPathTemplate(provider.PathTemplate(), "/registerdsc", "DSC"); }