public void TestCreateCardFromToken() { var t = _defaultService.CreateToken(new TokenOptions() { Type = "card", CardNumber = "4242424242424242", CardExpirationMonth = 12, CardExpirationYear = 2020, Name = "A Customer", Address1 = "123 Payments Way", PostalCode = "78730", Reference = "Customer456" }); Assert.NotNull(t.Id); var c = _defaultService.CreateCard(new SavedPaymentFromTokenOptions() { TokenId = t.Id }); Assert.IsTrue(c.Number == "************4242"); Assert.IsTrue(c.CardType == "VISA"); Assert.IsTrue(c.ExpMonth == 12); Assert.IsTrue(c.ExpYear == 2020); Assert.AreEqual("A Customer", c.Name); Assert.AreEqual("123 Payments Way", c.Address1); Assert.AreEqual("78730", c.PostalCode); Assert.AreEqual("Customer456", c.Reference); }
public void TestHolds() { var token = _paymentMethodService.CreateToken(new TokenOptions() { Type = "card", CardNumber = "378282246310005", CardCvv = "123", CardExpirationMonth = 12, CardExpirationYear = 2020, Name = "A Customer", Address1 = "123 Main Dr", City = "Austin", State = "TX", PostalCode = "78759", Country = "US" }); var charge = _transactionService.Authorize(new ChargeOptions() { AmountInCents = 100, Currency = "USD", Reference = "a new invoice", Method = new TokenReferenceOptions() { TokenId = token.Id } }); Assert.IsTrue(charge.Status == "AUTHORIZED"); Assert.IsTrue(charge.AutoCapture == false); var holds = _transactionService.Holds(); Assert.IsTrue(holds.TotalEntries >= 1); Assert.AreEqual(charge.Id, holds[0].Id); charge = _transactionService.Capture(charge.Id, new CaptureOptions() { AmountInCents = 100, CaptureTime = "NEXT_AUTO_CAPTURE" }); Assert.AreEqual("AUTHORIZED", charge.Status); Assert.IsTrue(charge.AutoCapture); holds = _transactionService.Holds(); Assert.IsTrue(holds.TotalEntries >= 0); Assert.AreNotEqual(charge.Id, holds[0].Id); }