public void AddCustomer() { var newCustomer = new HpsPayPlanCustomer { CustomerStatus = HpsPayPlanCustomerStatus.Active, CustomerIdentifier = GenerateCustomerId(), FirstName = "Bill", LastName = "Johnson", Company = "Heartland Payment Systems", Country = "USA" }; var result = _payPlanService.AddCustomer(newCustomer); // Fluent version (to be fully implemented at a later date) // HpsPayPlanCustomer result = payPlanService.addCustomer(id, "Bill", "Johnson", "USA").withCity("Dallas").execute(); Assert.IsNotNull(result); Assert.IsNotNull(result.CustomerKey); }
public void recurring_001_AddCustomerPerson() { var customer = new HpsPayPlanCustomer { CustomerIdentifier = GetIdentifier("Person"), FirstName = "John", LastName = "Doe", CustomerStatus = HpsPayPlanCustomerStatus.Active, PrimaryEmail = "*****@*****.**", AddressLine1 = "123 Main St", City = "Dallas", StateProvince = "TX", ZipPostalCode = "98765", Country = "USA", PhoneDay = "5551112222" }; var response = _payPlanService.AddCustomer(customer); Assert.IsNotNull(response); Assert.IsNotNull(response.CustomerKey); _customerPersonKey = response.CustomerKey; }
public void AddPaymentMethodWithToken() { // Create Customer var customer = new HpsPayPlanCustomer { CustomerIdentifier = GetIdentifier("Person"), FirstName = "John", LastName = "Doe", CustomerStatus = HpsPayPlanCustomerStatus.Active, PrimaryEmail = "*****@*****.**", AddressLine1 = "123 Main St", City = "Dallas", StateProvince = "TX", ZipPostalCode = "98765", Country = "USA", PhoneDay = "5551112222" }; HpsPayPlanService payPlanService = new HpsPayPlanService(TestServicesConfig.ValidPayplanServiceConfig()); var response = payPlanService.AddCustomer(customer); var customerKey = response.CustomerKey; // Create Card & Token var card = new HpsCreditCard { Number = "4111111111111111", ExpMonth = 12, ExpYear = 2020, Cvv = "123" }; var tokenService = new HpsTokenService("pkapi_cert_jKc1FtuyAydZhZfbB3"); var tokenResponse = tokenService.GetToken(card); // Create & Add Payment via Token var newPaymentMethod = new HpsPayPlanPaymentMethod { CustomerKey = customerKey, NameOnAccount = "Bill Johnson", PaymentToken = tokenResponse.token_value, PaymentMethodType = HpsPayPlanPaymentMethodType.CreditCard, Country = "USA" }; var result = payPlanService.AddPaymentMethod(newPaymentMethod); Assert.IsNotNull(result); Assert.IsNotNull(result.PaymentMethodKey); }