public void CreateTokenWithFutureExpirationDateTest() { AppDomain.CurrentDomain.SetData("DataDirectory", ".\\App_Data"); var profileDomain = new ProfileDomain(); var profile = profileDomain.Get(1); var service = new CybersourceTokenService(); var result = service.Create(profile, new models.CreditCard() { CardType = "001", CardNumber = "", ExpirationMonth = "02", ExpirationYear = "2019" }, new models.Contact { FirstName = "john", LastName = "doe", City = "glendora", Country = "US", EmailAddress = "[email protected] ", PostalCode = "91789", State = "CA", StreetLine1 = "foo street", }, DateTime.Now.Ticks.ToString() ); Assert.IsTrue(result.Status); DeleteToken(result.Token); }
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); }
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); }
public void UpdateTokenTest() { AppDomain.CurrentDomain.SetData("DataDirectory", ".\\App_Data"); var token = CreateToken(); var profileDomain = new ProfileDomain(); var profile = profileDomain.Get(1); var service = new CybersourceTokenService(); var result = service.Update(profile, token, new models.CreditCard { ExpirationMonth = "01", ExpirationYear = "2019", }); Assert.IsTrue(result.Status); var detail = service.Get(profile, token); Assert.IsTrue(detail.Status); Assert.AreEqual(detail.CreditCard.ExpirationMonth, "01"); Assert.AreEqual(detail.CreditCard.ExpirationYear, "2019"); DeleteToken(token); }
public void DeleteTokenTest() { AppDomain.CurrentDomain.SetData("DataDirectory", ".\\App_Data"); var token = CreateToken(); var profileDomain = new ProfileDomain(); var profile = profileDomain.Get(1); var service = new CybersourceTokenService(); var result = service.Delete(profile, token); Assert.IsTrue(result.Status); }
private string CreateToken() { AppDomain.CurrentDomain.SetData("DataDirectory", ".\\App_Data"); var profileDomain = new ProfileDomain(); var profile = profileDomain.Get(1); var service = new CybersourceTokenService(); var result = service.Create(profile, new models.CreditCard() { CardType = "001", CardNumber = "4111111111111111", ExpirationMonth = "01", ExpirationYear = "2019" }, new models.Contact { FirstName = "john", LastName = "doe", City = "glendora", Country = "US", EmailAddress = "*****@*****.**", PostalCode = "91789", State = "CA", StreetLine1 = "foo street", }, DateTime.Now.Ticks.ToString()); return result.Token; }