コード例 #1
0
        /// <summary>
        /// Void Taxes Pass the Tax Request ID in the PATCH request to void the committed tax calculation.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="voidTaxRequest"></param>
        /// <param name="id">The tax ID returned from a previous request.</param>
        /// <returns>Task of ApiResponse (VasV2TaxVoid200Response)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <VasV2TaxVoid200Response> > VoidTaxAsyncWithHttpInfo(VoidTaxRequest voidTaxRequest, string id)
        {
            // verify the required parameter 'voidTaxRequest' is set
            if (voidTaxRequest == null)
            {
                throw new ApiException(400, "Missing required parameter 'voidTaxRequest' when calling TaxesApi->VoidTax");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling TaxesApi->VoidTax");
            }

            var    localVarPath         = $"/vas/v2/tax/{id}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json;charset=utf-8"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/hal+json;charset=utf-8"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (id != null)
            {
                localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id));             // path parameter
            }
            if (voidTaxRequest != null && voidTaxRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(voidTaxRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = voidTaxRequest; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("VoidTax", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <VasV2TaxVoid200Response>(localVarStatusCode,
                                                             localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                             (VasV2TaxVoid200Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(VasV2TaxVoid200Response)))); // Return statement
        }
コード例 #2
0
        /// <summary>
        /// Void Taxes Pass the Tax Request ID in the PATCH request to void the committed tax calculation.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="voidTaxRequest"></param>
        /// <param name="id">The tax ID returned from a previous request.</param>
        /// <returns>ApiResponse of VasV2TaxVoid200Response</returns>
        public ApiResponse <VasV2TaxVoid200Response> VoidTaxWithHttpInfo(VoidTaxRequest voidTaxRequest, string id)
        {
            LogUtility logUtility = new LogUtility();

            // verify the required parameter 'voidTaxRequest' is set
            if (voidTaxRequest == null)
            {
                logger.Error("ApiException : Missing required parameter 'voidTaxRequest' when calling TaxesApi->VoidTax");
                throw new ApiException(400, "Missing required parameter 'voidTaxRequest' when calling TaxesApi->VoidTax");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                logger.Error("ApiException : Missing required parameter 'id' when calling TaxesApi->VoidTax");
                throw new ApiException(400, "Missing required parameter 'id' when calling TaxesApi->VoidTax");
            }

            var    localVarPath         = $"/vas/v2/tax/{id}";
            var    localVarPathParams   = new Dictionary <string, string>();
            var    localVarQueryParams  = new Dictionary <string, string>();
            var    localVarHeaderParams = new Dictionary <string, string>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <string, string>();
            var    localVarFileParams   = new Dictionary <string, FileParameter>();
            object localVarPostBody     = null;

            // to determine the Content-Type header
            string[] localVarHttpContentTypes = new string[] {
                "application/json;charset=utf-8"
            };
            string localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            string[] localVarHttpHeaderAccepts = new string[] {
                "application/hal+json;charset=utf-8"
            };
            string localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (id != null)
            {
                localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter
            }
            logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}");
            if (voidTaxRequest != null && voidTaxRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(voidTaxRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = voidTaxRequest; // byte array
            }

            if (logUtility.IsMaskingEnabled(logger))
            {
                logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}");
            }
            else
            {
                logger.Debug($"HTTP Request Body :\n{localVarPostBody}");
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath,
                                                                                            Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("VoidTax", localVarResponse);
                if (exception != null)
                {
                    logger.Error($"Exception : {exception.Message}");
                    throw exception;
                }
            }

            return(new ApiResponse <VasV2TaxVoid200Response>(localVarStatusCode,
                                                             localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                             (VasV2TaxVoid200Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(VasV2TaxVoid200Response)))); // Return statement
        }