コード例 #1
0
ファイル: AddProviderAccount.cs プロジェクト: santiastur/bank
        public static RefreshStatus addProviderAccount(Providers providers)
        {
            JsonSerializer serialiser = new JsonSerializer();

            serialiser.NullValueHandling = NullValueHandling.Ignore;

            String providerJson = "{\"provider\":[" + JsonConvert.SerializeObject(providers.getProvider()[0], Formatting.Indented, new JsonSerializerSettings

            {
                NullValueHandling     = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            providerJson = providerJson.Replace("\r\n", "");
            providerJson = providerJson.Replace(" ", "");
            providerJson = providerJson + "]}";

            string aa = providerJson;

            Console.WriteLine(aa);
            String addSiteURL = LoginApp.localURLVer1 + "providers/" + 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);
            RefreshStatus refreshStatus = (RefreshStatus)GSONParser.handleJson(jsonResponse, typeof(RefreshStatus));

            //Console.WriteLine(refreshStatus.ToString());
            return(refreshStatus);
        }
コード例 #2
0
ファイル: LoginApp.cs プロジェクト: santiastur/bank
        public static int doMemberLogin()
        {
            string userName     = ConfigurationManager.AppSettings["cobUserNameQA"];
            string userPassword = ConfigurationManager.AppSettings["cobPasswordQA"];

            string requestBody = "{\"user\": {\"loginName\":\"" + userName + "\",\"password\":\"" + userPassword + "\"}}";

            string        userLoginURL = localURLVer1 + "user/login";
            string        cobses       = loginTokens["cobSession"];
            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)
            {
                return(0);
            }
            else
            {
                UserContext member = (UserContext)GSONParser.handleJson(jsonResponse, typeof(UserContext));
                loginTokens["userSession"] = member.user.session.userSession;
                usession = loginTokens["userSession"];
                return(1);
            }
        }
コード例 #3
0
ファイル: AccountApp.cs プロジェクト: santiastur/bank
        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);
        }
コード例 #4
0
ファイル: LoginApp.cs プロジェクト: santiastur/bank
        public static string localURLVer1 = ConfigurationManager.AppSettings["url"];//"http://localhost:8080/ysl/yodlee/";

        public static int registerUser()
        {
            string userName = ConfigurationManager.AppSettings["cobUserName"];
            string password = ConfigurationManager.AppSettings["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);
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: ProviderApp.cs プロジェクト: santiastur/bank
        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);
        }
コード例 #7
0
ファイル: AddProviderAccount.cs プロジェクト: santiastur/bank
        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);
        }
コード例 #8
0
ファイル: AccountApp.cs プロジェクト: santiastur/bank
        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);
        }
コード例 #9
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);
        }
コード例 #10
0
ファイル: LoginApp.cs プロジェクト: santiastur/bank
        public static int doCoBrandLogin()
        {
            string coBrandUserName = ConfigurationManager.AppSettings["cobUserName"];
            string coBrandPassword = ConfigurationManager.AppSettings["cobPassword"];
            //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 = localURLVer1 + "cobrand/login";
            string jsonResponse    = HTTP.doPostUser(coBrandLoginURL, null, requestBody, null);

            if (jsonResponse == null)
            {
                return(0);
            }
            else
            {
                CobrandContext coBrand = (CobrandContext)GSONParser.handleJson(jsonResponse, typeof(CobrandContext));
                loginTokens["cobSession"] = coBrand.session.cobSession;
                cbsession = coBrand.session.cobSession;
                return(1);
            }
        }
コード例 #11
0
ファイル: ProviderApp.cs プロジェクト: santiastur/bank
        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());
        }