示例#1
0
        /// <summary>
        /// Create fund transaction, typically a deposit Perform fund deposit
        /// </summary>
        /// <exception cref="FieldNation.SDK.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="companyId">ID of company</param>
        /// <param name="financeId">ID of finance account</param>
        /// <param name="fundTransaction">Transaction attempting to be created (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Object> > UpdateFundByFundAsyncWithHttpInfo(int?companyId, int?financeId, FundTransaction fundTransaction = null)
        {
            // verify the required parameter 'companyId' is set
            if (companyId == null)
            {
                throw new ApiException(400, "Missing required parameter 'companyId' when calling CreditCardApi->UpdateFundByFund");
            }
            // verify the required parameter 'financeId' is set
            if (financeId == null)
            {
                throw new ApiException(400, "Missing required parameter 'financeId' when calling CreditCardApi->UpdateFundByFund");
            }

            var    localVarPath         = "/company/{company_id}/funds/{finance_id}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <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",
                "application/x-www-form-urlencoded",
                "multipart/form-data"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

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

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

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


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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <Object>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                            null));
        }