/// <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); }
/// <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 })); }
/// <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)); }
/// <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)); }