public static ProviderAccount addProviderAccount(Providers providers)
        {
            JsonSerializer serialiser = new JsonSerializer();

            serialiser.NullValueHandling = NullValueHandling.Ignore;
            Provider p            = providers.getProvider()[0];
            String   providerJson = JsonConvert.SerializeObject(p.loginForm, Formatting.Indented, new JsonSerializerSettings
            {
                NullValueHandling     = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            providerJson = "{\"loginForm\":" + providerJson;
            providerJson = providerJson.Replace("\r\n", "");
            // providerJson = providerJson.Replace(" ", "");
            providerJson = providerJson + "}";

            string aa = providerJson;

            Console.WriteLine(aa);
            String        addSiteURL      = LoginApp.localURLVer1 + "providers/providerAccounts?providerId=" + providers.getProvider()[0].getId();
            List <string> headers         = new List <string>();
            string        usersessionid   = LoginApp.usession;
            string        cbrandsessionid = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            String          jsonResponse    = HTTP.doPost(addSiteURL, providerJson, headers);
            ProviderAccount providerAccount = (ProviderAccount)GSONParser.handleJson(jsonResponse, typeof(ProviderAccount));

            return(providerAccount);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="searchString"></param> Site Name i.e dag
        public static void searchSite(string searchString)
        {
            string mn = "searchSite(searchString " + searchString + " )";
            //Console.WriteLine(fqcn + " :: " + mn);
            string        searchSiteURL   = LoginApp.localURLVer1 + "providers/v1?name=" + searchString;
            List <string> headers         = new List <string>();
            string        usersessionid   = LoginApp.usession;
            string        cbrandsessionid = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");

            string jsonResponse = HTTP.doGet(searchSiteURL, headers);//headers-Authorization headers

            Type      providertype = typeof(Providers);
            Providers providerList = (Providers)GSONParser.handleJson(jsonResponse, providertype);
            Providers prrovider    = new Providers();

            Console.WriteLine("--------------------------");
            Console.WriteLine("Provider Id  Provider Name");
            Console.WriteLine("--------------------------");
            for (int i = 0; i < providerList.pro.Count; i++)//deserialized json response for showing tabular format .
            {
                Console.WriteLine(providerList.pro[i].providerId + " " + ">>" + " " + providerList.pro[i].providerName);
            }
            Console.WriteLine("----------------------------");
        }
Ejemplo n.º 3
0
        public static Accounts getAccountsWithOptions()
        {
            string mn = "getAccounts()";

            Console.WriteLine(fqcn + " :: " + mn);
            string        accountSummaryURL = LoginApp.localURLVer1 + "accounts/investmentPlan/investmentOptions/";
            List <string> headers           = new List <string>();
            string        usersessionid     = LoginApp.usession;
            string        cbrandsessionid   = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            string   jsonResponse = HTTP.doGet(accountSummaryURL, headers);//headers-authorization headers i.e-member external sesionid,cobrand external session id
            Type     acc          = typeof(Accounts);
            Accounts accounts     = (Accounts)GSONParser.handleJson(jsonResponse, acc);

            //string type = "";
            //for (int i = 0; i < accounts.account.Count; i++)
            //{
            //    type = accounts.account[i].AccountType;
            //    if (type == "IRA")
            //    {
            //         string holdingURL = LoginApp.localURLVer1 + "holdings/v1/";
            //         jsonResponse = HTTP.doGet(holdingURL, headers);//headers-authorization headers i.e-member external sesionid,cobrand external session id
            //        Type holding = typeof(Holdings);
            //        Holdings holdings = (Holdings)GSONParser.handleJson(jsonResponse, holding);
            //        Console.WriteLine(holdings.ToString());

            //    }
            //}
            return(accounts);
        }
Ejemplo n.º 4
0
        public static int doCoBrandLogin()
        {
            string coBrandUserName = "******";
            string coBrandPassword = "******";
            string mn = "doCoBrandLogin(coBrandUserName " + coBrandUserName + ", coBrandPassword " + coBrandPassword + " )";
            //string requestBody = "cobrandLogin="******"&cobrandPassword="******"{\"cobrand\":{\"cobrandLogin\":\"" +coBrandUserName + "\",\"cobrandPassword\":\"" + coBrandPassword+"\"}";
            string requestBody     = "{\"cobrand\": {\"cobrandLogin\":\"" + coBrandUserName + "\",\"cobrandPassword\":\"" + coBrandPassword + "\"}}";
            string coBrandLoginURL = "https://developer.api.yodlee.com:443/ysl/restserver/v1/" + "cobrand/login";
            string jsonResponse    = HTTP.doPostUser(coBrandLoginURL, null, requestBody, null);

            if (jsonResponse == null)
            {
                Console.WriteLine("Wrong cobrand username/password");
                return(0);
            }
            else
            {
                CobrandContext coBrand = (CobrandContext)GSONParser.handleJson(jsonResponse, typeof(CobrandContext));
                Console.WriteLine("--- Cobrand Session Id ---");
                Console.WriteLine(coBrand.session.cobSession);
                Console.WriteLine("--------------------------");
                loginTokens["cobSession"] = coBrand.session.cobSession;
                cbsession = coBrand.session.cobSession;
                return(1);
            }
        }
Ejemplo n.º 5
0
        public static int registerUser()
        {
            // Console.WriteLine("Enter your userName: "******"cobUserName"];
            //Console.WriteLine("Enter " + coBrandUserName + "'s password: "******"cobPassword"];
            string        registerJson = ConfigurationManager.AppSettings["regJson"];
            string        registerUrl  = localURLVer1 + "/user/register";
            string        cobses       = loginTokens["cobSession"];//cobrand session id
            List <string> headers      = new List <string>();

            headers.Add("Authorization:{cobSession= " + cobses + "}");//passing cobrand session id.
            string jsonResponse = HTTP.doPostUser(registerUrl, headers, null, registerJson);

            if (jsonResponse == null)
            {
                Console.WriteLine("Wrong cobrand username/password");
                return(0);
            }
            else
            {
                CobrandContext coBrand = (CobrandContext)GSONParser.handleJson(jsonResponse, typeof(CobrandContext));
                Console.WriteLine("--- Cobrand Session Id ---");
                Console.WriteLine(coBrand.session.cobSession);
                Console.WriteLine("--------------------------");
                loginTokens["cobSession"] = coBrand.session.cobSession;
                cbsession = coBrand.session.cobSession;
                return(1);
            }
        }
Ejemplo n.º 6
0
        public static int doMemberLogin()
        {
            Console.WriteLine("Enter your userName: "******"sbMemdojo1";

            Console.WriteLine("Enter " + userName + "'s password");
            string userPassword = "******";
            string mn           = "doMemberLogin(loginName=" + userName + ", password = "******", coBrandSessionCredential =" + loginTokens["cobSession"] + " )";
            //string requestBody = "coBrandSessionCredential=" + loginTokens["cobSession"] + "&loginName=" + userName + "&password="******"{\"user\": {\"loginName\":\"sbMemdojo1\",\"password\":\"sbMemdojo1#123\"}}";

            string        userLoginURL = localURLVer1 + "user/login";
            string        cobses       = loginTokens["cobSession"];//cobrand session id
            List <string> headers      = new List <string>();

            headers.Add("Authorization:{cobSession= " + cobses + "}");//passing cobrand session id.
            string jsonResponse = HTTP.doPostUser(userLoginURL, headers, requestBody, null);

            if (jsonResponse == null)
            {
                Console.WriteLine("Wrong username/password");
                return(0);
            }
            else
            {
                UserContext member = (UserContext)GSONParser.handleJson(jsonResponse, typeof(UserContext));
                Console.WriteLine("--- User Session Id ---");
                Console.WriteLine(member.user.session.userSession);
                Console.WriteLine("-----------------------");
                loginTokens["userSession"] = member.user.session.userSession;
                usession = loginTokens["userSession"];
                return(1);
            }
        }
        public static ProviderAccount getProviderAccount(String providerAccountId)
        {
            String        getRefreshStatusURL = LoginApp.localURLVer1 + "providers/providerAccounts/" + providerAccountId.ToString();
            List <string> headers             = new List <string>();
            string        usersessionid       = LoginApp.usession;
            string        cbrandsessionid     = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            String jsonResponse = HTTP.doGet(getRefreshStatusURL, headers);
            // Console.WriteLine(jsonResponse);
            ProviderAccount providerAccount = (ProviderAccount)GSONParser.handleJson(jsonResponse, typeof(ProviderAccount));

            return(providerAccount);
        }
Ejemplo n.º 8
0
        public static Providers getProviderLoginForm(String providerId)
        {
            //Console.WriteLine(fqcn + " :: " + mn);
            String        getSiteURL      = LoginApp.localURLVer1 + "providers/" + providerId;
            List <string> headers         = new List <string>();
            string        usersessionid   = LoginApp.usession;
            string        cbrandsessionid = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            String    jsonResponse = HTTP.doGet(getSiteURL, headers);
            Providers providers    = (Providers)GSONParser.handleJson(jsonResponse, typeof(Providers));

            Console.WriteLine(providers.toString());
            return(providers);
        }
Ejemplo n.º 9
0
        public static Accounts getAccounts()
        {
            string mn = "getAccounts()";

            Console.WriteLine(fqcn + " :: " + mn);
            string        accountSummaryURL = LoginApp.localURLVer1 + "accounts/";
            List <string> headers           = new List <string>();
            string        usersessionid     = LoginApp.usession;
            string        cbrandsessionid   = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            string   jsonResponse = HTTP.doGet(accountSummaryURL, headers);//headers-authorization headers i.e-member external sesionid,cobrand external session id
            Type     acc          = typeof(Accounts);
            Accounts accounts     = (Accounts)GSONParser.handleJson(jsonResponse, acc);

            return(accounts);
        }
Ejemplo n.º 10
0
        public static RefreshStatus getRefreshStatus(String providerAccountId)
        {
            //String mn = "getRefreshStatus( " + providerAccountId.ToString() + " )";
            //Console.WriteLine(fqcn + " :: " + mn);
            String        getRefreshStatusURL = LoginApp.localURLVer1 + "refresh/" + providerAccountId.ToString();
            List <string> headers             = new List <string>();
            string        usersessionid       = LoginApp.usession;
            string        cbrandsessionid     = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            String jsonResponse = HTTP.doGet(getRefreshStatusURL, headers);
            // Console.WriteLine(jsonResponse);
            RefreshStatus refreshStatus = (RefreshStatus)GSONParser.handleJson(jsonResponse, typeof(RefreshStatus));

            Console.WriteLine(refreshStatus.toString());
            return(refreshStatus);
        }
Ejemplo n.º 11
0
        public static Provider getSiteLoginForm(string sitId)//id to be searched from list of siteid
        {
            string mn = "searchSite(site Id " + sitId + " )";
            //Console.WriteLine(fqcn + " :: " + mn);
            string        userLoginURL    = LoginApp.localURLVer1 + "providers/v1/" + sitId;
            List <string> headers         = new List <string>();
            string        usersessionid   = LoginApp.usession;
            string        cbrandsessionid = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            string   jsonResponse = HTTP.doGet(userLoginURL, headers);
            Type     sitetype     = typeof(Provider);
            Provider site         = (Provider)GSONParser.handleJson(jsonResponse, sitetype);

            //Site siteaccount = JsonConvert.DeserializeObject<Site>(jsonResponse);
            Console.WriteLine("The Site Name Is" + site.provider[0].Name);
            return(site);
        }
Ejemplo n.º 12
0
        public static ProviderAccount doChallenge(LoginForm loginForm, String providerAccountId)
        {
            String mn           = "doChallenge( " + loginForm.ToString() + " providerAccountId = " + providerAccountId;
            String providerJson = JsonConvert.SerializeObject(loginForm, Formatting.Indented, new JsonSerializerSettings
            {
                NullValueHandling     = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            providerJson = providerJson.Replace("\r\n", "");
            providerJson = "{\"loginForm\":" + providerJson + "}";
            Console.WriteLine(providerJson);
            String        addSiteURL      = LoginApp.localURLVer1 + "providers/providerAccounts?providerAccountIds=" + providerAccountId;
            List <string> headers         = new List <string>();
            string        usersessionid   = LoginApp.usession;
            string        cbrandsessionid = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            String          jsonResponse    = HTTP.doPutNew(addSiteURL, headers, providerJson);
            ProviderAccount providerAccount = (ProviderAccount)GSONParser.handleJson(jsonResponse, typeof(ProviderAccount));

            return(providerAccount);
        }
Ejemplo n.º 13
0
        public static void searchProvider(String searchString)
        {
            String mn = "searchSite(searchString " + searchString + " )";

            Console.WriteLine(fqcn + " :: " + mn);
            String        searchProviderURL = LoginApp.localURLVer1 + "providers?name=" + searchString;
            List <string> headers           = new List <string>();
            string        usersessionid     = LoginApp.usession;
            string        cbrandsessionid   = LoginApp.cbsession;

            headers.Add("Authorization:{userSession= " + usersessionid + ",cobSession=" + cbrandsessionid + "}");
            String    jsonResponse = HTTP.doGet(searchProviderURL, headers);
            Providers providers    = (Providers)GSONParser.handleJson(jsonResponse, typeof(Providers));

            Console.WriteLine("------------------------------------------------");
            Console.WriteLine(" Id  Provider Name        Login Url");
            Console.WriteLine("------------------------------------------------");
            for (int i = 0; i < providers.provider.Length; i++)//deserialized json response for showing tabular format .
            {
                Console.WriteLine(providers.provider[i].id + " " + ">>" + " " + providers.provider[i].name + "  " + ">>" + "  " + providers.provider[i].loginUrl);
            }
            Console.WriteLine("--------------------------------------------------");
            //Console.Write(providers.toString());
        }
Ejemplo n.º 14
0
        public static string doMemberLogin(string coBrandUserNa, string coBrandPass, string userNa, string userPass)
        {
            //Console.WriteLine("Enter your userName: "******"cobUserNameQA"];     //Console.ReadLine(); //"novlessthan500";//"sbMemtestmar212";//
            // Console.WriteLine("Enter " + userName + "'s password");
            string userPassword = ConfigurationManager.AppSettings["cobPasswordQA"]; //Console.ReadLine();//"TEST@123";// "sbMemtestmar212#123"; //
            //string mn = "doMemberLogin(loginName=" + userName + ", password = "******", coBrandSessionCredential =" + loginTokens["cobSession"] + " )";
            //string requestBody = "coBrandSessionCredential=" + loginTokens["cobSession"] + "&loginName=" + userName + "&password="******"{\"user\": {\"loginName\":\"" + userName + "\",\"password\":\"" + userPassword + "\"}}";
            //loginTokens.Add("cobSession", cbsession);

            string userLoginURL = localURLVer1 + "cobrand/login";
            //string userLoginURL =  localURLVer1 + coBrandUserNa + " / v1/cobrand/login";
            //string cobses = loginTokens["cobSession"];//cobrand session id
            string        cobses  = cbsession;//  loginTokens["cobSession"];//cobrand session id
            List <string> headers = new List <string>();

            headers.Add("Authorization:{cobSession= " + cobses + "}");//passing cobrand session id.
            string jsonResponse = HTTP.doPostUser(userLoginURL, headers, requestBody, null);

            if (jsonResponse == null)
            {
                Console.WriteLine("Wrong username/password");
                return("0");
            }
            else
            {
                UserContext member = (UserContext)GSONParser.handleJson(jsonResponse, typeof(UserContext));
                Console.WriteLine("--- User Session Id ---");
                Console.WriteLine(member.user.session.userSession);
                Console.WriteLine("-----------------------");
                loginTokens["userSession"] = member.user.session.userSession;
                usession = loginTokens["userSession"];
                return(member.user.session.userSession);
            }
        }