Exemple #1
0
        /// <summary>
        /// Duplicate payment Achieve a payment by copy of a previously processed payment, with the same payment method.
        /// </summary>
        /// <exception cref="pachirapay.Connector.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authToken">Gets or sets the authentication token.</param>
        /// <param name="duplicatePaymentRequest">All data needed to make process the payment, with the reference to the previously payment. (optional)</param>
        /// <returns>Task of ApiResponse (CardPaymentResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CardPaymentResponse>> V1PaymentsDuplicatePaymentPostAsyncWithHttpInfo (string authToken, DuplicatePaymentRequest duplicatePaymentRequest = null)
        {
            // verify the required parameter 'authToken' is set
            if (authToken == null)
                throw new ApiException(400, "Missing required parameter 'authToken' when calling DuplicatePaymentApi->V1PaymentsDuplicatePaymentPost");

            var localVarPath = "./v1/payments/duplicate-payment";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.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-patch+json", 
                "application/json", 
                "text/json", 
                "application/_*+json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (authToken != null) localVarHeaderParams.Add("authToken", this.Configuration.ApiClient.ParameterToString(authToken)); // header parameter
            if (duplicatePaymentRequest != null && duplicatePaymentRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(duplicatePaymentRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = duplicatePaymentRequest; // byte array
            }


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

            int localVarStatusCode = (int) localVarResponse.StatusCode;

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

            return new ApiResponse<CardPaymentResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Key, x => string.Join(",", x.Value)),
                (CardPaymentResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CardPaymentResponse)));
        }
Exemple #2
0
        /// <summary>
        /// Duplicate payment Achieve a payment by copy of a previously processed payment, with the same payment method.
        /// </summary>
        /// <exception cref="pachirapay.Connector.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authToken">Gets or sets the authentication token.</param>
        /// <param name="duplicatePaymentRequest">All data needed to make process the payment, with the reference to the previously payment. (optional)</param>
        /// <returns>Task of CardPaymentResponse</returns>
        public async System.Threading.Tasks.Task<CardPaymentResponse> V1PaymentsDuplicatePaymentPostAsync (string authToken, DuplicatePaymentRequest duplicatePaymentRequest = null)
        {
             ApiResponse<CardPaymentResponse> localVarResponse = await V1PaymentsDuplicatePaymentPostAsyncWithHttpInfo(authToken, duplicatePaymentRequest);
             return localVarResponse.Data;

        }
Exemple #3
0
 /// <summary>
 /// Duplicate payment Achieve a payment by copy of a previously processed payment, with the same payment method.
 /// </summary>
 /// <exception cref="pachirapay.Connector.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="authToken">Gets or sets the authentication token.</param>
 /// <param name="duplicatePaymentRequest">All data needed to make process the payment, with the reference to the previously payment. (optional)</param>
 /// <returns>CardPaymentResponse</returns>
 public CardPaymentResponse V1PaymentsDuplicatePaymentPost (string authToken, DuplicatePaymentRequest duplicatePaymentRequest = null)
 {
      ApiResponse<CardPaymentResponse> localVarResponse = V1PaymentsDuplicatePaymentPostWithHttpInfo(authToken, duplicatePaymentRequest);
      return localVarResponse.Data;
 }