예제 #1
0
        /// <summary>
        /// Method to Invoke for Getting Account details
        /// </summary>
        /// <param name="input">Input parameters for the service call</param>
        /// <returns></returns>
        public string GetAccountDetails(JObject input)
        {
            var inputFormat = new JObject()
            {
                new JProperty("token"),
                new JProperty("serviceUrl"),
            };

            Validation.ValidateInput(input, inputFormat);

            var token      = input.GetValue("token").ToString();
            var serviceUrl = input.GetValue("serviceUrl").ToString();
            var serviceId  = _serviceId.GetServiceId(serviceUrl, token).Result;

            var request = new JObject()
            {
                new JProperty("action", "getAccountDetails"),
                new JProperty("serviceId", serviceId),
            };
            var response = JObject.Parse(_serviceClient.PostAsync <string>(serviceUrl, request).Result);
            var ret      = new JObject()
            {
                new JProperty("statusCode", response.SelectToken("statusCode")),
                new JProperty("message", response.SelectToken("message")),
            };

            return(JsonConvert.SerializeObject(ret));
        }
예제 #2
0
        /// <summary>
        /// Method to invoke to get the card on file
        /// </summary>
        /// <param name="input">Input parameters for the service call</param>
        /// <returns></returns>
        public string GetCardOnFile(JObject input)
        {
            var inputFormat = new JObject()
            {
                new JProperty("token"),
                new JProperty("serviceUrl"),
            };

            Validation.ValidateInput(input, inputFormat);

            var token      = input.GetValue("token").ToString();
            var serviceUrl = input.GetValue("serviceUrl").ToString();
            var serviceId  = _serviceId.GetServiceId(serviceUrl, token).Result;

            var request = new JObject()
            {
                new JProperty("action", "loadSavedCreditCard"),
                new JProperty("serviceId", serviceId)
            };
            var response = JObject.Parse(_serviceClient.PostAsync <string>(serviceUrl, request).Result);
            var ret      = new JObject()
            {
                new JProperty("statusCode", response.SelectToken("statusCode")),
                new JProperty("message", response.SelectToken("message")),
                new JProperty("cardNumber", response.SelectToken("creditCardListType.cardsList[0].cardNumber"))
            };

            return(JsonConvert.SerializeObject(ret));
        }
예제 #3
0
        /// <summary>
        /// Method to invoke to add a vehicle
        /// </summary>
        /// <param name="input">Input parameters for the service call</param>
        /// <returns></returns>
        public string AddVehicle(JObject input)
        {
            var inputFormat = new JObject()
            {
                new JProperty("token"),
                new JProperty("serviceUrl"),
                new JProperty("plateNumber"),
                new JProperty("plateState"),
            };

            Validation.ValidateInput(input, inputFormat);

            var token      = input.GetValue("token").ToString();
            var serviceUrl = input.GetValue("serviceUrl").ToString();
            var serviceId  = _serviceId.GetServiceId(serviceUrl, token).Result;

            var request = new JObject()
            {
                new JProperty("action", "addVehicleList"),
                new JProperty("serviceId", serviceId),
                new JProperty("plateNumber", input.GetValue("plateNumber")),
                new JProperty("plateSate", input.GetValue("plateState")),
                new JProperty("vehicleYear", "2014"),
                new JProperty("vehicleMake", "ACURA"),
                new JProperty("vehicleModel", "SAFAF"),
                new JProperty("vehicleCountry", "USA"),
                new JProperty("vehicleStartdate", "4/10/2014 04:05:00"),
                new JProperty("vehicleEnddate", "4/17/2014 04:05:00"),
                new JProperty("plateTypedesc", "STANDARD"),
            };

            var response = JObject.Parse(_serviceClient.PostAsync <string>(serviceUrl, request).Result);
            var ret      = new JObject()
            {
                new JProperty("statusCode", response.SelectToken("statusCode")),
                new JProperty("message", response.SelectToken("message")),
            };

            return(JsonConvert.SerializeObject(ret));
        }