예제 #1
0
        public async Task <string> GetTravelRequirements(string departureCountryCode, string destinationCountryCode)
        {
            var visaRequestProfile = new TimaticRequestProfile()
            {
                Ref                    = _token,
                DocumentType           = "passport",
                DestinationCountryCode = destinationCountryCode,
                NationalityCode        = departureCountryCode
            };

            return(await Task.Run(() => SendVisaRequirementsRequest(visaRequestProfile)));
        }
예제 #2
0
        private async Task <string> SendVisaRequirementsRequest(TimaticRequestProfile visaRequestProfile)
        {
            using (client = new HttpClient())
            {
                //pvh_destinationcountrycode = LK & pvh_documenttype = passport & pvh_nationalitycode = IT

                var fuec = new FormUrlEncodedContent(visaRequestProfile.GetRequestParameters());

                HttpResponseMessage response = await client.PostAsync(timaticBaseUri, fuec);

                var responseString = string.Empty;
                if (response.IsSuccessStatusCode)
                {
                    return(await response.Content.ReadAsStringAsync());
                }

                return(responseString);
            }
        }