public CouponDefinition Update(CouponDefinition definition) { if (definition.CampaignId == 0) { throw new ArgumentException("Campaign ID is missing."); } int accountId = definition.AccountId > 0 ? definition.AccountId : CurrentAccount; return(Update(accountId, definition.CampaignId, definition)); }
/// <inheritdoc /> /// <summary> /// Adds a custom discount to the cart <b>Permissions Needed:</b> SHOPPING_CARTS_ADMIN /// </summary> /// <param name="id">The id of the cart</param> /// <param name="customDiscount">The details of the discount to add</param> public void AddCustomDiscount(string id, CouponDefinition customDiscount) { // verify the required parameter 'id' is set if (id == null) { throw new KnetikException(400, "Missing required parameter 'id' when calling AddCustomDiscount"); } mWebCallEvent.WebPath = "/carts/{id}/custom-discounts"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "id" + "}", KnetikClient.ParameterToString(id)); mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(customDiscount); // http body (model) parameter // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_client_credentials_grant"); // authentication settings mWebCallEvent.AuthSettings.Add("oauth2_password_grant"); // make the HTTP request mAddCustomDiscountStartTime = DateTime.Now; mWebCallEvent.Context = mAddCustomDiscountResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mAddCustomDiscountStartTime, "AddCustomDiscount", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
public CouponDefinition Update(int campaignId, CouponDefinition definition) { int accountId = definition.AccountId > 0 ? definition.AccountId : CurrentAccount; return(Update(accountId, campaignId, definition)); }
public CouponDefinition Update(int accountId, int campaignId, CouponDefinition definition) { var rval = TDClient.Update(ITEM, new { accountId, campaignId }, definition); return(rval); }
public CouponDefinition Update(int accountId, int campaignId, CouponDefinition definition) { return(Api.Put($"/account/{accountId}/campaign/{campaignId}/coupon", definition)); }