예제 #1
0
        public static void AddAccount(int type)
        {
            Providers     providers     = null;
            RefreshStatus refreshStatus = null;

            Console.WriteLine("Add Provider Account App - TEST - START");
            Console.WriteLine("Enter the name of the  Provider you want to search : ");
            String searchString = Console.ReadLine();

            //String searchString = "Dag";
            ProviderApp.searchProvider(searchString);
            if (type == 2)
            {
                Console.WriteLine("Enter the Provider Id : ");
                String providerId = Console.ReadLine();
                //String providerId = "16442";
                providers = ProviderApp.getProviderLoginForm(providerId);
                addMFA_Account(providers);
            }
            if (type == 1)
            {
                Console.WriteLine("Enter the Provider Id : ");
                String providerId = Console.ReadLine();
                //String providerId = "16441";
                providers = ProviderApp.getProviderLoginForm(providerId);
                addNonMFA_Account(providers);
            }
            //Console.ReadLine();
            LoginApp.readValue();
        }
예제 #2
0
        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);
        }
예제 #3
0
 public static void getRefreshStatus(RefreshStatus refreshStatus)
 {
     Console.WriteLine(refreshStatus.toString());
     //Keep Polling this api to get RefreshStatus :
     for (int i = 0; i < 10; i++)
     {
         getRefreshStatus(refreshStatus.getProviderAccountId());
     }
 }
예제 #4
0
        public RefreshStatus parseJSON(String json)
        {
            //String mn = "parseJSON(" + json + ")";
            //System.out.println(fqcn + " :: " + mn);
            //Gson gson = new Gson();
            //return (RefreshStatus)gson.fromJson(json, RefreshStatus.class);
            // json = json.Substring(json.IndexOf("["));
            // json = json.Substring(0, json.LastIndexOf("]") + 1);
            RefreshStatus refreshstatus = JsonConvert.DeserializeObject <RefreshStatus>(json);//deserializing the values for Account app.

            // Accounts a = new Accounts();
            // a.account = account;
            //return a;
            return(refreshstatus);
        }
예제 #5
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);
        }
예제 #6
0
        public static RefreshStatus addNonMFA_Account(Providers providers)
        {
            Console.WriteLine(" Add Non_MFA_Account:  ");
            Console.WriteLine("Enter your provider userName : "******"ysldemo.site16442.1";
            // For internal Yodlee Dag tool use this hardcoded user Name = "DBmet1.site16441.1"
            providers.getProvider()[0].getLoginForm().getRow()[0].getField()[0].setValue(userName);

            Console.WriteLine("Enter provider password : "******"site16442.1";
            //String password = con.readLine("Enter provider password : "******"site16441.1"
            providers.getProvider()[0].getLoginForm().getRow()[1].getField()[0].setValue(password);
            RefreshStatus refreshStatus = AddProviderAccount.addProviderAccount(providers);
            string        refMsg;
            RefreshStatus rstatus;

            do
            {
                rstatus = AddProviderAccount.getRefreshStatus(refreshStatus.providerAccountId);
                //RefreshStatus rstatus = (RefreshStatus)GSONParser.handleJson(jsonResponse, typeof(RefreshStatus));
                refMsg = rstatus.refreshInfo.refreshStatus;
                if (refMsg == "LOGIN_FAILURE" || refMsg == "REFRESH_TIMED_OUT" || refMsg == "REFRESH_CANCELLED" || refMsg == "SITE_CANNOT_BE_REFRESHED")
                {
                    Console.WriteLine("login failed please try again" + refMsg);
                    break;
                }
                if (refMsg == "REFRESH_COMPLETED_ACCOUNTS_ALREADY_AGGREGATED")
                {
                    Console.WriteLine("Account already added" + refMsg);
                    break;
                }
                // Console.WriteLine("login failed please try again" + refMsg);
                // }
            } while (refMsg != "REFRESH_COMPLETED");
            if (refMsg == "REFRESH_COMPLETED")
            {
                Console.WriteLine("Account added successfully");
            }
            return(rstatus);
        }