public HpsPayPlanCustomer DeleteCustomer(HpsPayPlanCustomer customer, bool forceDelete = false) { if (customer == null) { throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument, "customer must be an instance of HpsPayPlanCustomer.", "customer"); } return(DeleteCustomer(customer.CustomerKey, forceDelete)); }
public HpsPayPlanCustomer GetCustomer(HpsPayPlanCustomer customer) { if (customer == null) { throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument, "customer must be an instance of HpsPayPlanCustomer.", "customer"); } return(GetCustomer(customer.CustomerKey)); }
public HpsPayPlanCustomer EditCustomer(HpsPayPlanCustomer customer) { if (customer == null) { throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument, "customer must be an instance of HpsPayPlanCustomer.", "customer"); } var response = DoRequest("PUT", "customers/" + customer.CustomerKey, customer.GetEditableFieldsWithValues()); return(HydrateObject <HpsPayPlanCustomer>(response)); }
/* CUSTOMER METHODS */ public HpsPayPlanCustomer AddCustomer(HpsPayPlanCustomer customer) { if (customer == null) { throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument, "Customer must be an instance of HpsPayPlanCustomer.", "customer"); } var response = DoRequest("POST", "customers", customer); return(HydrateObject <HpsPayPlanCustomer>(response)); }
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); }
public static HpsPayPlanCustomer Map(PayPlanCustomer dto) { var result = new HpsPayPlanCustomer { Company = dto.Company, CustomerId = dto.CustomerIdentifier, CustomerStatus = dto.CustomerStatus == "Active" ? HpsPayPlanCustomerStatus.Active : HpsPayPlanCustomerStatus.Inactive, Department = dto.Department, Fax = dto.Fax, PhoneEvening = dto.PhoneEvening, PhoneEveningExt = dto.PhoneEveningExt, PhoneExt = dto.PhoneDayExt, PhoneMobile = dto.PhoneMobile, PhoneMobileExt = dto.PhoneMobileExt, SecondaryEmail = dto.SecondaryEmail, Title = dto.Title }; return((HpsPayPlanCustomer)HydrateConsumerInfo(dto, result)); }
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 static HpsPayPlanCustomer Map(PayPlanCustomer dto) { var result = new HpsPayPlanCustomer { Company = dto.Company, CustomerId = dto.CustomerIdentifier, CustomerStatus = dto.CustomerStatus == "Active" ? HpsPayPlanCustomerStatus.Active : HpsPayPlanCustomerStatus.Inactive, Department = dto.Department, Fax = dto.Fax, PhoneEvening = dto.PhoneEvening, PhoneEveningExt = dto.PhoneEveningExt, PhoneExt = dto.PhoneDayExt, PhoneMobile = dto.PhoneMobile, PhoneMobileExt = dto.PhoneMobileExt, SecondaryEmail = dto.SecondaryEmail, Title = dto.Title }; return (HpsPayPlanCustomer)HydrateConsumerInfo(dto, result); }
public void recurring_002_AddCustomerBusiness() { var customer = new HpsPayPlanCustomer { CustomerIdentifier = GetIdentifier("Business"), Company = "AcmeCo", CustomerStatus = HpsPayPlanCustomerStatus.Active, PrimaryEmail = "*****@*****.**", AddressLine1 = "987 Elm St", City = "Princeton", StateProvince = "NJ", ZipPostalCode = "12345", Country = "USA", PhoneDay = "5551112222" }; var response = _payPlanService.AddCustomer(customer); Assert.IsNotNull(response); Assert.IsNotNull(response.CustomerKey); _customerCompanyKey = response.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 PaymentMethod() { _payPlanService.SetPagination(1, 0); _customer = _payPlanService.FindAllCustomers().Results[0]; }