/// <summary>
        /// Initializes this instance with JSON data from an API response.
        /// </summary>
        /// <param name="data">JSON object</param>
        public CartDiscountExpandedReference(dynamic data)
        {
            if (data == null)
            {
                return;
            }

            ReferenceType?referenceType;

            this.ReferenceType = Helper.TryGetEnumByEnumMemberAttribute <ReferenceType?>((string)data.typeId, out referenceType) ? referenceType : null;
            this.Id            = data.id;
            this.CartDiscount  = new CartDiscount(data.obj);
        }
예제 #2
0
 /// <summary>
 /// Updates a cart discount.
 /// </summary>
 /// <param name="cartDiscount">CartDiscount</param>
 /// <param name="action">The update action to be performed on the cart discount.</param>
 /// <returns>CartDiscount</returns>
 /// <see href="https://dev.commercetools.com/http-api-projects-cartDiscounts.html#update-cartdiscount"/>
 public Task <Response <CartDiscount> > UpdateCartDiscountAsync(CartDiscount cartDiscount, UpdateAction action)
 {
     return(UpdateCartDiscountAsync(cartDiscount.Id, cartDiscount.Version, new List <UpdateAction> {
         action
     }));
 }
예제 #3
0
 /// <summary>
 /// Updates a cart discount.
 /// </summary>
 /// <param name="cartDiscount">CartDiscount</param>
 /// <param name="actions">The list of update actions to be performed on the cart discount.</param>
 /// <returns>CartDiscount</returns>
 /// <see href="https://dev.commercetools.com/http-api-projects-cartDiscounts.html#update-cartdiscount"/>
 public Task <Response <CartDiscount> > UpdateCartDiscountAsync(CartDiscount cartDiscount, List <UpdateAction> actions)
 {
     return(UpdateCartDiscountAsync(cartDiscount.Id, cartDiscount.Version, actions));
 }
예제 #4
0
 /// <summary>
 /// Removes a CartDiscount.
 /// </summary>
 /// <param name="cartDiscount">CartDiscount</param>
 /// <returns>CartDiscount</returns>
 /// <see href="https://dev.commercetools.com/http-api-projects-cartDiscounts.html#delete-cartdiscount"/>
 public Task <Response <CartDiscount> > DeleteCartDiscountAsync(CartDiscount cartDiscount)
 {
     return(DeleteCartDiscountAsync(cartDiscount.Id, cartDiscount.Version));
 }