public static PtsV2PaymentsVoidsPost201Response Run() { SimpleAuthorizationInternet.CaptureTrueForProcessPayment = true; var id = SimpleAuthorizationInternet.Run().Id; string clientReferenceInformationCode = "test_void"; Ptsv2paymentsidreversalsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsidreversalsClientReferenceInformation( Code: clientReferenceInformationCode ); var requestObj = new VoidPaymentRequest( ClientReferenceInformation: clientReferenceInformation ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new VoidApi(clientConfig); PtsV2PaymentsVoidsPost201Response result = apiInstance.VoidPayment(requestObj, id); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }
public static PtsV2PaymentsRefundPost201Response Run() { SimpleAuthorizationInternet.CaptureTrueForProcessPayment = true; var id = SimpleAuthorizationInternet.Run().Id; string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode ); string orderInformationAmountDetailsTotalAmount = "10"; string orderInformationAmountDetailsCurrency = "USD"; Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails( TotalAmount: orderInformationAmountDetailsTotalAmount, Currency: orderInformationAmountDetailsCurrency ); Ptsv2paymentsidrefundsOrderInformation orderInformation = new Ptsv2paymentsidrefundsOrderInformation( AmountDetails: orderInformationAmountDetails ); var requestObj = new RefundPaymentRequest( ClientReferenceInformation: clientReferenceInformation, OrderInformation: orderInformation ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new RefundApi(clientConfig); PtsV2PaymentsRefundPost201Response result = apiInstance.RefundPayment(requestObj, id); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }
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); } }