public void Run() { var request = new StoreCreditCard { CustomerId = 1, Number = "4111 1111 1111 1111", ExpirationDateYear = (DateTime.UtcNow.Year + 1).ToString(), ExpirationDateMonth = "11", Name = "Keith Palmer", Address = "72 E Blue Grass Road", City = "Willington", State = "CT", PostalCode = "06279", Country = "United States", }; var result = _service.StoreCreditCard(request); if (!result.IsSuccess()) { throw new Exception("Store credit card failed."); } Console.WriteLine("Credit card with id: " + result.Id); }
private int AddCard() { var request = new StoreCreditCard { CustomerId = 1, Number = "4111 1111 1111 1111", ExpirationDateYear = (DateTime.UtcNow.Year + 1).ToString(), ExpirationDateMonth = "11", Name = "Keith Palmer", Address = "72 E Blue Grass Road", City = "Willington", //state = "CT" PostalCode = "06279", Country = "United States", }; //act return(Sut.StoreCreditCard(request).Id); }
public void Save(DTO.StoreCreditCard credicard) { var _credicard = new StoreCreditCard(credicard); if (_credicard.IsValid()) { using (var transaction = Connection.BeginTransaction()) { try { creditCardRepository.Save(_credicard); transaction.Commit(); } catch { transaction.Rollback(); throw; } } } }
public void should_call_StoreCreditCard() { //arrange var request = new StoreCreditCard { CustomerId = 1, Number = "4111 1111 1111 1111", ExpirationDateYear = (DateTime.UtcNow.Year + 1).ToString(), ExpirationDateMonth = "11", Name = "Keith Palmer", Address = "72 E Blue Grass Road", City = "Willington", //state = "CT" PostalCode = "06279", Country = "United States", }; //act var actual = Sut.StoreCreditCard(request); //assert Assert.AreEqual(201, actual.Code); Assert.IsEmpty(actual.Message); Assert.AreEqual("OK", actual.Status); }
/// <summary> /// Store a credit card /// details: https://developer.chargeover.com/apidocs/rest/#create-card /// </summary> public IIdentityResponse StoreCreditCard(StoreCreditCard request) { return(Create("creditcard", request)); }