Example #1
0
        public void ImportOrder()
        {
            var flightsRestClient = CreateRestClient();

            const string requiredVendorUniqueNumber = "WVF2TM";

            var request = new ImportOrderRequest
            {
                VendorUniqueNumber = requiredVendorUniqueNumber,
                Owner = new ImportOrderRequest.User {
                    Login = "******", SiteSlug = "invest-marvik"
                }
            };

            TourMLDocument tourMLDocument = flightsRestClient.ImportOrder(request);

            Assert.NotNull(tourMLDocument);

            var ordersPayload = tourMLDocument.GetOrdersPayload();

            Assert.NotNull(ordersPayload);

            var vendorUniqueNumber = ordersPayload.Orders.First().VendorUniqueNumber;

            Assert.AreEqual(requiredVendorUniqueNumber, vendorUniqueNumber);
        }
Example #2
0
        private void ImportOrder()
        {
            var restClient = (FlightsRestClient)DataProcessor.GetRestClient("FlightsRestClient");
            var request    = new ImportOrderRequest
            {
                VendorUniqueNumber = txtVendorUniqueNumber.Text,
                Owner = new ImportOrderRequest.User
                {
                    Login    = txtLogin.Text,
                    SiteSlug = txtSiteSlug.Text
                }
            };

            restClient.ImportOrder(request);
        }
        /// <summary>
        /// The order import defines a mechanism for importing orders supplied as an XML document.
        /// </summary>
        /// <param name="request">order data to be created</param>
        /// <param name="channel">Channel Name</param>
        /// <returns></returns>
        public virtual CreateOrUpdateEntityRootResponse CreateOrder(ImportOrderRequest request, string channel)
        {
            var response          = new CreateOrUpdateEntityRootResponse();
            var validatorResponse = GetValidatorResponse(request);

            if (!validatorResponse.IsValidRequest)
            {
                response.ValidationError = validatorResponse.ValidationErrors;
                return(response);
            }

            response.CreateOrUpdateEntityResponse = ExecutePostRequest <CreateOrUpdateEntityResponse>(
                new ProfulfilmentRequestContent
            {
                RequestUri = PrepareRequestUrl("remoteorder/imports/importitems.xml"),
                PostData   = ProfulfilmentEntityRequestBody.Order(request),
                HttpMethod = HttpMethod.Post,
                Headers    = new Dictionary <string, string> {
                    { "channel", channel }
                }
            });
            return(response);
        }