/// <summary>
        /// Increment an Authorization Use this service to authorize additional charges in a lodging or autorental transaction. Include the ID returned from the original authorization in the PATCH request to add additional charges to that authorization.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The ID returned from the original authorization request.</param>
        /// <param name="incrementAuthRequest"></param>
        /// <returns>Task of PtsV2IncrementalAuthorizationPatch201Response</returns>
        public async System.Threading.Tasks.Task <PtsV2IncrementalAuthorizationPatch201Response> IncrementAuthAsync(string id, IncrementAuthRequest incrementAuthRequest)
        {
            logger.Debug("CALLING API \"IncrementAuthAsync\" STARTED");
            this.SetStatusCode(null);
            ApiResponse <PtsV2IncrementalAuthorizationPatch201Response> localVarResponse = await IncrementAuthAsyncWithHttpInfo(id, incrementAuthRequest);

            logger.Debug("CALLING API \"IncrementAuthAsync\" ENDED");
            this.SetStatusCode(localVarResponse.StatusCode);
            return(localVarResponse.Data);
        }
        /// <summary>
        /// Increment an Authorization Use this service to authorize additional charges in a lodging or autorental transaction. Include the ID returned from the original authorization in the PATCH request to add additional charges to that authorization.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The ID returned from the original authorization request.</param>
        /// <param name="incrementAuthRequest"></param>
        /// <returns>Task of ApiResponse (PtsV2IncrementalAuthorizationPatch201Response)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <PtsV2IncrementalAuthorizationPatch201Response> > IncrementAuthAsyncWithHttpInfo(string id, IncrementAuthRequest incrementAuthRequest)
        {
            LogUtility logUtility = new LogUtility();

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

            var    localVarPath         = $"/pts/v2/payments/{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 (incrementAuthRequest != null && incrementAuthRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(incrementAuthRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = incrementAuthRequest; // 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)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("IncrementAuth", localVarResponse);
                if (exception != null)
                {
                    logger.Error($"Exception : {exception.Message}");
                    throw exception;
                }
            }

            return(new ApiResponse <PtsV2IncrementalAuthorizationPatch201Response>(localVarStatusCode,
                                                                                   localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                                   (PtsV2IncrementalAuthorizationPatch201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(PtsV2IncrementalAuthorizationPatch201Response)))); // Return statement
        }
        /// <summary>
        /// Increment an Authorization Use this service to authorize additional charges in a lodging or autorental transaction. Include the ID returned from the original authorization in the PATCH request to add additional charges to that authorization.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The ID returned from the original authorization request.</param>
        /// <param name="incrementAuthRequest"></param>
        /// <returns>PtsV2IncrementalAuthorizationPatch201Response</returns>
        public PtsV2IncrementalAuthorizationPatch201Response IncrementAuth(string id, IncrementAuthRequest incrementAuthRequest)
        {
            logger.Debug("CALLING API \"IncrementAuth\" STARTED");
            this.SetStatusCode(null);
            ApiResponse <PtsV2IncrementalAuthorizationPatch201Response> localVarResponse = IncrementAuthWithHttpInfo(id, incrementAuthRequest);

            logger.Debug("CALLING API \"IncrementAuth\" ENDED");
            this.SetStatusCode(localVarResponse.StatusCode);
            return(localVarResponse.Data);
        }
Ejemplo n.º 4
0
        public static PtsV2IncrementalAuthorizationPatch201Response Run()
        {
            string id = AuthorizationForIncrementalAuthorizationFlow.Run().Id;
            string clientReferenceInformationCode = "TC50171_3";
            Ptsv2paymentsidClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            bool processingInformationAuthorizationOptionsInitiatorStoredCredentialUsed = true;
            Ptsv2paymentsidProcessingInformationAuthorizationOptionsInitiator processingInformationAuthorizationOptionsInitiator = new Ptsv2paymentsidProcessingInformationAuthorizationOptionsInitiator(
                StoredCredentialUsed: processingInformationAuthorizationOptionsInitiatorStoredCredentialUsed
                );

            Ptsv2paymentsidProcessingInformationAuthorizationOptions processingInformationAuthorizationOptions = new Ptsv2paymentsidProcessingInformationAuthorizationOptions(
                Initiator: processingInformationAuthorizationOptionsInitiator
                );

            Ptsv2paymentsidProcessingInformation processingInformation = new Ptsv2paymentsidProcessingInformation(
                AuthorizationOptions: processingInformationAuthorizationOptions
                );

            string orderInformationAmountDetailsAdditionalAmount = "22.49";
            string orderInformationAmountDetailsCurrency         = "USD";
            Ptsv2paymentsidOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidOrderInformationAmountDetails(
                AdditionalAmount: orderInformationAmountDetailsAdditionalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2paymentsidOrderInformation orderInformation = new Ptsv2paymentsidOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            string merchantInformationTransactionLocalDateTime     = "20191002080000";
            Ptsv2paymentsidMerchantInformation merchantInformation = new Ptsv2paymentsidMerchantInformation(
                TransactionLocalDateTime: merchantInformationTransactionLocalDateTime
                );

            string travelInformationDuration = "4";
            Ptsv2paymentsidTravelInformation travelInformation = new Ptsv2paymentsidTravelInformation(
                Duration: travelInformationDuration
                );

            var requestObj = new IncrementAuthRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ProcessingInformation: processingInformation,
                OrderInformation: orderInformation,
                MerchantInformation: merchantInformation,
                TravelInformation: travelInformation
                );

            try
            {
                var configDictionary = new Configuration().GetAlternativeConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);

                var apiInstance = new PaymentsApi(clientConfig);
                PtsV2IncrementalAuthorizationPatch201Response result = apiInstance.IncrementAuth(id, requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
        /// <summary>
        /// Increment an Authorization Use this service to authorize additional charges in a lodging or autorental transaction. Include the ID returned from the original authorization in the PATCH request to add additional charges to that authorization.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The ID returned from the original authorization request.</param>
        /// <param name="incrementAuthRequest"></param>
        /// <returns>Task of PtsV2IncrementalAuthorizationPatch201Response</returns>
        public async System.Threading.Tasks.Task <PtsV2IncrementalAuthorizationPatch201Response> IncrementAuthAsync(string id, IncrementAuthRequest incrementAuthRequest)
        {
            ApiResponse <PtsV2IncrementalAuthorizationPatch201Response> localVarResponse = await IncrementAuthAsyncWithHttpInfo(id, incrementAuthRequest);

            return(localVarResponse.Data);
        }
        /// <summary>
        /// Increment an Authorization Use this service to authorize additional charges in a lodging or autorental transaction. Include the ID returned from the original authorization in the PATCH request to add additional charges to that authorization.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The ID returned from the original authorization request.</param>
        /// <param name="incrementAuthRequest"></param>
        /// <returns>ApiResponse of PtsV2IncrementalAuthorizationPatch201Response</returns>
        public ApiResponse <PtsV2IncrementalAuthorizationPatch201Response> IncrementAuthWithHttpInfo(string id, IncrementAuthRequest incrementAuthRequest)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling PaymentsApi->IncrementAuth");
            }
            // verify the required parameter 'incrementAuthRequest' is set
            if (incrementAuthRequest == null)
            {
                throw new ApiException(400, "Missing required parameter 'incrementAuthRequest' when calling PaymentsApi->IncrementAuth");
            }

            var    localVarPath         = $"/pts/v2/payments/{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 (incrementAuthRequest != null && incrementAuthRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(incrementAuthRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = incrementAuthRequest; // byte array
            }

            if (false)
            {
            }
            else
            {
            }


            // 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("IncrementAuth", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <PtsV2IncrementalAuthorizationPatch201Response>(localVarStatusCode,
                                                                                   localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                                   (PtsV2IncrementalAuthorizationPatch201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(PtsV2IncrementalAuthorizationPatch201Response)))); // Return statement
        }
        /// <summary>
        /// Increment an Authorization Use this service to authorize additional charges in a lodging or autorental transaction. Include the ID returned from the original authorization in the PATCH request to add additional charges to that authorization.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The ID returned from the original authorization request.</param>
        /// <param name="incrementAuthRequest"></param>
        /// <returns>PtsV2IncrementalAuthorizationPatch201Response</returns>
        public PtsV2IncrementalAuthorizationPatch201Response IncrementAuth(string id, IncrementAuthRequest incrementAuthRequest)
        {
            ApiResponse <PtsV2IncrementalAuthorizationPatch201Response> localVarResponse = IncrementAuthWithHttpInfo(id, incrementAuthRequest);

            return(localVarResponse.Data);
        }