def get_authorize_client(self): """ Return an authenticated authorize.net client. """ assert self.provider == 'authorize_net', 'Invalid provider' return AuthorizeClient(self.authorize_net_login, self.authorize_net_transaction_key, test=self.test)
def setUp(self): # Random in testing feels gross, otherwise running the same test # suite in quick succession produces failures because Authorize.net # thinks the transactions are duplicates and rejects them self.amount1 = random.randrange(100, 100000) / 100.0 self.amount2 = random.randrange(100, 100000) / 100.0 self.client = AuthorizeClient(TEST_LOGIN_ID, TEST_TRANSACTION_KEY) self.year = date.today().year + 10 self.credit_card = CreditCard('4111111111111111', self.year, 1, '911', 'Jeff', 'Schenck') self.address = Address('45 Rose Ave', 'Venice', 'CA', '90291')
def test_basic_authorize_client(self): self.transaction_api.reset_mock() self.customer_api.reset_mock() self.recurring_api.reset_mock() self.assertEqual(self.transaction_api.call_args, None) self.assertEqual(self.customer_api.call_args, None) self.assertEqual(self.recurring_api.call_args, None) client = AuthorizeClient('123', '456', False, False) self.assertEqual(self.transaction_api.call_args, (('123', '456', False, False), {})) self.assertEqual(self.customer_api.call_args, (('123', '456', False, False), {})) self.assertEqual(self.recurring_api.call_args, (('123', '456', False, False), {}))
def setUp(self): self.transaction_api_patcher = mock.patch( 'authorize.client.TransactionAPI') self.transaction_api = self.transaction_api_patcher.start() self.customer_api_patcher = mock.patch('authorize.client.CustomerAPI') self.customer_api = self.customer_api_patcher.start() self.recurring_api_patcher = mock.patch( 'authorize.client.RecurringAPI') self.recurring_api = self.recurring_api_patcher.start() self.client = AuthorizeClient('123', '456') self.year = date.today().year + 10 self.credit_card = CreditCard('4111111111111111', self.year, 1, '911', 'Jeff', 'Schenck') self.address = Address('45 Rose Ave', 'Venice', 'CA', '90291')
def setUp(self): self.client = AuthorizeClient(TEST_LOGIN_ID, TEST_TRANSACTION_KEY) self.year = date.today().year + 10 self.credit_card = CreditCard('4111111111111111', self.year, 1, '911', 'Jeff', 'Schenck') self.address = Address('45 Rose Ave', 'Venice', 'CA', '90291')