コード例 #1
0
        public void TestSales()
        {
            AppDomain.CurrentDomain.SetData("DataDirectory", ".\\App_Data");

            var profileDomain = new ProfileDomain();
            var profile = profileDomain.Get(1);

            var service = new CybersourcePaymentService();
            var result = service.Sales(profile, "4036255971830178147625", new models.TransactionRequest
            {
                Amount = 9900,
                Currency = "USD",
                CustomerPO = "1234",
                ReferenceNumber = "11223333",
                PaymentToken = "4030236031190176056428",
                ShipFrom = new models.Contact
                {
                    PostalCode = "91789",
                },
                ShipTo = new models.Contact { PostalCode = "91789" },
                TaxAmount = 0,
                TransactionType = models.TransactionTypes.Sales,
                LineItems = new System.Collections.Generic.List<models.LineItem> { new models.LineItem {
                    CommodityCode = "foo",
                    ProductCode = "code 1",
                    ProductDescription = "test product",
                    ProductName = "test",
                    ProductSKU = "",
                    Quantity = 1,
                    TaxAmount = 0,
                    TaxRate = 1,
                    UnitPrice = 100,
                }}

            });

            Assert.IsTrue(result.Status);
        }
コード例 #2
0
        public void TestVoid()
        {
            AppDomain.CurrentDomain.SetData("DataDirectory", ".\\App_Data");

            var profileDomain = new ProfileDomain();
            var profile = profileDomain.Get(1);

            var service = new CybersourcePaymentService();
            var result = service.Void(profile, "4029352006890176056442", "1234");
            Assert.IsTrue(result.Status);
        }