Beispiel #1
0
 def visa_swipe_encrypted(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '<E1050711%B4012001000000016^VI TEST CREDIT^251200000000000000000000?|LO04K0WFOmdkDz0um+GwUkILL8ZZOP6Zc4rCpZ9+kg2T3JBT4AEOilWTI|+++++++Dbbn04ekG|11;4012001000000016=25120000000000000000?|1u2F/aEhbdoPixyAPGyIDv3gBfF|+++++++Dbbn04ekG|00|||/wECAQECAoFGAgEH2wYcShV78RZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0PX50qfj4dt0lu9oFBESQQNkpoxEVpCW3ZKmoIV3T93zphPS3XKP4+DiVlM8VIOOmAuRrpzxNi0TN/DWXWSjUC8m/PI2dACGdl/hVJ/imfqIs68wYDnp8j0ZfgvM26MlnDbTVRrSx68Nzj2QAgpBCHcaBb/FZm9T7pfMr2Mlh2YcAt6gGG1i2bJgiEJn8IiSDX5M2ybzqRT86PCbKle/XCTwFFe1X|>;'
     data.entry_method = entry_method
     data.encryption_data = EncryptionData()
     data.encryption_data.version = '01'
     return data
Beispiel #2
0
 def discover_swipe_encrypted(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '<E1049711%B6011000000006527^DIS TEST CARD^25120000000000000000?|nqtDvLuS4VHJd1FymxBxihO5g/ZDqlHyTf8fQpjBwkk95cc6PG9V|+++++++C+LdWXLpP|11;6011000000006527=25120000000000000000?|8VfZvczP6iBqRis2XFypmktaipa|+++++++C+LdWXLpP|00|||/wECAQECAoFGAgEH2wYcShV78RZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0PX50qfj4dt0lu9oFBESQQNkpoxEVpCW3ZKmoIV3T93zphPS3XKP4+DiVlM8VIOOmAuRrpzxNi0TN/DWXWSjUC8m/PI2dACGdl/hVJ/imfqIs68wYDnp8j0ZfgvM26MlnDbTVRrSx68Nzj2QAgpBCHcaBb/FZm9T7pfMr2Mlh2YcAt6gGG1i2bJgiEJn8IiSDX5M2ybzqRT86PCbKle/XCTwFFe1X|>'
     data.entry_method = entry_method
     data.encryption_data = EncryptionData()
     data.encryption_data.version = '01'
     return data
Beispiel #3
0
 def mastercard_swipe_encrypted(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '<E1052711%B5473501000000014^MC TEST CARD^251200000000000000000000000000000000?|GVEY/MKaKXuqqjKRRueIdCHPPoj1gMccgNOtHC41ymz7bIvyJJVdD3LW8BbwvwoenI+|+++++++C4cI2zjMp|11;5473501000000014=25120000000000000000?|8XqYkQGMdGeiIsgM0pzdCbEGUDP|+++++++C4cI2zjMp|00|||/wECAQECAoFGAgEH2wYcShV78RZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0PX50qfj4dt0lu9oFBESQQNkpoxEVpCW3ZKmoIV3T93zphPS3XKP4+DiVlM8VIOOmAuRrpzxNi0TN/DWXWSjUC8m/PI2dACGdl/hVJ/imfqIs68wYDnp8j0ZfgvM26MlnDbTVRrSx68Nzj2QAgpBCHcaBb/FZm9T7pfMr2Mlh2YcAt6gGG1i2bJgiEJn8IiSDX5M2ybzqRT86PCbKle/XCTwFFe1X|>'
     data.entry_method = entry_method
     data.encryption_data = EncryptionData()
     data.encryption_data.version = '01'
     return data
    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)
class IntegrationGatewaysPorticoConnectorCreditTests(unittest.TestCase):
    '''
    Ensure credit transactions work
    '''

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

    ServicesContainer.configure(config)

    card = CreditCardData()
    card.number = '4111111111111111'
    card.exp_month = '12'
    card.exp_year = '2025'
    card.cvn = '123'
    card.card_holder_name = 'Joe Smith'

    track = CreditTrackData()
    track.value = '<E1050711%B4012001000000016^VI TEST CREDIT^251200000000000000000000?|LO04K0WFOmdkDz0um+GwUkILL8ZZOP6Zc4rCpZ9+kg2T3JBT4AEOilWTI|+++++++Dbbn04ekG|11;4012001000000016=25120000000000000000?|1u2F/aEhbdoPixyAPGyIDv3gBfF|+++++++Dbbn04ekG|00|||/wECAQECAoFGAgEH2wYcShV78RZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0PX50qfj4dt0lu9oFBESQQNkpoxEVpCW3ZKmoIV3T93zphPS3XKP4+DiVlM8VIOOmAuRrpzxNi0TN/DWXWSjUC8m/PI2dACGdl/hVJ/imfqIs68wYDnp8j0ZfgvM26MlnDbTVRrSx68Nzj2QAgpBCHcaBb/FZm9T7pfMr2Mlh2YcAt6gGG1i2bJgiEJn8IiSDX5M2ybzqRT86PCbKle/XCTwFFe1X|>;'
    track.encryption_data = EncryptionData()
    track.encryption_data.version = '01'

    def test_credit_auth(self):
        response = self.card.authorize(14) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

        capture = response.capture(16).with_gratuity(2).execute()

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

    def test_credit_auth_with_convenience(self):
        response = self.card.authorize(14) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_auth_with_shipping(self):
        response = self.card.authorize(14) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_sale(self):
        response = self.card.charge(15) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_sale_with_convenience(self):
        response = self.card.charge(15) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_sale_with_shipping(self):
        response = self.card.charge(15) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_offline_auth(self):
        response = self.card.authorize(16) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_offline_auth_with_convenience(self):
        response = self.card.authorize(16) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_offline_auth_with_shipping(self):
        response = self.card.authorize(16) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_offline_sale(self):
        response = self.card.charge(17) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_offline_sale_with_convenience(self):
        response = self.card.charge(17) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_offline_sale_with_shipping(self):
        response = self.card.charge(17) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_refund(self):
        response = self.card.refund(16) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_reverse(self):
        response = self.card.reverse(15) \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_swipe_auth(self):
        response = self.track.authorize(14) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

        capture = response.capture(16).with_gratuity(2).execute()

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

    def test_credit_swipe_auth_with_convenience(self):
        response = self.track.authorize(14) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_swipe_auth_with_shipping(self):
        response = self.track.authorize(14) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_swipe_sale(self):
        response = self.track.charge(15) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_swipe_sale_with_convenience(self):
        response = self.track.charge(15) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_swipe_sale_with_shipping(self):
        response = self.track.charge(15) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_swipe_offline_auth(self):
        response = self.track.authorize(16) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_swipe_offline_auth_with_convenience(self):
        response = self.track.authorize(16) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_swipe_offline_auth_with_shipping(self):
        response = self.track.authorize(16) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_swipe_offline_sale(self):
        response = self.track.charge(17) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_swipe_offline_sale_with_convenience(self):
        response = self.track.charge(17) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_convenience_amt(2) \
            .execute()

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

    def test_credit_swipe_offline_sale_with_shipping(self):
        response = self.track.charge(17) \
            .with_currency('USD') \
            .with_offline_auth_code('123456') \
            .with_allow_duplicates(True) \
            .with_shipping_amt(2) \
            .execute()

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

    def test_credit_swipe_balance_inquiry(self):
        response = self.track.balance_inquiry().execute()

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

    def test_credit_swipe_refund(self):
        response = self.track.refund(16) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_swipe_reverse(self):
        response = self.track.charge(19) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

        reverse_response = self.track.reverse(15) \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_swipe_verify(self):
        response = self.track.verify() \
            .with_allow_duplicates(True) \
            .execute()

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

    def test_credit_void_from_transaction_id(self):
        response = self.card.authorize(10) \
            .with_currency('USD') \
            .with_allow_duplicates(True) \
            .execute()

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

        void_response = Transaction.from_id(response.transaction_id) \
            .void() \
            .execute()

        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.card.authorize(10)\
            .with_currency('USD')\
            .with_allow_duplicates(True)\
            .execute('gold standard')
        self.assertNotEqual(None, response)
        self.assertEqual('00', response.response_code)
Beispiel #6
0
 def mastercard_25_swipe(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '%B2223000010005798^TEST CARD/EMV BIN-2^19121010000000003840?;2223000010005798=19121010000000003840?'
     data.entry_method = entry_method
     return data
Beispiel #7
0
 def mastercard_swipe(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?'
     data.entry_method = entry_method
     return data
Beispiel #8
0
 def visa_swipe(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?'
     data.entry_method = entry_method
     return data
Beispiel #9
0
 def jcb_swipe(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '%B3566007770007321^JCB TEST CARD^2512101100000000000000000064300000?;3566007770007321=25121011000000076435?'
     data.entry_method = entry_method
     return data
Beispiel #10
0
 def amex_swipe(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '%B3727 006992 51018^AMEX TEST CARD^2512990502700?;372700699251018=2512990502700?'
     data.entry_method = entry_method
     return data
Beispiel #11
0
 def discover_swipe(entry_method=EntryMethod.Swipe):
     data = CreditTrackData()
     data.value = '%B6011000990156527^DIS TEST CARD^25121011000062111401?;6011000990156527=25121011000062111401?'
     data.entry_method = entry_method
     return data