public static PtsV2PaymentsReversalsPost201Response Run() { var processPaymentId = ProcessPayment.Run().Id; var clientReferenceInformationObj = new Ptsv2paymentsidreversalsClientReferenceInformation("test_reversal"); var amount = new Ptsv2paymentsidreversalsOrderInformationLineItems(null, "102.21"); var amountDetailsObj = new List <Ptsv2paymentsidreversalsOrderInformationLineItems> { amount }; var orderInformationObj = new Ptsv2paymentsidreversalsOrderInformation(amountDetailsObj); var requestBody = new AuthReversalRequest(clientReferenceInformationObj, null, null, orderInformationObj); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new ReversalApi(clientConfig); var result = apiInstance.AuthReversal(processPaymentId, requestBody); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); return(null); } }
public static void Run(IReadOnlyDictionary <string, string> configDictionary) { var clientReferenceInformationObj = new V2paymentsidreversalsClientReferenceInformation("Testing"); var amount = new V2paymentsidreversalsOrderInformationLineItems(null, "102.21"); var amountDetailsObj = new List <V2paymentsidreversalsOrderInformationLineItems> { amount }; var orderInformationObj = new V2paymentsidreversalsOrderInformation(amountDetailsObj); var requestBody = new AuthReversalRequest(clientReferenceInformationObj, null, null, orderInformationObj); var merchantConfig = new MerchantConfig(configDictionary) { RequestType = "POST", RequestTarget = "/pts/v2/payments/5343950179766232704003/reversals", RequestJsonData = JsonConvert.SerializeObject(requestBody) }; try { var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig); var apiInstance = new ReversalApi(configurationSwagger); var result = apiInstance.AuthReversal("5343950179766232704003", requestBody); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); } }
public static PtsV2PaymentsReversalsPost201Response Run() { var processPaymentId = ProcessPaymentWithServiceFee.Run().Id; var requestBody = new AuthReversalRequest(); var clientReferenceInformationObj = new Ptsv2paymentsidreversalsClientReferenceInformation("TC50171_3"); requestBody.ClientReferenceInformation = clientReferenceInformationObj; var v2paymentsidreversalsReversalInformationObj = new Ptsv2paymentsidreversalsReversalInformation { Reason = "34" }; var v2paymentsidreversalsReversalInformationAmountDetailsobj = new Ptsv2paymentsidreversalsReversalInformationAmountDetails { TotalAmount = "2325.00" }; v2paymentsidreversalsReversalInformationObj.AmountDetails = v2paymentsidreversalsReversalInformationAmountDetailsobj; requestBody.ReversalInformation = v2paymentsidreversalsReversalInformationObj; try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new ReversalApi(clientConfig); var result = apiInstance.AuthReversal(processPaymentId, requestBody); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); return(null); } }
/// <summary> /// Process an Authorization Reversal Include the payment ID in the POST request to reverse the payment amount. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The payment ID returned from a previous payment request.</param> /// <param name="authReversalRequest"></param> /// <returns>PtsV2PaymentsReversalsPost201Response</returns> public PtsV2PaymentsReversalsPost201Response AuthReversal(string id, AuthReversalRequest authReversalRequest) { logger.Debug("CALLING API \"AuthReversal\" STARTED"); this.SetStatusCode(null); ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = AuthReversalWithHttpInfo(id, authReversalRequest); logger.Debug("CALLING API \"AuthReversal\" ENDED"); this.SetStatusCode(localVarResponse.StatusCode); return(localVarResponse.Data); }
public static void Run(IReadOnlyDictionary <string, string> configDictionary) { var requestObj = new AuthReversalRequest(); var v2PaymentsClientReferenceInformationObj = new V2paymentsidreversalsClientReferenceInformation { Code = "TC50171_1" }; requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj; // var v2paymentsOrderInformationObj = new V2paymentsidreversalsOrderInformation(); // var amountDetailsObj = new V2paymentsidreversalsOrderInformationAmountDetails(); // amountDetailsObj.Currency = "USD"; // v2paymentsOrderInformationObj.AmountDetails = amountDetailsObj; // requestObj.OrderInformation = v2paymentsOrderInformationObj; var reversalInformationObj = new V2paymentsidreversalsReversalInformation(); var amountDetailsObj = new V2paymentsidreversalsReversalInformationAmountDetails { TotalAmount = "3000.00" }; reversalInformationObj.AmountDetails = amountDetailsObj; requestObj.ReversalInformation = reversalInformationObj; var merchantConfig = new MerchantConfig(configDictionary) { RequestType = "POST", RequestTarget = "/pts/v2/payments/5305395916686582801541/reversals", RequestJsonData = JsonConvert.SerializeObject(requestObj) }; try { var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig); var apiInstance = new ReversalApi(configurationSwagger); var result = apiInstance.AuthReversal("5305395916686582801541", requestObj); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); } }
public static void Run(IReadOnlyDictionary <string, string> configDictionary) { var requestObj = new AuthReversalRequest(); var clientReferenceInformationObj = new V2paymentsidreversalsClientReferenceInformation("TC50171_1"); // var amount = new V2paymentsidreversalsOrderInformationLineItems(); // amount.Currency = "USD"; // var amountDetailsObj = new List<V2paymentsidreversalsOrderInformationLineItems> { amount }; // var orderInformationObj = new V2paymentsidreversalsOrderInformation(amountDetailsObj); var amountDetailsObj = new V2paymentsidreversalsReversalInformationAmountDetails { TotalAmount = "100.00" }; var reversalInformationObj = new V2paymentsidreversalsReversalInformation { AmountDetails = amountDetailsObj }; requestObj.ClientReferenceInformation = clientReferenceInformationObj; requestObj.ReversalInformation = reversalInformationObj; var merchantConfig = new MerchantConfig(configDictionary) { RequestType = "POST", RequestTarget = "/pts/v2/payments/5334411871436531903527/reversals", RequestJsonData = JsonConvert.SerializeObject(requestObj) }; try { var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig); var apiInstance = new ReversalApi(configurationSwagger); var result = apiInstance.AuthReversal("5334411871436531903527", requestObj); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); } }
public static PtsV2PaymentsReversalsPost201Response Run() { SimpleAuthorizationInternet.CaptureTrueForProcessPayment = false; var id = SimpleAuthorizationInternet.Run().Id; string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( Code: clientReferenceInformationCode ); string reversalInformationAmountDetailsTotalAmount = "102.21"; Ptsv2paymentsidreversalsReversalInformationAmountDetails reversalInformationAmountDetails = new Ptsv2paymentsidreversalsReversalInformationAmountDetails( TotalAmount: reversalInformationAmountDetailsTotalAmount ); string reversalInformationReason = "testing"; Ptsv2paymentsidreversalsReversalInformation reversalInformation = new Ptsv2paymentsidreversalsReversalInformation( AmountDetails: reversalInformationAmountDetails, Reason: reversalInformationReason ); var requestObj = new AuthReversalRequest( 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.AuthReversal(id, requestObj); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }
public static PtsV2PaymentsReversalsPost201Response Run() { var id = ServiceFeesWithCreditCardTransaction.Run().Id; string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( Code: clientReferenceInformationCode ); string reversalInformationAmountDetailsTotalAmount = "2325.00"; Ptsv2paymentsidreversalsReversalInformationAmountDetails reversalInformationAmountDetails = new Ptsv2paymentsidreversalsReversalInformationAmountDetails( TotalAmount: reversalInformationAmountDetailsTotalAmount ); string reversalInformationReason = "34"; Ptsv2paymentsidreversalsReversalInformation reversalInformation = new Ptsv2paymentsidreversalsReversalInformation( AmountDetails: reversalInformationAmountDetails, Reason: reversalInformationReason ); var requestObj = new AuthReversalRequest( 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.AuthReversal(id, requestObj); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }
/// <summary> /// Process an Authorization Reversal Include the payment ID in the POST request to reverse the payment amount. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The payment ID returned from a previous payment request.</param> /// <param name="authReversalRequest"></param> /// <returns>Task of ApiResponse (PtsV2PaymentsReversalsPost201Response)</returns> public async System.Threading.Tasks.Task <ApiResponse <PtsV2PaymentsReversalsPost201Response> > AuthReversalAsyncWithHttpInfo(string id, AuthReversalRequest authReversalRequest) { // verify the required parameter 'id' is set if (id == null) { throw new ApiException(400, "Missing required parameter 'id' when calling ReversalApi->AuthReversal"); } // verify the required parameter 'authReversalRequest' is set if (authReversalRequest == null) { throw new ApiException(400, "Missing required parameter 'authReversalRequest' when calling ReversalApi->AuthReversal"); } var localVarPath = $"/pts/v2/payments/{id}/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 (id != null) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } if (authReversalRequest != null && authReversalRequest.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(authReversalRequest); // http body (model) parameter } else { localVarPostBody = authReversalRequest; // 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("AuthReversal", 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)))); }
/// <summary> /// Process an Authorization Reversal Include the payment ID in the POST request to reverse the payment amount. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The payment ID returned from a previous payment request.</param> /// <param name="authReversalRequest"></param> /// <returns>Task of PtsV2PaymentsReversalsPost201Response</returns> public async System.Threading.Tasks.Task <PtsV2PaymentsReversalsPost201Response> AuthReversalAsync(string id, AuthReversalRequest authReversalRequest) { ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = await AuthReversalAsyncWithHttpInfo(id, authReversalRequest); return(localVarResponse.Data); }
/// <summary> /// Process an Authorization Reversal Include the payment ID in the POST request to reverse the payment amount. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The payment ID returned from a previous payment request.</param> /// <param name="authReversalRequest"></param> /// <returns>PtsV2PaymentsReversalsPost201Response</returns> public PtsV2PaymentsReversalsPost201Response AuthReversal(string id, AuthReversalRequest authReversalRequest) { ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = AuthReversalWithHttpInfo(id, authReversalRequest); return(localVarResponse.Data); }
/// <summary> /// Process an Authorization Reversal Include the payment ID in the POST request to reverse the payment amount. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The payment ID returned from a previous payment request.</param> /// <param name="authReversalRequest"></param> /// <returns>Task of PtsV2PaymentsReversalsPost201Response</returns> public async System.Threading.Tasks.Task <PtsV2PaymentsReversalsPost201Response> AuthReversalAsync(string id, AuthReversalRequest authReversalRequest) { logger.Debug("CALLING API \"AuthReversalAsync\" STARTED"); this.SetStatusCode(null); ApiResponse <PtsV2PaymentsReversalsPost201Response> localVarResponse = await AuthReversalAsyncWithHttpInfo(id, authReversalRequest); logger.Debug("CALLING API \"AuthReversalAsync\" ENDED"); this.SetStatusCode(localVarResponse.StatusCode); return(localVarResponse.Data); }
/// <summary> /// Process an Authorization Reversal Include the payment ID in the POST request to reverse the payment amount. /// </summary> /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="id">The payment ID returned from a previous payment request.</param> /// <param name="authReversalRequest"></param> /// <returns>ApiResponse of PtsV2PaymentsReversalsPost201Response</returns> public ApiResponse <PtsV2PaymentsReversalsPost201Response> AuthReversalWithHttpInfo(string id, AuthReversalRequest authReversalRequest) { LogUtility logUtility = new LogUtility(); // verify the required parameter 'id' is set if (id == null) { logger.Error("ApiException : Missing required parameter 'id' when calling ReversalApi->AuthReversal"); throw new ApiException(400, "Missing required parameter 'id' when calling ReversalApi->AuthReversal"); } // verify the required parameter 'authReversalRequest' is set if (authReversalRequest == null) { logger.Error("ApiException : Missing required parameter 'authReversalRequest' when calling ReversalApi->AuthReversal"); throw new ApiException(400, "Missing required parameter 'authReversalRequest' when calling ReversalApi->AuthReversal"); } var localVarPath = $"/pts/v2/payments/{id}/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 (id != null) { localVarPathParams.Add("id", Configuration.ApiClient.ParameterToString(id)); // path parameter } logger.Debug($"HTTP Request Body :\n{logUtility.ConvertDictionaryToString(localVarPathParams)}"); if (authReversalRequest != null && authReversalRequest.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(authReversalRequest); // http body (model) parameter } else { localVarPostBody = authReversalRequest; // 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("AuthReversal", 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 }