예제 #1
0
 def test_authorize_saved_card_capture(self):
     self.client._customer.capture.return_value = TRANSACTION_RESULT
     saved = AuthorizeSavedCard(self.client, '1|2')
     result = saved.capture(10)
     self.assertEqual(self.client._customer.capture.call_args,
         (('1', '2', 10), {}))
     self.assertTrue(isinstance(result, AuthorizeTransaction))
     self.assertEqual(result.uid, '2171062816')
예제 #2
0
 def test_authorize_saved_card_credit(self):
     self.client._customer.credit.return_value = TRANSACTION_RESULT
     saved = AuthorizeSavedCard(self.client, '1|2')
     result = saved.credit(10)
     self.assertEqual(self.client._customer.credit.call_args,
                      (('1', '2', 10), {}))
     self.assertTrue(isinstance(result, AuthorizeTransaction))
     self.assertEqual(result.uid, '2171062816')
예제 #3
0
 def test_authorized_saved_card_update(self):
     address = Address('45 Rose Ave', 'Venice', 'CA', '90291')
     result_dict = {
         'first_name': 'Jeff', 'last_name': 'Shenck', 'address': address,
         'payment': PROFILE}
     self.client._customer.retrieve_saved_payment.return_value = result_dict
     self.client._customer.update_saved_payment.return_value = None
     saved = AuthorizeSavedCard(self.client, '1|2')
     saved.update(address=address)
예제 #4
0
 def test_authorized_saved_card_update(self):
     address = Address('45 Rose Ave', 'Venice', 'CA', '90291')
     result_dict = {
         'first_name': 'Jeff', 'last_name': 'Shenck', 'address': address,
         'payment': PROFILE}
     self.client._customer.retrieve_saved_payment.return_value = result_dict
     self.client._customer.update_saved_payment.return_value = None
     saved = AuthorizeSavedCard(self.client, '1|2')
     saved.update(address=address)
예제 #5
0
 def test_authorize_saved_card_capture(self):
     self.client._customer.capture.return_value = TRANSACTION_RESULT
     saved = AuthorizeSavedCard(self.client, '1|2')
     result = saved.capture(10)
     self.assertEqual(self.client._customer.capture.call_args,
         (('1', '2', 10, None),
          {'purchase_order_number': None, 'description':None,
           'invoice_number':None}))
     self.assertTrue(isinstance(result, AuthorizeTransaction))
     self.assertEqual(result.uid, '2171062816')
예제 #6
0
    def test_authorize_saved_card_get_payment_info(self):
        address = Address('45 Rose Ave', 'Venice', 'CA', '90291')
        result_dict = {
            'first_name': 'Jeff', 'last_name': 'Shenck', 'address': address,
            'payment': PROFILE}
        self.client._customer.retrieve_saved_payment.return_value = result_dict
        saved = AuthorizeSavedCard(self.client, '1|2')
        result = saved.get_payment_info()

        self.assertEqual(result['first_name'], result_dict['first_name'])
        self.assertEqual(result['last_name'], result_dict['last_name'])
        self.assertEqual(
            result['address'].street, result_dict['address'].street)
예제 #7
0
    def test_authorize_saved_card_get_payment_info(self):
        address = Address('45 Rose Ave', 'Venice', 'CA', '90291')
        result_dict = {
            'first_name': 'Jeff', 'last_name': 'Shenck', 'address': address,
            'payment': PROFILE}
        self.client._customer.retrieve_saved_payment.return_value = result_dict
        saved = AuthorizeSavedCard(self.client, '1|2')
        result = saved.get_payment_info()

        self.assertEqual(result['first_name'], result_dict['first_name'])
        self.assertEqual(result['last_name'], result_dict['last_name'])
        self.assertEqual(
            result['address'].street, result_dict['address'].street)
예제 #8
0
 def test_authorize_saved_card_delete(self):
     saved = AuthorizeSavedCard(self.client, '1|2')
     result = saved.delete()
     self.assertEqual(self.client._customer.delete_saved_payment.call_args,
                      (('1', '2'), {}))
예제 #9
0
 def test_authorize_saved_card_basic(self):
     saved = AuthorizeSavedCard(self.client, '1|2')
     repr(saved)
예제 #10
0
 def test_authorize_saved_card_delete(self):
     saved = AuthorizeSavedCard(self.client, '1|2')
     result = saved.delete()
     self.assertEqual(self.client._customer.delete_saved_payment.call_args,
         (('1', '2'), {}))