Example #1
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = OrderItemFactory.AddItemToQuote(handler : handler,  quoteItem :  quoteItem,  quoteId :  quoteId,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<Quote/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.CommerceRuntime.Quotes.Quote AddItemToQuote(ServiceClientMessageHandler handler,
                                                                                     Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem quoteItem, string quoteId, string responseFields = null,
                                                                                     HttpStatusCode expectedCode = HttpStatusCode.Created, HttpStatusCode successCode = HttpStatusCode.Created)
        {
            SetSdKparameters();
            var currentClassName  = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
            var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Debug.WriteLine(currentMethodName + '.' + currentMethodName);
            var apiClient = Mozu.Api.Clients.Commerce.Quotes.OrderItemClient.AddItemToQuoteClient(
                quoteItem:  quoteItem, quoteId:  quoteId, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            catch (ApiException ex)
            {
                // Custom error handling for test cases can be placed here
                Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
                if (customException != null)
                {
                    throw customException;
                }
                return(null);
            }
            return(ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null);
        }
Example #2
0
        /// <summary>
        /// Updates the item fulfillment information for the order specified in the request.
        /// </summary>
        /// <param name="orderId">Unique identifier of the order.</param>
        /// <param name="orderItemId">Unique identifier of the item to remove from the order.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="updateMode">Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."</param>
        /// <param name="version">System-supplied integer that represents the current version of the order, which prevents users from unintentionally overriding changes to the order. When a user performs an operation for a defined order, the system validates that the version of the updated order matches the version of the order on the server. After the operation completes successfully, the system increments the version number by one.</param>
        /// <param name="orderItem">The details associated with a specific item in an order.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.CommerceRuntime.Orders.Order"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdateItemFulfillment( orderItem,  orderId,  orderItemId,  updateMode,  version,  responseFields);
        ///   var orderClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> UpdateItemFulfillmentClient(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem orderItem, string orderId, string orderItemId, string updateMode = null, string version = null, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Orders.OrderItemUrl.UpdateItemFulfillmentUrl(orderId, orderItemId, updateMode, version, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem>(orderItem);

            return(mozuClient);
        }
Example #3
0
        /// <summary>
        /// Adds a new item to a defined order.
        /// </summary>
        /// <param name="orderId">Unique identifier of the order.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="skipInventoryCheck">If true, skip the process to validate inventory when creating this product reservation.</param>
        /// <param name="updateMode">Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."</param>
        /// <param name="version">System-supplied integer that represents the current version of the order, which prevents users from unintentionally overriding changes to the order. When a user performs an operation for a defined order, the system validates that the version of the updated order matches the version of the order on the server. After the operation completes successfully, the system increments the version number by one.</param>
        /// <param name="orderItem">The details associated with a specific item in an order.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.CommerceRuntime.Orders.Order"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=CreateOrderItem( orderItem,  orderId,  updateMode,  version,  skipInventoryCheck,  responseFields);
        ///   var orderClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> CreateOrderItemClient(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem orderItem, string orderId, string updateMode = null, string version = null, bool?skipInventoryCheck = null, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Orders.OrderItemUrl.CreateOrderItemUrl(orderId, updateMode, version, skipInventoryCheck, responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem>(orderItem);

            return(mozuClient);
        }
Example #4
0
        /// <summary>
        /// Updates the item fulfillment information for the order specified in the request.
        /// </summary>
        /// <param name="orderId">Unique identifier of the order.</param>
        /// <param name="orderItemId">Unique identifier of the item to remove from the order.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="updateMode">Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."</param>
        /// <param name="version">System-supplied integer that represents the current version of the order, which prevents users from unintentionally overriding changes to the order. When a user performs an operation for a defined order, the system validates that the version of the updated order matches the version of the order on the server. After the operation completes successfully, the system increments the version number by one.</param>
        /// <param name="orderItem">The details associated with a specific item in an order.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Orders.Order"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var orderitem = new OrderItem();
        ///   var order = await orderitem.UpdateItemFulfillmentAsync( orderItem,  orderId,  orderItemId,  updateMode,  version,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> UpdateItemFulfillmentAsync(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem orderItem, string orderId, string orderItemId, string updateMode = null, string version = null, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> response;
            var client = Mozu.Api.Clients.Commerce.Orders.OrderItemClient.UpdateItemFulfillmentClient(orderItem, orderId, orderItemId, updateMode, version, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync();

            return(await response.ResultAsync());
        }
Example #5
0
        /// <summary>
        /// Adds a new item to a defined order.
        /// </summary>
        /// <param name="orderId">Unique identifier of the order.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="skipInventoryCheck">If true, skip the process to validate inventory when creating this product reservation.</param>
        /// <param name="updateMode">Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."</param>
        /// <param name="version">System-supplied integer that represents the current version of the order, which prevents users from unintentionally overriding changes to the order. When a user performs an operation for a defined order, the system validates that the version of the updated order matches the version of the order on the server. After the operation completes successfully, the system increments the version number by one.</param>
        /// <param name="orderItem">The details associated with a specific item in an order.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Orders.Order"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var orderitem = new OrderItem();
        ///   var order = await orderitem.CreateOrderItemAsync( orderItem,  orderId,  updateMode,  version,  skipInventoryCheck,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> CreateOrderItemAsync(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem orderItem, string orderId, string updateMode = null, string version = null, bool?skipInventoryCheck = null, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> response;
            var client = Mozu.Api.Clients.Commerce.Orders.OrderItemClient.CreateOrderItemClient(orderItem, orderId, updateMode, version, skipInventoryCheck, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync();

            return(await response.ResultAsync());
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="checkoutId">The unique identifier of the checkout.</param>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="item"></param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.CommerceRuntime.Checkouts.Checkout"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=AddCheckoutItem( item,  checkoutId,  responseFields);
        ///   var checkoutClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.CommerceRuntime.Checkouts.Checkout> AddCheckoutItemClient(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem item, string checkoutId, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Checkouts.OrderItemUrl.AddCheckoutItemUrl(checkoutId, responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.CommerceRuntime.Checkouts.Checkout>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem>(item);

            return(mozuClient);
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="quoteId">The unique identifier for the quote that the item being updated is listed within.</param>
        /// <param name="quoteItemId">The unique identifier for the quote item being updated.</param>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="quoteItem">The item within a quote that is being updated.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Quotes.Quote"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var orderitem = new OrderItem();
        ///   var quote = await orderitem.UpdateQuoteItemAsync( quoteItem,  quoteId,  quoteItemId,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Quotes.Quote> UpdateQuoteItemAsync(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem quoteItem, string quoteId, string quoteItemId, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.CommerceRuntime.Quotes.Quote> response;
            var client = Mozu.Api.Clients.Commerce.Quotes.OrderItemClient.UpdateQuoteItemClient(quoteItem, quoteId, quoteItemId, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync(ct).ConfigureAwait(false);

            return(await response.ResultAsync());
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="checkoutId">The unique identifier of the checkout.</param>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="item"></param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Checkouts.Checkout"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var orderitem = new OrderItem();
        ///   var checkout = await orderitem.AddCheckoutItemAsync( item,  checkoutId,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Checkouts.Checkout> AddCheckoutItemAsync(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem item, string checkoutId, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.CommerceRuntime.Checkouts.Checkout> response;
            var client = Mozu.Api.Clients.Commerce.Checkouts.OrderItemClient.AddCheckoutItemClient(item, checkoutId, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync(ct).ConfigureAwait(false);

            return(await response.ResultAsync());
        }
Example #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="quoteId">The unique identifier for the quote that the item being updated is listed within.</param>
        /// <param name="quoteItemId">The unique identifier for the quote item being updated.</param>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="quoteItem">The item within a quote that is being updated.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.CommerceRuntime.Quotes.Quote"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdateQuoteItem( quoteItem,  quoteId,  quoteItemId,  responseFields);
        ///   var quoteClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.CommerceRuntime.Quotes.Quote> UpdateQuoteItemClient(Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem quoteItem, string quoteId, string quoteItemId, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Quotes.OrderItemUrl.UpdateQuoteItemUrl(quoteId, quoteItemId, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.CommerceRuntime.Quotes.Quote>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem>(quoteItem);

            return(mozuClient);
        }
Example #10
0
        /// <summary>
        /// Updates the item fulfillment information for the order specified in the request.
        /// <example>
        ///  <code>
        /// var result = OrderItemFactory.UpdateItemFulfillment(handler : handler,  orderItem :  orderItem,  orderId :  orderId,  orderItemId :  orderItemId,  updateMode :  updateMode,  version :  version,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<Order/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.CommerceRuntime.Orders.Order UpdateItemFulfillment(ServiceClientMessageHandler handler,
                                                                                            Mozu.Api.Contracts.CommerceRuntime.Orders.OrderItem orderItem, string orderId, string orderItemId, string updateMode = null, string version = null, string responseFields = null,
                                                                                            HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
        {
            SetSdKparameters();
            var currentClassName  = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
            var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Debug.WriteLine(currentMethodName + '.' + currentMethodName);
            var apiClient = Mozu.Api.Clients.Commerce.Orders.OrderItemClient.UpdateItemFulfillmentClient(
                orderItem:  orderItem, orderId:  orderId, orderItemId:  orderItemId, updateMode:  updateMode, version:  version, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).Execute();
            }
            catch (ApiException ex)
            {
                // Custom error handling for test cases can be placed here
                Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
                if (customException != null)
                {
                    throw customException;
                }
                return(null);
            }
            return(ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null);
        }