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_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_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, CREDIT_CARD) # Delete tests CreditCard.delete(customer_id, payment_id) self.assertRaises(AuthorizeResponseError, CreditCard.delete, customer_id, payment_id)