Example #1
0
        public string GetDownload(string onlineId = "OD_Q2M1KDZG3")
        {
            ConfirmRequest confirmReqeust = new ConfirmRequest
            {
                online_order_id = onlineId
            };

            return(GetDownload(confirmReqeust));
        }
Example #2
0
        public string PostConfirm(string onlineId = "OD_Q2M1KDZG3")
        {
            ConfirmRequest confirmReqeust = new ConfirmRequest
            {
                online_order_id = onlineId
            };

            return(PostConfirm(confirmReqeust));
        }
Example #3
0
        public string GetDownload(ConfirmRequest downloadReqeust)
        {
            var dateTime  = DateTime.Now.ToUniversalTime();
            var secure    = new ParamSecure(Config.Secret, Config.ApiKey, dateTime, downloadReqeust);
            var signature = secure.Sign();

            var client = new RestClient(Config.GrailTravelHost);

            Console.WriteLine(downloadReqeust.GetURL());
            var request = new RestRequest($"/api/v2/online_orders/{downloadReqeust.online_order_id}/online_tickets?online_order_id={downloadReqeust.online_order_id}", Method.GET);

            request.AddHeader("From", Config.ApiKey);
            request.AddHeader("Date", dateTime.ToString("r"));
            request.AddHeader("Authorization", signature);

            var response = client.Get(request);

            return(response.Content);
        }
Example #4
0
        public string PostConfirm(ConfirmRequest confirmReqeust)
        {
            var dateTime  = DateTime.Now.ToUniversalTime();
            var secure    = new ParamSecure(Config.Secret, Config.ApiKey, dateTime, confirmReqeust);
            var signature = secure.Sign();

            var client = new RestClient(Config.GrailTravelHost);

            Console.WriteLine(confirmReqeust.GetURL());
            var request = new RestRequest($"/api/v2/online_orders/{confirmReqeust.online_order_id}/online_confirmations", Method.POST);

            request.AddHeader("From", Config.ApiKey);
            request.AddHeader("Date", dateTime.ToString("r"));
            request.AddHeader("Authorization", signature);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(confirmReqeust);

            var response = client.Post(request);

            return(response.Content);
        }