/// <summary> /// /// </summary> /// <param name="discountId">discountId parameter description DOCUMENT_HERE </param> /// <param name="orderId">Unique identifier of the order.</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="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">Determines whether or not to check versioning of items for concurrency purposes.</param> /// <param name="discount">Properties of all applied discounts for an associated cart, order, or product. </param> /// <returns> /// <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.CommerceRuntime.Orders.Order"/>} /// </returns> /// <example> /// <code> /// var mozuClient=UpdateOrderDiscount( discount, orderId, discountId, updateMode, version, responseFields); /// var orderClient = mozuClient.WithBaseAddress(url).Execute().Result(); /// </code> /// </example> public static MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> UpdateOrderDiscountClient(Mozu.Api.Contracts.CommerceRuntime.Discounts.AppliedDiscount discount, string orderId, int discountId, string updateMode = null, string version = null, string responseFields = null) { var url = Mozu.Api.Urls.Commerce.OrderUrl.UpdateOrderDiscountUrl(orderId, discountId, 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.Discounts.AppliedDiscount>(discount); return(mozuClient); }
/// <summary> /// /// <example> /// <code> /// var result = OrderFactory.UpdateOrderDiscount(handler : handler, discount : discount, orderId : orderId, discountId : discountId, 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 UpdateOrderDiscount(ServiceClientMessageHandler handler, Mozu.Api.Contracts.CommerceRuntime.Discounts.AppliedDiscount discount, string orderId, int discountId, 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.OrderClient.UpdateOrderDiscountClient( discount: discount, orderId: orderId, discountId: discountId, updateMode: updateMode, version: version, 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); }
/// <summary> /// Update the discount applied to an item in an order. /// </summary> /// <param name="discountId">Unique identifier of the discount. System-supplied and read only.</param> /// <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="discount">Properties of all applied discounts for an associated cart, order, or product. </param> /// <returns> /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Orders.Order"/> /// </returns> /// <example> /// <code> /// var orderitem = new OrderItem(); /// var order = await orderitem.UpdateOrderItemDiscountAsync( discount, orderId, orderItemId, discountId, updateMode, version, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> UpdateOrderItemDiscountAsync(Mozu.Api.Contracts.CommerceRuntime.Discounts.AppliedDiscount discount, string orderId, string orderItemId, int discountId, 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.UpdateOrderItemDiscountClient(discount, orderId, orderItemId, discountId, updateMode, version, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(); return(await response.ResultAsync()); }
/// <summary> /// /// </summary> /// <param name="discountId">discountId parameter description DOCUMENT_HERE </param> /// <param name="orderId">Unique identifier of the order.</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="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">Determines whether or not to check versioning of items for concurrency purposes.</param> /// <param name="discount">Properties of all applied discounts for an associated cart, order, or product. </param> /// <returns> /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Orders.Order"/> /// </returns> /// <example> /// <code> /// var order = new Order(); /// var order = await order.UpdateOrderDiscountAsync( discount, orderId, discountId, updateMode, version, responseFields); /// </code> /// </example> public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> UpdateOrderDiscountAsync(Mozu.Api.Contracts.CommerceRuntime.Discounts.AppliedDiscount discount, string orderId, int discountId, string updateMode = null, string version = null, string responseFields = null, CancellationToken ct = default(CancellationToken)) { MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> response; var client = Mozu.Api.Clients.Commerce.OrderClient.UpdateOrderDiscountClient(discount, orderId, discountId, updateMode, version, responseFields); client.WithContext(_apiContext); response = await client.ExecuteAsync(ct).ConfigureAwait(false); return(await response.ResultAsync()); }
public virtual Mozu.Api.Contracts.CommerceRuntime.Orders.Order UpdateOrderDiscount(Mozu.Api.Contracts.CommerceRuntime.Discounts.AppliedDiscount discount, string orderId, int discountId, string updateMode = null, string version = null, string responseFields = null) { MozuClient <Mozu.Api.Contracts.CommerceRuntime.Orders.Order> response; var client = Mozu.Api.Clients.Commerce.OrderClient.UpdateOrderDiscountClient(discount, orderId, discountId, updateMode, version, responseFields); client.WithContext(_apiContext); response = client.Execute(); return(response.Result()); }