示例#1
0
        public void recurring_006_AddPaymentCheckCCD()
        {
            var paymentMethod = new HpsPayPlanPaymentMethod {
                PaymentMethodIdentifier = GetIdentifier("CheckCCD"),
                PaymentMethodType       = HpsPayPlanPaymentMethodType.Ach,
                AchType              = "Checking",
                AccountType          = "Business",
                TelephoneIndicator   = 0,
                RoutingNumber        = "490000018",
                NameOnAccount        = "Acme Co",
                DriversLicenseNumber = "3692581470",
                DriversLicenseState  = "TX",
                AccountNumber        = "24413815",
                AddressLine1         = "987 Elm St",
                City             = "Princeton",
                StateProvince    = "NJ",
                ZipPostalCode    = "13245",
                CustomerKey      = _customerCompanyKey,
                Country          = "USA",
                AccountHolderYob = "1989"
            };

            var response = _payPlanService.AddPaymentMethod(paymentMethod);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.PaymentMethodKey);

            _paymentMethodKeyCheckCcd = response.PaymentMethodKey;
        }
示例#2
0
        public void recurring_004_AddPaymentCreditMasterCard()
        {
            if (_customerPersonKey == null)
            {
                Assert.Inconclusive();
            }

            var paymentMethod = new HpsPayPlanPaymentMethod {
                PaymentMethodIdentifier = GetIdentifier("CreditMC"),
                PaymentMethodType       = HpsPayPlanPaymentMethodType.CreditCard,
                NameOnAccount           = "John Doe",
                AccountNumber           = "5473500000000014",
                ExpirationDate          = "1225",
                CustomerKey             = _customerPersonKey,
                Country = "USA"
            };

            var response = _payPlanService.AddPaymentMethod(paymentMethod);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.PaymentMethodKey);
            Assert.IsNotNull(response.CreationDate);

            _paymentMethodKeyMasterCard = response.PaymentMethodKey;
        }
示例#3
0
        public void recurring_005_AddPaymentCheckPPD()
        {
            var paymentMethod = new HpsPayPlanPaymentMethod {
                PaymentMethodIdentifier = GetIdentifier("CheckPPD"),
                PaymentMethodType       = HpsPayPlanPaymentMethodType.Ach,
                AchType              = "Checking",
                AccountType          = "Personal",
                TelephoneIndicator   = 0,
                RoutingNumber        = "490000018",
                NameOnAccount        = "John Doe",
                DriversLicenseNumber = "7418529630",
                DriversLicenseState  = "TX",
                AccountNumber        = "24413815",
                AddressLine1         = "123 Main St",
                City             = "Dallas",
                StateProvince    = "TX",
                ZipPostalCode    = "98765",
                CustomerKey      = _customerPersonKey,
                Country          = "USA",
                AccountHolderYob = "1989"
            };

            var response = _payPlanService.AddPaymentMethod(paymentMethod);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.PaymentMethodKey);

            _paymentMethodKeyCheckPpd = response.PaymentMethodKey;
        }
示例#4
0
        public void recurring_007_AddPaymentCheckPPD()
        {
            if (_customerPersonKey == null)
            {
                Assert.Inconclusive();
            }

            try {
                var paymentMethod = new HpsPayPlanPaymentMethod {
                    PaymentMethodIdentifier = GetIdentifier("CheckPPD"),
                    PaymentMethodType       = HpsPayPlanPaymentMethodType.Ach,
                    AchType              = "Checking",
                    AccountType          = "Personal",
                    TelephoneIndicator   = false,
                    RoutingNumber        = "490000018",
                    NameOnAccount        = "John Doe",
                    DriversLicenseNumber = "7418529630",
                    DriversLicenseState  = "TX",
                    AccountNumber        = "24413815",
                    AddressLine1         = "123 Main St",
                    City             = "Dallas",
                    StateProvince    = "TX",
                    ZipPostalCode    = "98765",
                    CustomerKey      = _customerPersonKey,
                    Country          = "USA",
                    AccountHolderYob = "1989"
                };

                _payPlanService.AddPaymentMethod(paymentMethod);
            }
            catch (HpsException) {}
        }
        private string AddAch(HpsPayPlanPaymentMethod method)
        {
            var data = method.GetEditableFieldsWithValues();

            data.Add("customerKey", method.CustomerKey);
            return(DoRequest("POST", "paymentMethodsACH", data));
        }
        private string AddCreditCard(HpsPayPlanPaymentMethod method)
        {
            var data = method.GetEditableFieldsWithValues();

            data.Add("customerKey", method.CustomerKey);
            data.Add("accountNumber", method.AccountNumber);
            return(DoRequest("POST", "paymentMethodsCreditCard", data));
        }
        private string EditAch(HpsPayPlanPaymentMethod method)
        {
            var data     = method.GetEditableFieldsWithValues();
            var response = DoRequest("PUT", "paymentMethodsACH/" + method.PaymentMethodKey, data, _authHeader, _pagination);

            ResetPagination();
            return(response);
        }
        public HpsPayPlanPaymentMethod DeletePaymentMethod(HpsPayPlanPaymentMethod method, bool forceDelete = false)
        {
            if (method == null)
            {
                throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument,
                                                     "method must be an instance of HpsPayPlanPaymentMethod.", "method");
            }

            return(DeletePaymentMethod(method.PaymentMethodKey, forceDelete));
        }
        public HpsPayPlanPaymentMethod GetPaymentMethod(HpsPayPlanPaymentMethod method)
        {
            if (method == null)
            {
                throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument,
                                                     "method must be an instance of HpsPayPlanPaymentMethod.", "method");
            }

            return(HydrateObject <HpsPayPlanPaymentMethod>(DoRequest("GET", "paymentMethods/" + method.PaymentMethodKey)));
        }
        public HpsPayPlanPaymentMethod EditPaymentMethod(HpsPayPlanPaymentMethod method)
        {
            if (method == null)
            {
                throw new HpsInvalidRequestException(HpsExceptionCodes.InvalidArgument,
                                                     "method must be an instance of HpsPayPlanPaymentMethod.", "method");
            }

            return(HydrateObject <HpsPayPlanPaymentMethod>(method.PaymentMethodType.Equals(HpsPayPlanPaymentMethodType.Ach) ?
                                                           EditAch(method) : EditCreditCard(method)));
        }
        private string AddAch(HpsPayPlanPaymentMethod method)
        {
            var data = method.GetEditableFieldsWithValues();

            data.Add("customerKey", method.CustomerKey);

            var response = DoRequest("POST", "paymentMethodsACH", data, _authHeader, _pagination);

            ResetPagination();
            return(response);
        }
示例#12
0
        public Schedule()
        {
            _payPlanService.SetPagination(1, 0);
            var searchFilters = new Dictionary<string, object>
            {
                {"customerIdentifier", "SecureSubmit"},
                {"paymentStatus", HpsPayPlanCustomerStatus.Active}
            };

            var paymentMethods = _payPlanService.FindAllPaymentMethods(searchFilters);
            _paymentMethod = paymentMethods.Results[0];
        }
示例#13
0
        public Schedule()
        {
            _payPlanService.SetPagination(1, 0);
            var searchFilters = new Dictionary <string, object>
            {
                { "customerIdentifier", "SecureSubmit" },
                { "paymentStatus", HpsPayPlanCustomerStatus.Active }
            };

            var paymentMethods = _payPlanService.FindAllPaymentMethods(searchFilters);

            _paymentMethod = paymentMethods.Results[0];
        }
示例#14
0
        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 void AddPaymentMethod()
        {
            var paymentMethod = new HpsPayPlanPaymentMethod
            {
                CustomerKey = _customer.CustomerKey,
                PaymentMethodType = HpsPayPlanPaymentMethodType.CreditCard,
                NameOnAccount = string.Format("{0} {1}", _customer.FirstName, _customer.LastName),
                AccountNumber = "4111111111111111",
                ExpirationDate = "0120",
                Country = "USA"
            };

            var result = _payPlanService.AddPaymentMethod(paymentMethod);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.PaymentMethodKey);
        }
示例#16
0
        public void AddPaymentMethod()
        {
            var paymentMethod = new HpsPayPlanPaymentMethod
            {
                CustomerKey       = _customer.CustomerKey,
                PaymentMethodType = HpsPayPlanPaymentMethodType.CreditCard,
                NameOnAccount     = string.Format("{0} {1}", _customer.FirstName, _customer.LastName),
                AccountNumber     = "4111111111111111",
                ExpirationDate    = "0120",
                Country           = "USA"
            };

            var result = _payPlanService.AddPaymentMethod(paymentMethod);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.PaymentMethodKey);
        }
示例#17
0
        public void recurring_003_AddPaymentCreditVisa()
        {
            var paymentMethod = new HpsPayPlanPaymentMethod {
                PaymentMethodIdentifier = GetIdentifier("CreditV"),
                PaymentMethodType       = HpsPayPlanPaymentMethodType.CreditCard,
                NameOnAccount           = "John Doe",
                AccountNumber           = "4012002000060016",
                ExpirationDate          = "1225",
                CustomerKey             = _customerPersonKey,
                Country = "USA"
            };

            var response = _payPlanService.AddPaymentMethod(paymentMethod);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.PaymentMethodKey);

            _paymentMethodKeyVisa = response.PaymentMethodKey;
        }
        private string AddCreditCard(HpsPayPlanPaymentMethod method)
        {
            var data = method.GetEditableFieldsWithValues();

            data.Add("customerKey", method.CustomerKey);
            if (!string.IsNullOrEmpty(method.AccountNumber))
            {
                data.Add("accountNumber", method.AccountNumber);
                if (!string.IsNullOrEmpty(method.CVV))
                {
                    data.Add("cardVerificationValue", method.CVV);
                }
            }
            else if (!string.IsNullOrEmpty(method.PaymentToken))
            {
                data.Add("paymentToken", method.PaymentToken);
            }

            var response = DoRequest("POST", "paymentMethodsCreditCard", data, _authHeader, _pagination);

            ResetPagination();
            return(response);
        }
        private string EditCreditCard(HpsPayPlanPaymentMethod method)
        {
            var data = method.GetEditableFieldsWithValues();

            return(DoRequest("PUT", "paymentMethodsCreditCard/" + method.PaymentMethodKey, data));
        }