Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        public CobrandContext parseJSON(string json)

        {
            string mn = "parseJSON(" + json + ")";
            // Console.WriteLine(fqcn + " :: " + mn);

            CobrandContext cobrandcntxt = JsonConvert.DeserializeObject <CobrandContext>(json);

            return(cobrandcntxt);
        }
Esempio n. 3
0
        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);
            }
        }