Beispiel #1
0
        public void recurring_003_AddPaymentCreditVisa()
        {
            if (_customerPersonKey == null)
            {
                Assert.Inconclusive();
            }

            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);
            Assert.IsNotNull(response.CreationDate);

            _paymentMethodKeyVisa = response.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);
        }
        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);
        }