コード例 #1
0
    def test_add_with_token(self):
        token_service = HpsTokenService(
            TestServicesConfig.valid_pay_plan_config.public_key)

        card = HpsCreditCard()
        card.number = 4111111111111111
        card.exp_month = '12'
        card.exp_year = '2020'
        card.cvv = '123'

        token = token_service.get_token(card)
        if token.token_value is None:
            self.fail("cannot generate token")

        payment_method = HpsPayPlanPaymentMethod()
        payment_method.customer_key = self.customer.customer_key
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.CREDIT_CARD
        payment_method.name_on_account = 'Bill Johnson'
        payment_method.payment_token = token.token_value
        payment_method.expiration_date = '0120'
        payment_method.country = 'USA'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
コード例 #2
0
    def test_004_add_payment_credit_mastercard(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier('CreditMC')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.CREDIT_CARD
        payment_method.name_on_account = 'John Doe'
        payment_method.account_number = '5473500000000014'
        payment_method.expiration_date = '1225'
        payment_method.customer_key = self.__class__.customer_person_key
        payment_method.country = 'USA'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
        self.__class__.payment_method_key_mastercard = response.payment_method_key
コード例 #3
0
    def test_add(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.customer_key = self.customer.customer_key
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.CREDIT_CARD
        payment_method.name_on_account = 'Bill Johnson'
        payment_method.account_number = 4111111111111111
        payment_method.expiration_date = '0120'
        payment_method.country = 'USA'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
コード例 #4
0
    def test_004_add_payment_credit_mastercard(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier('CreditMC')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.CREDIT_CARD
        payment_method.name_on_account = 'John Doe'
        payment_method.account_number = '5473500000000014'
        payment_method.expiration_date = '1225'
        payment_method.customer_key = self.__class__.customer_person_key
        payment_method.country = 'USA'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
        self.__class__.payment_method_key_mastercard = response.payment_method_key
コード例 #5
0
    def test_add(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.customer_key = self.customer.customer_key
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.CREDIT_CARD
        payment_method.name_on_account = 'Bill Johnson'
        payment_method.account_number = 4111111111111111
        payment_method.expiration_date = '0120'
        payment_method.country = 'USA'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
コード例 #6
0
    def test_007_add_payment_check_ppd(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier('CheckPPD')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.ACH
        payment_method.ach_type = 'Checking'
        payment_method.account_type = 'Personal'
        payment_method.telephone_indicator = 0
        payment_method.routing_number = '490000050'
        payment_method.name_on_account = 'John Doe'
        payment_method.drivers_license_number = '7418529630'
        payment_method.account_number = '24413815'
        payment_method.address_line_1 = '123 Main St'
        payment_method.city = 'Dallas'
        payment_method.state_province = 'TX'
        payment_method.zip_postal_code = '98765'
        payment_method.customer_key = self.customer_person_key

        self.assertRaises(HpsException, self.service.add_payment_method, payment_method)
コード例 #7
0
    def test_006_add_payment_check_ccd(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier('CheckCCD')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.ACH
        payment_method.ach_type = 'Checking'
        payment_method.account_type = 'Business'
        payment_method.telephone_indicator = 0
        payment_method.routing_number = '490000018'
        payment_method.name_on_account = 'Acme Co'
        payment_method.drivers_license_number = '3692581470'
        payment_method.drivers_license_state = 'TX'
        payment_method.account_number = '24413815'
        payment_method.address_line_1 = '987 Elm St'
        payment_method.city = 'Princeton'
        payment_method.state_province = 'NJ'
        payment_method.zip_postal_code = '12345'
        payment_method.customer_key = self.__class__.customer_company_key
        payment_method.country = 'USA'
        payment_method.account_holder_yob = '1989'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
        self.__class__.payment_method_key_check_ccd = response.payment_method_key
コード例 #8
0
    def test_005_add_payment_check_ppd(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier('CheckPPD')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.ACH
        payment_method.ach_type = 'Checking'
        payment_method.account_type = 'Personal'
        payment_method.telephone_indicator = 0
        payment_method.routing_number = '490000018'
        payment_method.name_on_account = 'John Doe'
        payment_method.drivers_license_number = '7418529630'
        payment_method.drivers_license_state = 'TX'
        payment_method.account_number = '24413815'
        payment_method.address_line_1 = '123 Main St'
        payment_method.city = 'Dallas'
        payment_method.state_province = 'TX'
        payment_method.zip_postal_code = '98765'
        payment_method.customer_key = self.__class__.customer_person_key
        payment_method.country = 'USA'
        payment_method.account_holder_yob = '1989'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
        self.__class__.payment_method_key_check_ppd = response.payment_method_key
コード例 #9
0
    def test_007_add_payment_check_ppd(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier(
            'CheckPPD')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.ACH
        payment_method.ach_type = 'Checking'
        payment_method.account_type = 'Personal'
        payment_method.telephone_indicator = 0
        payment_method.routing_number = '490000050'
        payment_method.name_on_account = 'John Doe'
        payment_method.drivers_license_number = '7418529630'
        payment_method.account_number = '24413815'
        payment_method.address_line_1 = '123 Main St'
        payment_method.city = 'Dallas'
        payment_method.state_province = 'TX'
        payment_method.zip_postal_code = '98765'
        payment_method.customer_key = self.customer_person_key

        self.assertRaises(HpsException, self.service.add_payment_method,
                          payment_method)
コード例 #10
0
    def test_006_add_payment_check_ccd(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier(
            'CheckCCD')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.ACH
        payment_method.ach_type = 'Checking'
        payment_method.account_type = 'Business'
        payment_method.telephone_indicator = 0
        payment_method.routing_number = '490000018'
        payment_method.name_on_account = 'Acme Co'
        payment_method.drivers_license_number = '3692581470'
        payment_method.drivers_license_state = 'TX'
        payment_method.account_number = '24413815'
        payment_method.address_line_1 = '987 Elm St'
        payment_method.city = 'Princeton'
        payment_method.state_province = 'NJ'
        payment_method.zip_postal_code = '12345'
        payment_method.customer_key = self.__class__.customer_company_key
        payment_method.country = 'USA'
        payment_method.account_holder_yob = '1989'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
        self.__class__.payment_method_key_check_ccd = response.payment_method_key
コード例 #11
0
    def test_005_add_payment_check_ppd(self):
        payment_method = HpsPayPlanPaymentMethod()
        payment_method.payment_method_identifier = self.get_identifier(
            'CheckPPD')
        payment_method.payment_method_type = HpsPayPlanPaymentMethodType.ACH
        payment_method.ach_type = 'Checking'
        payment_method.account_type = 'Personal'
        payment_method.telephone_indicator = 0
        payment_method.routing_number = '490000018'
        payment_method.name_on_account = 'John Doe'
        payment_method.drivers_license_number = '7418529630'
        payment_method.drivers_license_state = 'TX'
        payment_method.account_number = '24413815'
        payment_method.address_line_1 = '123 Main St'
        payment_method.city = 'Dallas'
        payment_method.state_province = 'TX'
        payment_method.zip_postal_code = '98765'
        payment_method.customer_key = self.__class__.customer_person_key
        payment_method.country = 'USA'
        payment_method.account_holder_yob = '1989'

        response = self.service.add_payment_method(payment_method)
        self.assertIsNotNone(response)
        self.assertIsNotNone(response.payment_method_key)
        self.__class__.payment_method_key_check_ppd = response.payment_method_key