def test_live_cim_auth_transaction(self): result = Customer.create(CUSTOMER) transaction = FULL_CIM_TRANSACTION.copy() transaction['customer_id'] = result.customer_id transaction['payment_id'] = result.payment_ids[0] transaction['amount'] = random.randrange(100, 100000) / 100.0 Transaction.auth(transaction)
def test_live_bank_account(self): # Create a customer so that we can test payment creation against him result = Customer.create() customer_id = result.customer_id # Create a new bank account result = BankAccount.create(customer_id, BANK_ACCOUNT) payment_id = result.payment_id # Attempt to create a duplicate bank account entry. This will fail # since it is a duplicate payment method. self.assertRaises(AuthorizeResponseError, BankAccount.create, customer_id, BANK_ACCOUNT) # Read credit card data result = BankAccount.details(customer_id, payment_id) self.assertEquals(PAYMENT_RESULT, result.payment_profile.payment) # Update credit card BankAccount.update(customer_id, payment_id, BANK_ACCOUNT) # Delete tests BankAccount.delete(customer_id, payment_id) self.assertRaises(AuthorizeResponseError, BankAccount.delete, customer_id, payment_id)
def test_live_basic_credit_card(self): # Create a customer so that we can test payment creation against him result = Customer.create() customer_id = result.customer_id # Create a new credit card result = CreditCard.create(customer_id, CREDIT_CARD) payment_id = result.payment_id # Attempt to create a duplicate credit card entry. This will fail # since it is a duplicate payment method. self.assertRaises(AuthorizeResponseError, CreditCard.create, customer_id, CREDIT_CARD) # Read credit card data result = CreditCard.details(customer_id, payment_id) self.assertEquals(PAYMENT_RESULT, result.payment_profile.payment) # Update credit card CreditCard.update(customer_id, payment_id, UPDATE_CREDIT_CARD) CreditCard.update(customer_id, payment_id, UPDATE_CREDIT_CARD_WITH_MASK) CreditCard.update(customer_id, payment_id, UPDATE_CREDIT_CARD_WITHOUT_MASK) # Invalid masked number self.assertRaises(AuthorizeResponseError, CreditCard.update, customer_id, payment_id, UPDATE_CREDIT_CARD_INVALID_MASK) # Delete tests CreditCard.delete(customer_id, payment_id) self.assertRaises(AuthorizeResponseError, CreditCard.delete, customer_id, payment_id)
def test_credit(self): result = Customer.create(CUSTOMER) credit = { 'amount': 40.00 } credit['customer_id'] = result.customer_id credit['payment_id'] = result.payment_ids[0] Transaction.credit(credit)
def test_live_cim_auth_transaction(self): result = Customer.create(CUSTOMER) transaction = FULL_CIM_TRANSACTION.copy() transaction['customer_id'] = result.customer_id transaction['payment_id'] = result.payment_ids[0] transaction['amount'] = random.randrange(100, 100000) / 100.0 result = Transaction.auth(transaction) # Read transaction details result = Transaction.details(result.transaction_response.trans_id) self.assertEqual(result.transaction.order.order_number, 'PONUM00001')
def test_live_full_bank_account(self): # Create a customer so that we can test payment creation against him result = Customer.create() customer_id = result.customer_id # Create a new bank account result = BankAccount.create(customer_id, FULL_BANK_ACCOUNT) payment_id = result.payment_id # Make sure the billing address we set is the same we get back result = BankAccount.details(customer_id, payment_id) self.assertEquals(FULL_BANK_ACCOUNT['billing'], result.payment_profile.bill_to)
def test_live_customer(self): # Create customers result = Customer.create() Customer.create(FULL_CUSTOMER) Customer.create(CUSTOMER_WITH_CARD) # Read customer information. This returns the payment profile IDs # address IDs for the user customer_id = result.customer_id Customer.details(customer_id) # Update customer information Customer.update(customer_id, { 'email': '*****@*****.**', 'description': 'Cool web developer guy' }) # Delete customer information Customer.delete(customer_id) self.assertRaises(AuthorizeResponseError, Customer.delete, customer_id) Customer.list()
def test_live_cim_sale_transaction(self): result = Customer.create(CUSTOMER) transaction = FULL_CARD_NOT_PRESENT_TRANSACTION.copy() transaction['customer_id'] = result.customer_id transaction['payment_id'] = result.payment_ids[0] # Create CIM sale transaction. If another sale is attempted too quickly, # an error will be thrown. transaction['amount'] = random.randrange(100, 100000) / 100.0 result = Transaction.sale(transaction) self.assertRaises(AuthorizeResponseError, Transaction.sale, transaction) # Read transaction details Transaction.details(result.transaction_response.trans_id)
def test_live_full_credit_card(self): # Create a customer so that we can test payment creation against him result = Customer.create() customer_id = result.customer_id result = CreditCard.create(customer_id, FULL_CREDIT_CARD) payment_id = result.payment_id # Make sure the billing address we set is the same we get back result = CreditCard.details(customer_id, payment_id) self.assertEquals(FULL_CREDIT_CARD['billing'], result.payment_profile.bill_to) # Validate the credit card information result = CreditCard.validate(customer_id, payment_id, { 'card_code': '456', 'validation_mode': 'testMode', })
def test_live_bank_account(self): # Create a customer so that we can test payment creation against him result = Customer.create() customer_id = result.customer_id # Create a new bank account result = BankAccount.create(customer_id, BANK_ACCOUNT) payment_id = result.payment_id # Read credit card data result = BankAccount.details(customer_id, payment_id) self.assertEquals(PAYMENT_RESULT, result.payment_profile.payment) # Update credit card BankAccount.update(customer_id, payment_id, BANK_ACCOUNT) # Delete tests BankAccount.delete(customer_id, payment_id) self.assertRaises(AuthorizeResponseError, BankAccount.delete, customer_id, payment_id)
def test_live_address(self): # Create a customer so that we can test payment creation against him result = Customer.create() customer_id = result.customer_id # Create a new shipping address result = Address.create(customer_id, ADDRESS) address_id = result.address_id result = Address.details(customer_id, address_id) # Compare the address without the customer_address_id del result.address['address_id'] self.assertEquals(ADDRESS, result.address) Address.update(customer_id, address_id, ADDRESS) # Delete the address and make sure it is deleted by attempting to # delete it again. Address.delete(customer_id, address_id) self.assertRaises(AuthorizeResponseError, Address.delete, customer_id, address_id)