Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        public static PtsV2PaymentsRefundPost201Response Run()
        {
            ProcessPayment.CaptureTrueForProcessPayment = true;
            var processPaymentId = ProcessPayment.Run().Id;

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation("test_refund_payment");
            var amountDetailsObj    = new Ptsv2paymentsidcapturesOrderInformationAmountDetails("10", "USD");
            var orderInformationObj = new Ptsv2paymentsidrefundsOrderInformation(amountDetailsObj);
            var requestBody         = new RefundPaymentRequest(clientReferenceInformationObj, null, null, orderInformationObj);

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

                var result = apiInstance.RefundPayment(requestBody, processPaymentId);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
        public static PtsV2PaymentsCapturesPost201Response Run()
        {
            var processPaymentId = ProcessPayment.Run().Id;

            var requestObj = new CapturePaymentRequest();

            var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation
            {
                Code = "test_capture"
            };

            requestObj.ClientReferenceInformation = clientReferenceInformationObj;

            var orderInformationObj = new Ptsv2paymentsidcapturesOrderInformation();

            var billToObj = new Ptsv2paymentsidcapturesOrderInformationBillTo
            {
                Country            = "US",
                FirstName          = "John",
                LastName           = "Doe",
                Address1           = "1 Market St",
                PostalCode         = "94105",
                Locality           = "San Francisco",
                AdministrativeArea = "CA",
                Email = "*****@*****.**"
            };

            orderInformationObj.BillTo = billToObj;

            var amountDetailsObj = new Ptsv2paymentsidcapturesOrderInformationAmountDetails
            {
                TotalAmount = "102.21",
                Currency    = "USD"
            };

            orderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = orderInformationObj;

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

                var result = apiInstance.CapturePayment(requestObj, processPaymentId);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
                return(null);
            }
        }
Beispiel #4
0
        public static void Run()
        {
            ProcessPayment.CaptureTrueForProcessPayment = true;
            var processPaymentId = ProcessPayment.Run().Id;
            var clientReferenceInformationObj = new Ptsv2paymentsidreversalsClientReferenceInformation("test_payment_void");
            var requestObj = new VoidPaymentRequest(clientReferenceInformationObj);

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

                var result = apiInstance.VoidPayment(requestObj, processPaymentId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }