Пример #1
0
        /// <summary>
        /// Process With 3-D Secure The process method will process the transaction with the given card details by eventually using 3-D secure. The buyer has to be redirect to the URL returned by this method.
        /// </summary>
        /// <exception cref="Wallee.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="spaceId"></param>
        /// <param name="transactionId">The ID of the transaction which should be processed.</param>
        /// <param name="paymentMethodConfigurationId">The payment method configuration ID which is applied to the transaction.</param>
        /// <param name="cardData">The card details as JSON in plain which should be used to authorize the payment.</param>
        /// <returns>ApiResponse of string</returns>
        public ApiResponse <string> ProcessWith3DSecureWithHttpInfo(long?spaceId, long?transactionId, long?paymentMethodConfigurationId, UnencryptedCardDataCreate cardData)
        {
            // verify the required parameter 'spaceId' is set
            if (spaceId == null)
            {
                throw new ApiException(400, "Missing required parameter 'spaceId' when calling CardProcessingService->ProcessWith3DSecure");
            }
            // verify the required parameter 'transactionId' is set
            if (transactionId == null)
            {
                throw new ApiException(400, "Missing required parameter 'transactionId' when calling CardProcessingService->ProcessWith3DSecure");
            }
            // verify the required parameter 'paymentMethodConfigurationId' is set
            if (paymentMethodConfigurationId == null)
            {
                throw new ApiException(400, "Missing required parameter 'paymentMethodConfigurationId' when calling CardProcessingService->ProcessWith3DSecure");
            }
            // verify the required parameter 'cardData' is set
            if (cardData == null)
            {
                throw new ApiException(400, "Missing required parameter 'cardData' when calling CardProcessingService->ProcessWith3DSecure");
            }

            var    localVarPath         = "/card-processing/processWith3DSecure";
            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;charset=utf-8"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

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

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

            if (spaceId != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "spaceId", spaceId));                  // query parameter
            }
            if (transactionId != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "transactionId", transactionId));                        // query parameter
            }
            if (paymentMethodConfigurationId != null)
            {
                localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "paymentMethodConfigurationId", paymentMethodConfigurationId));                                       // query parameter
            }
            if (cardData != null && cardData.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cardData); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cardData; // byte array
            }


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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <string>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                            (string)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))));
        }
Пример #2
0
        /// <summary>
        /// Process The process method will process the transaction with the given card details without using 3-D secure.
        /// </summary>
        /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="spaceId"></param>
        /// <param name="transactionId">The ID of the transaction which should be processed.</param>
        /// <param name="paymentMethodConfigurationId">The payment method configuration ID which is applied to the transaction.</param>
        /// <param name="cardData">The card details as JSON in plain which should be used to authorize the payment.</param>
        /// <returns>Task of ApiResponse (Transaction)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Transaction> > ProcessAsyncWithHttpInfo(long?spaceId, long?transactionId, long?paymentMethodConfigurationId, UnencryptedCardDataCreate cardData)
        {
            // verify the required parameter 'spaceId' is set
            if (spaceId == null)
            {
                throw new ApiException(400, "Missing required parameter 'spaceId' when calling CardProcessingService->Process");
            }
            // verify the required parameter 'transactionId' is set
            if (transactionId == null)
            {
                throw new ApiException(400, "Missing required parameter 'transactionId' when calling CardProcessingService->Process");
            }
            // verify the required parameter 'paymentMethodConfigurationId' is set
            if (paymentMethodConfigurationId == null)
            {
                throw new ApiException(400, "Missing required parameter 'paymentMethodConfigurationId' when calling CardProcessingService->Process");
            }
            // verify the required parameter 'cardData' is set
            if (cardData == null)
            {
                throw new ApiException(400, "Missing required parameter 'cardData' when calling CardProcessingService->Process");
            }

            var    localVarPath         = "/card-processing/process";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>();
            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 = ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

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

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

            if (spaceId != null)
            {
                localVarQueryParams.Add("spaceId", ApiClient.ParameterToString(spaceId));                  // query parameter
            }
            if (transactionId != null)
            {
                localVarQueryParams.Add("transactionId", ApiClient.ParameterToString(transactionId));                        // query parameter
            }
            if (paymentMethodConfigurationId != null)
            {
                localVarQueryParams.Add("paymentMethodConfigurationId", ApiClient.ParameterToString(paymentMethodConfigurationId));                                       // query parameter
            }
            if (cardData != null && cardData.GetType() != typeof(byte[]))
            {
                localVarPostBody = ApiClient.Serialize(cardData); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cardData; // byte array
            }

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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <Transaction>(localVarStatusCode,
                                                 localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                 (Transaction)ApiClient.Deserialize(localVarResponse, typeof(Transaction))));
        }