コード例 #1
0
        /// <summary>
        /// Timeout Reversal This is to reverse a previous payment that merchant does not receive a reply(Mostly due to Timeout). To use this feature/API, make sure to pass unique value to field - clientReferenceInformation -&gt; transactionId in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call and use same transactionId in this API request payload to reverse the payment.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="mitReversalRequest"></param>
        /// <returns>PtsV2PaymentsReversalsPost201Response</returns>
        public PtsV2PaymentsReversalsPost201Response MitReversal(MitReversalRequest mitReversalRequest)
        {
            logger.Debug("CALLING API \"MitReversal\" STARTED");
            this.SetStatusCode(null);
            ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = MitReversalWithHttpInfo(mitReversalRequest);

            logger.Debug("CALLING API \"MitReversal\" ENDED");
            this.SetStatusCode(localVarResponse.StatusCode);
            return(localVarResponse.Data);
        }
コード例 #2
0
        public static PtsV2PaymentsReversalsPost201Response Run()
        {
            AuthorizationForTimeoutReversalFlow.Run();
            var clientReferenceInformationTransactionId = SampleCode.TimeoutReversalTransactionId;
            Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation(
                TransactionId: clientReferenceInformationTransactionId
                );

            string reversalInformationAmountDetailsTotalAmount = "102.21";

            Ptsv2paymentsidreversalsReversalInformationAmountDetails reversalInformationAmountDetails = new Ptsv2paymentsidreversalsReversalInformationAmountDetails(
                TotalAmount: reversalInformationAmountDetailsTotalAmount
                );

            string reversalInformationReason = "Testing";

            Ptsv2paymentsidreversalsReversalInformation reversalInformation = new Ptsv2paymentsidreversalsReversalInformation(
                AmountDetails: reversalInformationAmountDetails,
                Reason: reversalInformationReason
                );

            var requestObj = new MitReversalRequest(
                ClientReferenceInformation: clientReferenceInformation,
                ReversalInformation: reversalInformation
                );

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

                var apiInstance = new ReversalApi(clientConfig);
                PtsV2PaymentsReversalsPost201Response result = apiInstance.MitReversal(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
コード例 #3
0
        /// <summary>
        /// Merchant Initiated Reversal This is to reverse a previous payment that merchant does not receive a reply.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="mitReversalRequest"></param>
        /// <returns>Task of ApiResponse (PtsV2PaymentsReversalsPost201Response)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <PtsV2PaymentsReversalsPost201Response> > MitReversalAsyncWithHttpInfo(MitReversalRequest mitReversalRequest)
        {
            // verify the required parameter 'mitReversalRequest' is set
            if (mitReversalRequest == null)
            {
                throw new ApiException(400, "Missing required parameter 'mitReversalRequest' when calling ReversalApi->MitReversal");
            }

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

            return(new ApiResponse <PtsV2PaymentsReversalsPost201Response>(localVarStatusCode,
                                                                           localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                           (PtsV2PaymentsReversalsPost201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(PtsV2PaymentsReversalsPost201Response))));
        }
コード例 #4
0
        /// <summary>
        /// Merchant Initiated Reversal This is to reverse a previous payment that merchant does not receive a reply.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="mitReversalRequest"></param>
        /// <returns>Task of PtsV2PaymentsReversalsPost201Response</returns>
        public async System.Threading.Tasks.Task <PtsV2PaymentsReversalsPost201Response> MitReversalAsync(MitReversalRequest mitReversalRequest)
        {
            ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = await MitReversalAsyncWithHttpInfo(mitReversalRequest);

            return(localVarResponse.Data);
        }
コード例 #5
0
        /// <summary>
        /// Merchant Initiated Reversal This is to reverse a previous payment that merchant does not receive a reply.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="mitReversalRequest"></param>
        /// <returns>PtsV2PaymentsReversalsPost201Response</returns>
        public PtsV2PaymentsReversalsPost201Response MitReversal(MitReversalRequest mitReversalRequest)
        {
            ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = MitReversalWithHttpInfo(mitReversalRequest);

            return(localVarResponse.Data);
        }
コード例 #6
0
        /// <summary>
        /// Timeout Reversal This is to reverse a previous payment that merchant does not receive a reply(Mostly due to Timeout). To use this feature/API, make sure to pass unique value to field - clientReferenceInformation -&gt; transactionId in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call and use same transactionId in this API request payload to reverse the payment.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="mitReversalRequest"></param>
        /// <returns>Task of PtsV2PaymentsReversalsPost201Response</returns>
        public async System.Threading.Tasks.Task <PtsV2PaymentsReversalsPost201Response> MitReversalAsync(MitReversalRequest mitReversalRequest)
        {
            logger.Debug("CALLING API \"MitReversalAsync\" STARTED");
            this.SetStatusCode(null);
            ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = await MitReversalAsyncWithHttpInfo(mitReversalRequest);

            logger.Debug("CALLING API \"MitReversalAsync\" ENDED");
            this.SetStatusCode(localVarResponse.StatusCode);
            return(localVarResponse.Data);
        }
コード例 #7
0
        /// <summary>
        /// Timeout Reversal This is to reverse a previous payment that merchant does not receive a reply(Mostly due to Timeout). To use this feature/API, make sure to pass unique value to field - clientReferenceInformation -&gt; transactionId in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/index.html#payments_payments) API call and use same transactionId in this API request payload to reverse the payment.
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="mitReversalRequest"></param>
        /// <returns>ApiResponse of PtsV2PaymentsReversalsPost201Response</returns>
        public ApiResponse <PtsV2PaymentsReversalsPost201Response> MitReversalWithHttpInfo(MitReversalRequest mitReversalRequest)
        {
            LogUtility logUtility = new LogUtility();

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

            var    localVarPath         = $"/pts/v2/reversals/";
            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 (mitReversalRequest != null && mitReversalRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(mitReversalRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = mitReversalRequest; // 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.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

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