コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: VoidPayment.cs プロジェクト: oscartorresGL/unaPay
        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);
            }
        }
コード例 #3
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var clientReferenceInformationObj = new V2paymentsidreversalsClientReferenceInformation("test_void");
            var requestObj = new VoidPaymentRequest(clientReferenceInformationObj);

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments/5335461889256917903529/voids",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new VoidApi(configurationSwagger);
                var result = apiInstance.VoidPayment(requestObj, "5335461889256917903529");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
コード例 #4
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new VoidPaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsidreversalsClientReferenceInformation
            {
                Code = "1234567890"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            /*
             * var v2paymentsPointOfSaleInformationObj = new V2paymentsPointOfSaleInformation();
             *
             * v2paymentsPointOfSaleInformationObj.CardPresent = "false";
             * v2paymentsPointOfSaleInformationObj.CatLevel = "6";
             * v2paymentsPointOfSaleInformationObj.TerminalCapability = "4";
             * requestObj.PointOfSaleInformation = v2paymentsPointOfSaleInformationObj;
             *
             * var v2paymentsOrderInformationObj = new V2paymentsOrderInformation();
             *
             * var v2paymentsOrderInformationBillToObj = new V2paymentsOrderInformationBillTo();
             *
             * v2paymentsOrderInformationBillToObj.Country = "US";
             * v2paymentsOrderInformationBillToObj.FirstName = "John";
             * v2paymentsOrderInformationBillToObj.LastName = "Deo";
             * v2paymentsOrderInformationBillToObj.Address1 = "901 Metro Center Blvd";
             * v2paymentsOrderInformationBillToObj.PostalCode = "40500";
             * v2paymentsOrderInformationBillToObj.Locality = "Foster City";
             * v2paymentsOrderInformationBillToObj.AdministrativeArea = "CA";
             * v2paymentsOrderInformationBillToObj.Email = "*****@*****.**";
             * v2paymentsOrderInformationObj.BillTo = v2paymentsOrderInformationBillToObj;
             *
             * var v2paymentsOrderInformationAmountDetailsObj = new V2paymentsOrderInformationAmountDetails();
             *
             * v2paymentsOrderInformationAmountDetailsObj.TotalAmount = "100";
             * v2paymentsOrderInformationAmountDetailsObj.Currency = "USD";
             * v2paymentsOrderInformationObj.AmountDetails = v2paymentsOrderInformationAmountDetailsObj;
             *
             * requestObj.OrderInformation = v2paymentsOrderInformationObj;
             */

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments/5335461889256917903529/voids",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new VoidApi(configurationSwagger);
                var result = apiInstance.VoidPayment(requestObj, "5335461889256917903529");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }