public void MasterCard_WhenCardIsOkAndIncludesDetails_ShouldReturnValidResult() { var service = new HpsCreditService(TestServicesConfig.ValidServicesConfig()); var charge = service.Charge(50, "usd", TestCreditCard.ValidMasterCard, TestCardHolder.ValidCardHolder, false, "descriptor", true, new HpsTransactionDetails { Memo = "memo", InvoiceNumber = "1234", CustomerId = "customerID", ClientTransactionId = 12345678 }); Assert.IsNotNull(charge); StringAssert.Matches(charge.ResponseCode, new Regex("00")); var transaction = service.Get(charge.TransactionId); Assert.IsNotNull(transaction); StringAssert.Matches(transaction.Memo, new Regex("memo")); StringAssert.Matches(transaction.InvoiceNumber, new Regex("1234")); StringAssert.Matches(transaction.CustomerId, new Regex("customerID")); Assert.AreEqual(charge.ClientTransactionId, 12345678); }
public void GetFirst_WhenConfigValid_ShouldGetTheFirstCharge() { var chargeSvc = new HpsCreditService(TestServicesConfig.ValidSecretKeyConfig()); var items = chargeSvc.List(DateTime.Today.AddDays(-10), DateTime.Today); if (items.Count <= 0) return; var charge = chargeSvc.Get(items[0].TransactionId); Assert.IsNotNull(charge); }