Beispiel #1
0
 def test_metadata_is_sended_(self):
     transaction = Transaction(
         api_key='apikey',
         amount=314,
         card_hash='cardhash',
         metadata={'sku': 'foo bar'},
     )
     self.assertEqual('foo bar', transaction.get_data()['metadata']['sku'])
Beispiel #2
0
 def test_metadata_is_sended_(self):
     transaction = Transaction(
         api_key='apikey',
         amount=314,
         card_hash='cardhash',
         metadata={'sku': 'foo bar'},
     )
     self.assertEqual('foo bar', transaction.get_data()['metadata']['sku'])
Beispiel #3
0
 def test_charge(self):
     transaction = Transaction(api_key='apikey',
                               amount=314,
                               card_hash='foobar',
                               payment_method='credit_card',
                               installments=1,
                               postback_url='https://post.back.url')
     transaction.charge()
     self.assertEqual('processing', transaction.status)
Beispiel #4
0
 def test_charge_fail(self):
     transaction = Transaction(api_key='apikey',
                               amount=314,
                               card_hash='foobar',
                               payment_method='credit_card',
                               installments=1,
                               postback_url='https://post.back.url')
     with self.assertRaises(PygarmeTransactionApiError):
         transaction.charge()
Beispiel #5
0
 def test_charge(self):
     transaction = Transaction(api_key='apikey', amount=314, card_hash='foobar', payment_method='credit_card', installments=1, postback_url='https://post.back.url')
     transaction.charge()
     self.assertEqual('processing', transaction.status)
Beispiel #6
0
 def test_refund_transaction_fail(self):
     transaction = Transaction(api_key='apikey')
     transaction.find_by_id(314)
     with self.assertRaises(PygarmeTransactionApiError):
         transaction.refund()
Beispiel #7
0
 def test_refund_transaction_before_set_id(self):
     transaction = Transaction(api_key='apikey')
     with self.assertRaises(NotPaidException):
         transaction.refund()
Beispiel #8
0
 def test_refund_transaction(self):
     transaction = Transaction(api_key='apikey')
     transaction.find_by_id(314)
     transaction.refund()
     self.assertEqual('refunded', transaction.status)
Beispiel #9
0
 def test_get_transaction_by_id_fails(self):
     transaction = Transaction(api_key='apikey')
     with self.assertRaises(PygarmeTransactionApiError):
         transaction.find_by_id(314)
Beispiel #10
0
 def test_get_transaction_by_id_with_invalid_id(self):
     transaction = Transaction(api_key='apikey')
     with self.assertRaises(ValueError):
         transaction.find_by_id('foo bar')
Beispiel #11
0
 def test_get_transaction_by_id(self):
     transaction = Transaction(api_key='apikey')
     transaction.find_by_id(314)
     self.assertEqual(314, transaction.id)
Beispiel #12
0
 def test_charge_fail(self):
     transaction = Transaction(api_key='apikey', amount=314, card_hash='foobar', payment_method='credit_card', installments=1, postback_url='https://post.back.url')
     with self.assertRaises(PygarmeTransactionApiError):
         transaction.charge()
Beispiel #13
0
 def test_get_transaction_by_id(self):
     transaction = Transaction(api_key='apikey')
     transaction.find_by_id(314)
     self.assertEqual(314, transaction.id)
Beispiel #14
0
 def test_refund_transaction_fail(self):
     transaction = Transaction(api_key='apikey')
     transaction.find_by_id(314)
     with self.assertRaises(PygarmeTransactionApiError):
         transaction.refund()
Beispiel #15
0
 def test_refund_transaction_before_set_id(self):
     transaction = Transaction(api_key='apikey')
     with self.assertRaises(NotPaidException):
         transaction.refund()
Beispiel #16
0
 def test_refund_transaction(self):
     transaction = Transaction(api_key='apikey')
     transaction.find_by_id(314)
     transaction.refund()
     self.assertEqual('refunded', transaction.status)
Beispiel #17
0
 def test_get_transaction_by_id_fails(self):
     transaction = Transaction(api_key='apikey')
     with self.assertRaises(PygarmeTransactionApiError):
         transaction.find_by_id(314)
Beispiel #18
0
 def test_get_transaction_by_id_with_invalid_id(self):
     transaction = Transaction(api_key='apikey')
     with self.assertRaises(ValueError):
         transaction.find_by_id('foo bar')