Exemplo n.º 1
0
        public void recurring_007_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"
            };

            _payPlanService.AddPaymentMethod(paymentMethod);
        }
Exemplo n.º 2
0
        public void recurring_004_AddPaymentCreditMasterCard()
        {
            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);

            _paymentMethodKeyMasterCard = response.PaymentMethodKey;
        }
Exemplo n.º 3
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;
        }
 private string EditCreditCard(HpsPayPlanPaymentMethod method)
 {
     var data = method.GetEditableFieldsWithValues();
     return DoRequest("PUT", "paymentMethodsCreditCard/" + method.PaymentMethodKey, data);
 }
        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));
        }
 private string AddCreditCard(HpsPayPlanPaymentMethod method)
 {
     var data = method.GetEditableFieldsWithValues();
     data.Add("customerKey", method.CustomerKey);
     if (!string.IsNullOrEmpty(method.AccountNumber))
         data.Add("accountNumber", method.AccountNumber);
     else if (!string.IsNullOrEmpty(method.PaymentToken))
         data.Add("paymentToken", method.PaymentToken);
     return DoRequest("POST", "paymentMethodsCreditCard", data);
 }
 private string AddAch(HpsPayPlanPaymentMethod method)
 {
     var data = method.GetEditableFieldsWithValues();
     data.Add("customerKey", method.CustomerKey);
     return DoRequest("POST", "paymentMethodsACH", data);
 }
        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 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));
        }
Exemplo n.º 10
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.ValidTokenServiceConfig());
            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);
        }