public static PtsV2PaymentsCapturesPost201Response Run() { ServiceFeesWithCreditCardTransaction.CaptureTrueForProcessPayment = false; var id = ServiceFeesWithCreditCardTransaction.Run().Id; string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode ); string orderInformationAmountDetailsTotalAmount = "2325.00"; string orderInformationAmountDetailsCurrency = "USD"; string orderInformationAmountDetailsServiceFeeAmount = "30.00"; Ptsv2paymentsidcapturesOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsidcapturesOrderInformationAmountDetails( TotalAmount: orderInformationAmountDetailsTotalAmount, Currency: orderInformationAmountDetailsCurrency, ServiceFeeAmount: orderInformationAmountDetailsServiceFeeAmount ); Ptsv2paymentsidcapturesOrderInformation orderInformation = new Ptsv2paymentsidcapturesOrderInformation( AmountDetails: orderInformationAmountDetails ); string merchantInformationServiceFeeDescriptorName = "Vacations Service Fee"; string merchantInformationServiceFeeDescriptorContact = "8009999999"; string merchantInformationServiceFeeDescriptorState = "CA"; Ptsv2paymentsMerchantInformationServiceFeeDescriptor merchantInformationServiceFeeDescriptor = new Ptsv2paymentsMerchantInformationServiceFeeDescriptor( Name: merchantInformationServiceFeeDescriptorName, Contact: merchantInformationServiceFeeDescriptorContact, State: merchantInformationServiceFeeDescriptorState ); Ptsv2paymentsidcapturesMerchantInformation merchantInformation = new Ptsv2paymentsidcapturesMerchantInformation( ServiceFeeDescriptor: merchantInformationServiceFeeDescriptor ); var requestObj = new CapturePaymentRequest( ClientReferenceInformation: clientReferenceInformation, OrderInformation: orderInformation, MerchantInformation: merchantInformation ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CaptureApi(clientConfig); PtsV2PaymentsCapturesPost201Response result = apiInstance.CapturePayment(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() { 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); } }