/// <summary>
        /// Create Cancellation. Mark (part of) an order as cancelled.
        /// </summary>
        /// <exception cref="ChannelEngine.Merchant.ApiClient.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="merchantCancellationRequest"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <ApiResponse> CancellationCreateAsync(MerchantCancellationRequest merchantCancellationRequest = default(MerchantCancellationRequest), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            ChannelEngine.Merchant.ApiClient.Client.ApiResponse <ApiResponse> localVarResponse = await CancellationCreateWithHttpInfoAsync(merchantCancellationRequest, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Create Cancellation. Mark (part of) an order as cancelled.
        /// </summary>
        /// <exception cref="ChannelEngine.Merchant.ApiClient.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="merchantCancellationRequest"> (optional)</param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (ApiResponse)</returns>
        public async System.Threading.Tasks.Task <ChannelEngine.Merchant.ApiClient.Client.ApiResponse <ApiResponse> > CancellationCreateWithHttpInfoAsync(MerchantCancellationRequest merchantCancellationRequest = default(MerchantCancellationRequest), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            ChannelEngine.Merchant.ApiClient.Client.RequestOptions localVarRequestOptions = new ChannelEngine.Merchant.ApiClient.Client.RequestOptions();

            string[] _contentTypes = new string[] {
                "application/json-patch+json",
                "application/json",
                "application/_*+json"
            };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };


            var localVarContentType = ChannelEngine.Merchant.ApiClient.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = ChannelEngine.Merchant.ApiClient.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }

            localVarRequestOptions.Data = merchantCancellationRequest;

            // authentication (apiKey) required
            if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("apikey")))
            {
                localVarRequestOptions.QueryParameters.Add(ChannelEngine.Merchant.ApiClient.Client.ClientUtils.ParameterToMultiMap("", "apikey", this.Configuration.GetApiKeyWithPrefix("apikey")));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <ApiResponse>("/v2/cancellations", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("CancellationCreate", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
 /// <summary>
 /// Create Cancellation. Mark (part of) an order as cancelled.
 /// </summary>
 /// <exception cref="ChannelEngine.Merchant.ApiClient.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="merchantCancellationRequest"> (optional)</param>
 /// <returns>ApiResponse</returns>
 public ApiResponse CancellationCreate(MerchantCancellationRequest merchantCancellationRequest = default(MerchantCancellationRequest))
 {
     ChannelEngine.Merchant.ApiClient.Client.ApiResponse <ApiResponse> localVarResponse = CancellationCreateWithHttpInfo(merchantCancellationRequest);
     return(localVarResponse.Data);
 }