public static int cancelRideRequest(string requestID)
    {
        AuthenticationKeys auth = new AuthenticationKeys();

        if (HttpContext.Current.Session["userAuthData"] != null)
        {
            try
            {
                string            uri        = "https://sandbox-api.uber.com/v1/requests/" + requestID;
                var               webRequest = (HttpWebRequest)WebRequest.Create(uri);
                AccessCredentials accessData = new AccessCredentials();
                accessData = (AccessCredentials)HttpContext.Current.Session["userAuthData"];
                string authToken = "Bearer " + accessData.getAccessToken();
                webRequest.Headers.Add("Authorization", authToken);
                webRequest.ContentType = "application/json";
                webRequest.Method      = "DELETE";
                var webResponse = (HttpWebResponse)webRequest.GetResponse();
                HttpContext.Current.Session["userAuthData"] = null;
                return(1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(0);
            }
        }
        else
        {
            return(-1);
        }
    }
    public static int autoUpdateRequestStatus(string requestID, string updateStatus)
    {
        AuthenticationKeys auth = new AuthenticationKeys();

        try
        {
            string            uri        = "https://sandbox-api.uber.com/v1/sandbox/requests/" + requestID;
            var               webRequest = (HttpWebRequest)WebRequest.Create(uri);
            AccessCredentials accessData = new AccessCredentials();
            accessData = (AccessCredentials)HttpContext.Current.Session["userAuthData"];
            string authToken = "Bearer " + accessData.getAccessToken();
            webRequest.Headers.Add("Authorization", authToken);
            webRequest.ContentType = "application/json";
            webRequest.Method      = "PUT";
            using (var streamWriter = new StreamWriter(webRequest.GetRequestStream()))
            {
                string json = "{\"status\":\"" + updateStatus + "\"}";

                streamWriter.Write(json);
                streamWriter.Flush();
            }
            var webResponse = (HttpWebResponse)webRequest.GetResponse();
            return(1);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            return(0);
        }
    }
    public static RequestEstimateOutput getRequestEstimate(string productID, double latitude, double longitude, double destLat, double destLong)
    {
        AuthenticationKeys    auth       = new AuthenticationKeys();
        RequestEstimateOutput outputData = new RequestEstimateOutput();

        if (HttpContext.Current.Session["userAuthData"] != null)
        {
            try
            {
                string            uri        = "https://sandbox-api.uber.com/v1.2/requests/estimate";
                var               webRequest = (HttpWebRequest)WebRequest.Create(uri);
                AccessCredentials accessData = new AccessCredentials();
                accessData = (AccessCredentials)HttpContext.Current.Session["userAuthData"];
                string authToken = "Bearer " + accessData.getAccessToken();
                webRequest.Headers.Add("Authorization", authToken);
                webRequest.ContentType = "application/json";
                //webRequest.Headers.Add("Accept-Language", "en_US");
                //webRequest.Headers.Add("Content-Type", "application/json");
                webRequest.Method = "POST";

                using (var streamWriter = new StreamWriter(webRequest.GetRequestStream()))
                {
                    string json = "{\"product_id\":\"" + productID + "\",\"start_latitude\":" + latitude + ",\"start_longitude\":" + longitude + ",\"end_latitude\":" + destLat + ",\"end_longitude\":" + destLong + "}";

                    streamWriter.Write(json);
                    streamWriter.Flush();
                }

                var webResponse = (HttpWebResponse)webRequest.GetResponse();
                if ((webResponse.StatusCode == HttpStatusCode.OK) && (webResponse.ContentLength > 0))
                {
                    var    reader = new StreamReader(webResponse.GetResponseStream());
                    string s      = reader.ReadToEnd();
                    outputData = JsonConvert.DeserializeObject <RequestEstimateOutput>(s);
                    return(outputData);
                }
                else
                {
                    Console.WriteLine("Error");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
        else
        {
            return(null);
        }
    }
    public static RideReceiptOutput generateRideReceipt(string requestID)
    {
        RideReceiptOutput  outputData = new RideReceiptOutput();
        AuthenticationKeys auth       = new AuthenticationKeys();

        if (HttpContext.Current.Session["userAuthData"] != null)
        {
            try
            {
                string            uri        = "https://sandbox-api.uber.com/v1/requests/" + requestID + "/receipt";
                var               webRequest = (HttpWebRequest)WebRequest.Create(uri);
                AccessCredentials accessData = new AccessCredentials();
                accessData = (AccessCredentials)HttpContext.Current.Session["userAuthData"];
                string authToken = "Bearer " + accessData.getAccessToken();
                webRequest.Headers.Add("Authorization", authToken);
                webRequest.ContentType = "application/json";
                webRequest.Method      = "GET";
                var webResponse = (HttpWebResponse)webRequest.GetResponse();
                if ((webResponse.StatusCode == HttpStatusCode.OK) && (webResponse.ContentLength > 0))
                {
                    var    reader = new StreamReader(webResponse.GetResponseStream());
                    string s      = reader.ReadToEnd();
                    outputData = JsonConvert.DeserializeObject <RideReceiptOutput>(s);
                    HttpContext.Current.Session["userAuthData"] = null;
                    return(outputData);
                }
                else
                {
                    Console.WriteLine("Error");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(null);
            }
        }
        else
        {
            return(null);
        }
    }