/// <inheritdoc /> /// <summary> /// Create a country tax <b>Permissions Needed:</b> TAX_ADMIN /// </summary> /// <param name="taxResource">The tax object</param> public void CreateCountryTax(CountryTaxResource taxResource) { mWebCallEvent.WebPath = "/tax/countries"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(taxResource); // 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 mCreateCountryTaxStartTime = DateTime.Now; mWebCallEvent.Context = mCreateCountryTaxResponseContext; mWebCallEvent.RequestType = KnetikRequestType.POST; KnetikLogger.LogRequest(mCreateCountryTaxStartTime, "CreateCountryTax", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }
/// <inheritdoc /> /// <summary> /// Create or update a tax <b>Permissions Needed:</b> TAX_ADMIN /// </summary> /// <param name="countryCodeIso3">The iso3 code of the country</param> /// <param name="taxResource">The tax object</param> public void UpdateCountryTax(string countryCodeIso3, CountryTaxResource taxResource) { // verify the required parameter 'countryCodeIso3' is set if (countryCodeIso3 == null) { throw new KnetikException(400, "Missing required parameter 'countryCodeIso3' when calling UpdateCountryTax"); } mWebCallEvent.WebPath = "/tax/countries/{country_code_iso3}"; if (!string.IsNullOrEmpty(mWebCallEvent.WebPath)) { mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{format}", "json"); } mWebCallEvent.WebPath = mWebCallEvent.WebPath.Replace("{" + "country_code_iso3" + "}", KnetikClient.ParameterToString(countryCodeIso3)); mWebCallEvent.HeaderParams.Clear(); mWebCallEvent.QueryParams.Clear(); mWebCallEvent.AuthSettings.Clear(); mWebCallEvent.PostBody = null; mWebCallEvent.PostBody = KnetikClient.Serialize(taxResource); // 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 mUpdateCountryTaxStartTime = DateTime.Now; mWebCallEvent.Context = mUpdateCountryTaxResponseContext; mWebCallEvent.RequestType = KnetikRequestType.PUT; KnetikLogger.LogRequest(mUpdateCountryTaxStartTime, "UpdateCountryTax", "Sending server request..."); KnetikGlobalEventSystem.Publish(mWebCallEvent); }