Esempio n. 1
0
        static void Main(string[] args)
        {
            string gstin = "", fp = "", filename = "", ctin = "", etin = "";

            if ((args != null) && (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          = Strings.Split(fileContents, Constants.vbCrLf);
                GSTNConstants.client_id     = arr[0];
                GSTNConstants.client_secret = arr[1];
                GSTNConstants.userid        = arr[2];
                gstin = arr[3];
                fp    = arr[4];
                ctin  = arr[5];
                etin  = arr[6];
            }
            else
            {
                System.Console.Write("Enter ClientId:");
                GSTNConstants.client_id = System.Console.ReadLine();

                System.Console.Write("Enter Client Secret:");
                GSTNConstants.client_secret = System.Console.ReadLine();

                System.Console.Write("Enter UserID:");
                GSTNConstants.userid = System.Console.ReadLine();

                System.Console.Write("Enter GSTIN:");
                gstin = System.Console.ReadLine();

                System.Console.Write("Enter FP:");
                fp = System.Console.ReadLine();
            }

            try
            {
                GSTNConstants.publicip = new WebClient().DownloadString("http://ipinfo.io/ip").Trim();
            }
            catch
            {
                GSTNConstants.publicip = "11.10.1.1";
            }


            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");
            string selection = System.Console.ReadLine();

            switch (selection)
            {
            case "1":
                TestGSTR1Get(gstin, fp);
                break;

            case "2":
                TestGSTR2Get(gstin, fp);
                break;

            case "3":
                TestGSTR3(gstin, fp);
                break;

            case "4":
                TestLedger(gstin, "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, fp, aadhaarnum, transactionid, otp);
                break;

            case "6":
                TestCSV(gstin, 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, fp, pan);
                break;

            case "9":
                TestGSTR1Save(gstin, fp, ctin, etin);
                break;

            case "10":
                TestGSTR2Save(gstin, fp, ctin);
                break;

            case "12":
                GSTNAuthClient client = GetAuth(gstin);
                client.RefreshToken();
                break;

            case "13":
                System.Console.Write("Enter your PAN:");
                string pan2 = System.Console.ReadLine();
                RegisterDSC(gstin, pan2);
                break;
            }

            System.Console.WriteLine("Press any key to end this program");
            System.Console.ReadKey(false);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string gstin = "33GSPTN0231G1ZM", userid = "balaji.tn.1", fp = "062018", filename = "", ctin = "27GSPMH0231G1ZZ", etin = "33GSPTN0231G1ZM";

            //07AABCB4635N1ZI----27AABCB4635N1ZG
            if ((args != null) && (System.IO.File.Exists(args[0])))
            {
                filename = args[0];
            }
            else
            {
                // System.Console.Write("Enter input filename [Press Enter for None]:");
                //filename = System.Console.ReadLine();
            }

            GSTNConstants.client_id     = "l7xx5edefdd923ad438eb5b332a73269f812";// arr[0];
            GSTNConstants.client_secret = "383dc1f4835f43ad80f80f6cf284cd7b";
            if (!String.IsNullOrEmpty(filename) && (System.IO.File.Exists(filename)))
            {
                // var fileContents = File.ReadAllText(filename);
                //string[] arr = Strings.Split(fileContents, Constants.vbCrLf);
                // GSTNConstants.client_id = "l7xx5edefdd923ad438eb5b332a73269f812";// arr[0];
                // GSTNConstants.client_secret = "383dc1f4835f43ad80f80f6cf284cd7b";
                //// userid = userid;
                // gstin = arr[3];
                // fp = fp;
                // ctin = arr[5];
                // etin = arr[6];
            }
            else
            {
                //System.Console.Write("Enter ClientId:");
                //GSTNConstants.client_id = System.Console.ReadLine();

                //System.Console.Write("Enter Client Secret:");
                //GSTNConstants.client_secret = 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();
            }

            try
            {
                GSTNConstants.publicip = new WebClient().DownloadString("http://ipinfo.io/ip").Trim();
            }
            catch
            {
                GSTNConstants.publicip = "11.10.1.1";
            }

            string selection = string.Empty;


            do
            {
                System.Console.Write("1=GSTR1 Get" +
                                     "\n2=GSTR2 Get" +
                                     "\n3=GSTR3 Get" +
                                     "\n4=Ledger" +
                                     "\n5=File with eSign" +
                                     "\n6=CSV conversion" +
                                     "\n7=PGP" +
                                     "\n8=File With DSC" +
                                     "\n9=GSTR1 Save" +
                                     "\n10=GSTR2 Save" +
                                     "\n11=GSTR3 Save" +
                                     "\n12=Refresh Token" +
                                     "\n13=Register DSC" +
                                     "\n14=GSTR3B SAVE" +
                                     "\n15=GSTR1 Submit" +
                                     "\n0= EXIT" +
                                     "\nEnter Your Choice ");
                selection = System.Console.ReadLine();
                switch (selection)
                {
                case "1":
                    TestGSTR1Get(gstin, userid, fp);
                    break;

                case "2":
                    TestGSTR2Get(gstin, userid, fp);
                    break;

                case "3":
                    TestGSTR3(gstin, userid, fp);
                    break;

                case "4":
                    TestLedger(gstin, userid, "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, userid, fp, aadhaarnum, transactionid, otp);
                    break;

                case "6":
                    TestCSV(gstin, 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 = "AFBPR2145D";    //System.Console.ReadLine();
                    FileGSTR1WithDSC(gstin, userid, fp, pan);
                    break;

                case "9":
                    TestGSTR1Save(gstin, userid, fp, ctin, etin);
                    break;

                case "10":
                    TestGSTR2Save(gstin, userid, fp, ctin);
                    break;

                case "12":
                    GSTNAuthClient client = GetAuth(gstin, userid);
                    client.RefreshToken();
                    break;

                case "13":
                    System.Console.Write("Enter your PAN:");
                    string pan2 = System.Console.ReadLine();
                    RegisterDSC(gstin, userid, pan2);
                    break;

                case "14":
                    TestGSTR3BSave(gstin, userid, fp, ctin, etin);
                    break;

                case "15":
                    SubmitGSTR1(gstin, userid, fp);
                    break;

                case "0":
                    Environment.Exit(0);
                    break;

                default:
                    System.Console.WriteLine("Please Enter Correct Choice From Menu");
                    break;
                }
            }while (selection != "0");
            System.Console.WriteLine("Press any key to end this program");
            System.Console.ReadKey(false);
        }