Ejemplo n.º 1
0
    def test_021_level_ii_response_b(self):
        card = TestCards.visa_manual()

        address = Address()
        address.street_address_1 = '6860 Dallas Pkwy'
        address.postal_code = '750241234'

        response = card.charge(112.34) \
            .with_currency('USD') \
            .with_address(address) \
            .with_commercial_request(True) \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
        self.assertEqual('B', response.commercial_indicator)

        cpc_response = response.edit() \
            .with_po_number('9876543210') \
            .with_tax_type(TaxType.NotUsed) \
            .execute('ecommerce')

        self.assertNotEqual(None, cpc_response)
        self.assertEqual('00', cpc_response.response_code,
                         cpc_response.response_message)
Ejemplo n.º 2
0
    def test_026_level_ii_response_s(self):
        card = TestCards.mastercard_manual()

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '75024'

        response = card.charge(111.07) \
            .with_currency('USD') \
            .with_address(address) \
            .with_commercial_request(True) \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
        self.assertEqual('S', response.commercial_indicator)

        cpc_response = response.edit() \
            .with_tax_type(TaxType.SalesTax) \
            .with_tax_amount(1.00) \
            .execute('ecommerce')

        self.assertNotEqual(None, cpc_response)
        self.assertEqual('00', cpc_response.response_code,
                         cpc_response.response_message)
Ejemplo n.º 3
0
    def test_010_charge_visa(self):
        global visa_token

        card = TestCards.visa_manual()

        address = Address()
        address.street_address_1 = '6860 Dallas Pkwy'
        address.postal_code = '75024'

        if self.use_tokens:
            card = CreditCardData()
            card.token = visa_token

        response = card.charge(17.01) \
            .with_currency('USD') \
            .with_address(address) \
            .with_invoice_number('123456') \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

        void_response = response.void().execute('ecommerce')

        self.assertNotEqual(None, void_response)
        self.assertEqual('00', void_response.response_code,
                         void_response.response_message)
Ejemplo n.º 4
0
    def test_032_level_ii_no_response(self):
        card = TestCards.amex_manual()

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '75024'

        response = card.charge(111.13) \
            .with_currency('USD') \
            .with_address(address) \
            .with_commercial_request(True) \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
        self.assertEqual('0', response.commercial_indicator)

        cpc_response = response.edit() \
            .with_po_number('9876543210') \
            .with_tax_type(TaxType.TaxExempt) \
            .execute('ecommerce')

        self.assertNotEqual(None, cpc_response)
        self.assertEqual('00', cpc_response.response_code,
                         cpc_response.response_message)
Ejemplo n.º 5
0
    def test_037_balance_inquiry_gsb(self):
        card = TestCards.gsb_manual()

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '75024'

        response = card.balance_inquiry() \
            .with_address(address) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 6
0
    def test_004_verify_amex(self):
        card = TestCards.amex_manual()

        address = Address()
        address.postal_code = '75024'

        response = card.verify() \
            .with_address(address) \
            .with_request_multi_use_token(self.use_tokens) \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 7
0
    def test_040_charge_gsb(self):
        card = TestCards.gsb_manual()

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '75024'

        response = card.charge(2.10) \
            .with_currency('USD') \
            .with_address(address) \
            .with_invoice_number('123456') \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 8
0
    def test_038_add_value_gsb(self):
        card = CreditTrackData()
        card.value = '%B6277220572999800^   /                         ^49121010557010000016000000?F;6277220572999800=49121010557010000016?'

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '75024'

        response = card.add_value(15.00) \
            .with_currency('USD') \
            .with_address(address) \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 9
0
    def test_017_autorize_discover(self):
        # 017a authorization
        card = TestCards.discover_manual()

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '75024'

        response = card.authorize(17.08) \
            .with_currency('USD') \
            .with_address(address) \
            .with_invoice_number('123456') \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 10
0
    def test_020_partial_approval_mastercard(self):
        card = TestCards.mastercard_manual()

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '75024'

        response = card.charge(155) \
            .with_currency('USD') \
            .with_address(address) \
            .with_invoice_number('123456') \
            .with_allow_partial_auth(True) \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('10', response.response_code,
                         response.response_message)
        self.assertNotEqual(None, response.authorized_amount)
        self.assertEqual('100.00', response.authorized_amount)
Ejemplo n.º 11
0
    def test_009_charge_amex_token(self):
        global amex_token

        card = TestCards.amex_manual()

        address = Address()
        address.street_address_1 = '6860 Dallas Pkwy'
        address.postal_code = '75024'

        response = card.charge(13.04) \
            .with_currency('USD') \
            .with_address(address) \
            .with_request_multi_use_token(True) \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
        self.assertNotEqual(None, response.token)

        amex_token = response.token
Ejemplo n.º 12
0
    def test_012_charge_discover(self):
        global discover_token

        card = TestCards.discover_manual()

        address = Address()
        address.street_address_1 = '6860'
        address.postal_code = '750241234'

        if self.use_tokens:
            card = CreditCardData()
            card.token = discover_token

        response = card.charge(17.03) \
            .with_currency('USD') \
            .with_address(address) \
            .with_invoice_number('123456') \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 13
0
    def test_016_autorize_mastercard(self):
        # 016a authorization
        card = TestCards.mastercard_manual()

        address = Address()
        address.street_address_1 = '6860 Dallas Pkwy'
        address.postal_code = '750241234'

        response = card.authorize(17.07) \
            .with_currency('USD') \
            .with_address(address) \
            .with_invoice_number('123456') \
            .with_allow_duplicates(True) \
            .execute('ecommerce')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

        # 016b capture
        capture = response.capture().execute('ecommerce')

        self.assertNotEqual(None, capture)
        self.assertEqual('00', capture.response_code, capture.response_message)
Ejemplo n.º 14
0
class IntegrationGatewaysRealexConnectorRecurringTests(unittest.TestCase):
    '''
    Ensure Recurring transactions works
    '''

    config = ServicesConfig()
    config.merchant_id = 'heartlandgpsandbox'
    config.account_id = 'api'
    config.shared_secret = 'secret'
    config.rebate_password = '******'
    config.refund_password = '******'
    config.service_url = 'https://api.sandbox.realexpayments.com/epage-remote.cgi'

    ServicesContainer.configure(config, "realex")

    card = CreditCardData()
    card.number = '4263970000005262'
    card.exp_month = '05'
    card.exp_year = '2019'
    card.cvn = '123'
    card.card_holder_name = 'James Mason'

    new_customer = Customer()
    new_customer.key = '{}-Realex'.format(datetime.now().strftime('%Y%m%d'))
    new_customer.title = 'Mr.'
    new_customer.first_name = 'James'
    new_customer.last_name = 'Mason'
    new_customer.company = 'Realex Payments'
    new_customer.address = Address()
    new_customer.address.street_address_1 = 'Flat 123'
    new_customer.address.street_address_2 = 'House 456'
    new_customer.address.street_address_3 = 'The Cul-De-Sac'
    new_customer.address.city = 'Halifax'
    new_customer.address.province = 'West Yorkshire'
    new_customer.address.postal_code = 'W6 9HR'
    new_customer.address.country = 'United Kingdom'
    new_customer.home_phone = '+35312345678'
    new_customer.work_phone = '+3531987654321'
    new_customer.fax = '+24546871258'
    new_customer.mobile_phone = '+25544778544'
    new_customer.email = '*****@*****.**'
    new_customer.comments = 'Campaign Ref E7373G'

    def customer_id(self):
        return '{}-Realex'.format(datetime.now().strftime('%Y%m%d'))

    def payment_id(self, t):
        return '{}-Realex-{}'.format(datetime.now().strftime('%Y%m%d'), t)

    def test_001a_create_customer(self):
        try:
            customer = self.new_customer.create('realex')
            self.assertNotEqual(None, customer)
        except GatewayException as exc:
            if int(exc.response_code) != 501:
                raise exc

    def test_001b_create_payment_method(self):
        try:
            payment_method = self.new_customer.add_payment_method(
                self.payment_id('credit'), self.card).create('realex')
            self.assertNotEqual(None, payment_method)
        except GatewayException as exc:
            if int(exc.response_code) != 520:
                raise exc

    def test_002a_edit_customer(self):
        customer = Customer()
        customer.key = self.customer_id()
        customer.first_name = 'Perry'
        customer.save_changes('realex')

    def test_002b_edit_payment_method(self):
        payment_method = RecurringPaymentMethod(self.customer_id(),
                                                self.payment_id('Credit'))
        payment_method.payment_method = CreditCardData()
        payment_method.payment_method.number = '5425230000004415'
        payment_method.payment_method.exp_month = '10'
        payment_method.payment_method.exp_year = '2020'
        payment_method.payment_method.card_holder_name = 'Philip Marlowe'
        payment_method.save_changes('realex')

    def test_002c_edit_payment_method_exp_date_only(self):
        payment_method = RecurringPaymentMethod(self.customer_id(),
                                                self.payment_id('Credit'))
        payment_method.payment_method = CreditCardData()
        payment_method.payment_method.card_type = 'MC'
        payment_method.payment_method.exp_month = '10'
        payment_method.payment_method.exp_year = '2020'
        payment_method.payment_method.card_holder_name = 'Philip Marlowe'
        payment_method.save_changes('realex')

    def test_003_find_customer_throws_exception(self):
        with self.assertRaises(UnsupportedTransactionException):
            Customer.find(self.customer_id(), 'realex')

    def test_004a_charge_stored_card(self):
        payment_method = RecurringPaymentMethod(self.customer_id(),
                                                self.payment_id('Credit'))

        response = payment_method.charge(10) \
            .with_currency('USD') \
            .with_cvn('123') \
            .execute('realex')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_004b_verify_stored_card(self):
        payment_method = RecurringPaymentMethod(self.customer_id(),
                                                self.payment_id('Credit'))

        response = payment_method.verify() \
            .with_cvn('123') \
            .execute('realex')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_004c_refund_stored_card(self):
        payment_method = RecurringPaymentMethod(self.customer_id(),
                                                self.payment_id('Credit'))

        response = payment_method.refund(10.01) \
            .with_currency('USD') \
            .execute('realex')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_005_recurring_payment(self):
        payment_method = RecurringPaymentMethod(self.customer_id(),
                                                self.payment_id('Credit'))

        response = payment_method.charge(12) \
            .with_currency('USD') \
            .with_recurring_info(RecurringType.Fixed, RecurringSequence.First) \
            .execute('realex')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_006_delete_payment_method(self):
        payment_method = RecurringPaymentMethod(self.customer_id(),
                                                self.payment_id('Credit'))
        payment_method.delete(config_name='realex')
Ejemplo n.º 15
0
    def test_credit_fraud_response(self):
        billing_address = Address()
        billing_address.street_address_1 = 'Flat 123'
        billing_address.street_address_2 = 'House 456'
        billing_address.street_address_3 = 'Cul-De-Sac'
        billing_address.city = 'Halifax'
        billing_address.province = 'West Yorkshire'
        billing_address.state = 'Yorkshire and the Humber'
        billing_address.country = 'GB'
        billing_address.postal_code = 'E77 4QJ'

        shipping_address = Address()
        shipping_address.street_address_1 = 'House 456'
        shipping_address.street_address_2 = '987 The Street'
        shipping_address.street_address_3 = 'Basement Flat'
        shipping_address.city = 'Chicago'
        shipping_address.state = 'Illinois'
        shipping_address.province = 'Mid West'
        shipping_address.country = 'US'
        shipping_address.postal_code = '5001'

        response = self.card.charge(199.99) \
            .with_currency('EUR') \
            .with_address(billing_address, AddressType.Billing) \
            .with_address(shipping_address, AddressType.Shipping) \
            .with_product_id('SID9838383') \
            .with_client_transaction_id('Car Part HV') \
            .with_customer_id('E8953893489') \
            .with_customer_ip_address('123.123.123.123') \
            .execute("realex")

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code)
Ejemplo n.º 16
0
class IntegrationGatewaysPorticoConnectorCertificationACHTests(
        unittest.TestCase):
    '''
    Ensure check transactions work
    '''

    config = ServicesConfig()
    config.secret_api_key = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'
    config.service_url = 'https://cert.api2.heartlandportico.com'

    ServicesContainer.configure(config, 'ach')

    address = Address()
    address.street_address_1 = '123 Main St.'
    address.city = 'Downtown'
    address.province = 'NJ'
    address.postal_code = '12345'

    def check(self, sec_code, check_type, account_type, check_name=None):
        check = ECheck()
        check.account_number = '24413815'
        check.routing_number = '490000018'
        check.check_type = check_type
        check.sec_code = sec_code
        check.account_type = account_type
        check.entry_mode = EntryMethod.Manual
        check.check_holder_name = 'John Doe'
        check.drivers_license_number = '09876543210'
        check.drivers_license_state = 'TX'
        check.phone_number = '8003214567'
        check.birth_year = '1997'
        check.ssn_last_4 = '4321'
        if check_name:
            check.check_name = check_name
        return check

    # ACH Debit - Consumer

    def test_001_consumer_personal_checking(self):
        check = self.check(SecCode.PPD, CheckType.Personal,
                           AccountType.Checking)

        response = check.charge(11.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

        # test case 25
        void_response = response.void().execute('ach')

        self.assertNotEqual(None, void_response)
        self.assertEqual('00', void_response.response_code,
                         void_response.response_message)

    def test_002_consumer_business_checking(self):
        check = self.check(SecCode.PPD, CheckType.Business,
                           AccountType.Checking)

        response = check.charge(12.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_003_consumer_personal_savings(self):
        check = self.check(SecCode.PPD, CheckType.Personal,
                           AccountType.Savings)

        response = check.charge(13.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_004_consumer_business_savings(self):
        check = self.check(SecCode.PPD, CheckType.Business,
                           AccountType.Savings)

        response = check.charge(14.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    # ACH Debit - Corporate

    def test_005_corporate_personal_checking(self):
        check = self.check(SecCode.CCD, CheckType.Personal,
                           AccountType.Checking, 'Heartland Pays')

        response = check.charge(15.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

        # test case 26
        void_response = response.void().execute('ach')

        self.assertNotEqual(None, void_response)
        self.assertEqual('00', void_response.response_code,
                         void_response.response_message)

    def test_006_corporate_business_checking(self):
        check = self.check(SecCode.CCD, CheckType.Business,
                           AccountType.Checking, 'Heartland Pays')

        response = check.charge(16.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_007_corporate_personal_savings(self):
        check = self.check(SecCode.CCD, CheckType.Personal,
                           AccountType.Savings, 'Heartland Pays')

        response = check.charge(17.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_008_corporate_business_savings(self):
        check = self.check(SecCode.CCD, CheckType.Business,
                           AccountType.Savings, 'Heartland Pays')

        response = check.charge(18.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    # ACH Debit - eGold

    def test_009_egold_personal_checking(self):
        check = self.check(SecCode.POP, CheckType.Personal,
                           AccountType.Checking)

        response = check.charge(11.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_010_egold_business_checking(self):
        check = self.check(SecCode.POP, CheckType.Business,
                           AccountType.Checking)

        response = check.charge(12.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_011_egold_personal_savings(self):
        check = self.check(SecCode.POP, CheckType.Personal,
                           AccountType.Savings)

        response = check.charge(13.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_012_egold_business_savings(self):
        check = self.check(SecCode.POP, CheckType.Business,
                           AccountType.Savings)

        response = check.charge(14.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    # ACH Debit - eSilver

    def test_013_esilver_personal_checking(self):
        check = self.check(SecCode.POP, CheckType.Personal,
                           AccountType.Checking)

        response = check.charge(15.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_014_esilver_business_checking(self):
        check = self.check(SecCode.POP, CheckType.Business,
                           AccountType.Checking)

        response = check.charge(16.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_015_esilver_personal_savings(self):
        check = self.check(SecCode.POP, CheckType.Personal,
                           AccountType.Savings)

        response = check.charge(17.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_016_esilver_business_savings(self):
        check = self.check(SecCode.POP, CheckType.Business,
                           AccountType.Savings)

        response = check.charge(18.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    # ACH Debit - eBronze

    @unittest.skip('eBronze support cannot be configured with the others')
    def test_017_ebronze_personal_checking(self):
        check = self.check(SecCode.EBronze, CheckType.Personal,
                           AccountType.Checking)

        response = check.charge(19.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    @unittest.skip('eBronze support cannot be configured with the others')
    def test_018_ebronze_business_checking(self):
        check = self.check(SecCode.EBronze, CheckType.Business,
                           AccountType.Checking)

        response = check.charge(20.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    @unittest.skip('eBronze support cannot be configured with the others')
    def test_019_ebronze_personal_savings(self):
        check = self.check(SecCode.EBronze, CheckType.Personal,
                           AccountType.Savings)

        response = check.charge(21.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    @unittest.skip('eBronze support cannot be configured with the others')
    def test_020_ebronze_business_savings(self):
        check = self.check(SecCode.EBronze, CheckType.Business,
                           AccountType.Savings)

        response = check.charge(22.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    # ACH Debit - WEB

    def test_021_web_personal_checking(self):
        check = self.check(SecCode.WEB, CheckType.Personal,
                           AccountType.Checking)

        response = check.charge(23.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_022_web_business_checking(self):
        check = self.check(SecCode.WEB, CheckType.Business,
                           AccountType.Checking)

        response = check.charge(24.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_023_web_personal_savings(self):
        check = self.check(SecCode.WEB, CheckType.Personal,
                           AccountType.Savings)

        response = check.charge(25.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_024_web_business_savings(self):
        check = self.check(SecCode.WEB, CheckType.Business,
                           AccountType.Savings)

        response = check.charge(5.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 17
0
class IntegrationGatewaysPorticoConnectorCertificationEcommerceCheckTests(
        unittest.TestCase):
    '''
    Ensure check transactions work
    '''

    config = ServicesConfig()
    config.secret_api_key = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'
    config.service_url = 'https://cert.api2.heartlandportico.com'

    ServicesContainer.configure(config, 'ach')

    address = Address()
    address.street_address_1 = '123 Main St.'
    address.city = 'Downtown'
    address.province = 'NJ'
    address.postal_code = '12345'

    def check(self, sec_code, check_type, account_type, check_name=None):
        check = ECheck()
        check.account_number = '24413815'
        check.routing_number = '490000018'
        check.check_type = check_type
        check.sec_code = sec_code
        check.account_type = account_type
        check.entry_mode = EntryMethod.Manual
        check.check_holder_name = 'John Doe'
        check.drivers_license_number = '09876543210'
        check.drivers_license_state = 'TX'
        check.phone_number = '8003214567'
        check.birth_year = '1997'
        check.ssn_last_4 = '4321'
        if check_name:
            check.check_name = check_name
        return check

    # ACH Debit - WEB

    def test_001_web_personal_checking(self):
        check = self.check(SecCode.WEB, CheckType.Personal,
                           AccountType.Checking)

        response = check.charge(23.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_002_web_business_checking(self):
        check = self.check(SecCode.WEB, CheckType.Business,
                           AccountType.Checking)

        response = check.charge(24.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_003_web_personal_savings(self):
        check = self.check(SecCode.WEB, CheckType.Personal,
                           AccountType.Savings)

        response = check.charge(25.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)

    def test_004_web_business_savings(self):
        check = self.check(SecCode.WEB, CheckType.Business,
                           AccountType.Savings)

        response = check.charge(5.00) \
            .with_currency('USD') \
            .with_address(self.address) \
            .with_allow_duplicates(True) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code,
                         response.response_message)
Ejemplo n.º 18
0
class IntegrationGatewaysPorticoConnectorACHTests(unittest.TestCase):
    '''
    Ensure check transactions work
    '''

    config = ServicesConfig()
    config.secret_api_key = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'
    config.service_url = 'https://cert.api2.heartlandportico.com'
    config.developer_id = '000000'
    config.version_number = '0000'

    ServicesContainer.configure(config, 'ach')

    address = Address()
    address.street_address_1 = '123 Main St.'
    address.city = 'Downtown'
    address.province = 'NJ'
    address.postal_code = '12345'

    check = ECheck()
    check.account_number = '24413815'
    check.routing_number = '490000018'
    check.check_type = CheckType.Personal
    check.sec_code = SecCode.PPD
    check.account_type = AccountType.Checking
    check.entry_mode = EntryMethod.Manual
    check.check_holder_name = 'John Doe'
    check.drivers_license_number = '09876543210'
    check.drivers_license_state = 'TX'
    check.phone_number = '8003214567'
    check.birth_year = '1997'
    check.ssn_last_4 = '4321'

    def test_check_sale(self):
        response = self.check.charge(11) \
            .with_currency('USD') \
            .with_address(self.address) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code)

    def test_check_void_from_transaction_id(self):
        response = self.check.charge(10) \
            .with_currency('USD') \
            .with_address(self.address) \
            .execute('ach')

        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code)

        void_response = Transaction.from_id(response.transaction_id, PaymentMethodType.ACH) \
            .void() \
            .execute('ach')

        self.assertNotEqual(None, void_response)
        self.assertEqual('00', void_response.response_code)

    def test_check_crypto_gold_standard(self):
        gold_config = ServicesConfig()
        gold_config.secret_api_key = 'skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A'
        gold_config.service_url = 'https://cert.api2-c.heartlandportico.com'

        ServicesContainer.configure(gold_config, 'gold standard')

        response = self.check.charge(10)\
            .with_currency('USD')\
            .with_address(self.address)\
            .with_allow_duplicates(True)\
            .execute('gold standard')
        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code)