How to use the recurly.Account function in recurly

To help you get started, we’ve selected a few recurly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github recurly / recurly-client-python / tests / test_recurly.py View on Github external
def test_xml(self):
        import recurly
        account = recurly.Account()
        account.username = 'importantbreakfast'
        account_xml = ElementTree.tostring(account.to_element(), encoding='UTF-8')
        self.assertEqual(account_xml, xml('importantbreakfast'))
github recurly / recurly-client-python / tests / tests_errors.py View on Github external
def test_unexpected_errors_thrown(self):
        """ Test UnexpectedClientError class """
        transaction = Transaction(
            amount_in_cents=1000,
            currency='USD',
            account=Account(
                account_code='transactionmock'
            )
        )

        # Mock 'save transaction' request to throw unexpected client error
        with self.mock_request('transaction/error-teapot.xml'):
            try:
                transaction.save()
            except UnexpectedStatusError as e:
                error = e

        self.assertIsInstance(error, UnexpectedClientError)

        # Mock 'save transaction' request to throw another unexpected client error
        with self.mock_request('transaction/error-client.xml'):
            try:
github recurly / recurly-client-python / tests / tests_errors.py View on Github external
def test_transaction_error_code_property(self):
        """ Test ValidationError class 'transaction_error_code' property"""
        transaction = Transaction(
            amount_in_cents=1000,
            currency='USD',
            account=Account(
                account_code='transactionmock'
            )
        )

        # Mock 'save transaction' request to throw declined
        # transaction validation error
        with self.mock_request('transaction/declined-transaction.xml'):
            try:
                transaction.save()
            except ValidationError as e:
                error = e

        self.assertEqual(error.transaction_error_code, 'insufficient_funds')
github recurly / recurly-client-python / tests / test_recurly.py View on Github external
active
            2
            2000
            2009-11-22T13:10:38-08:00
            
            
            2009-11-22T13:10:38-08:00
            2009-11-29T13:10:38-08:00
            2009-11-22T13:10:38-08:00
            2009-11-29T13:10:38-08:00
          
        """)
        self.assertEqual(objs['type'], 'new_subscription_notification')
        self.assertTrue('account' in objs)
        self.assertTrue(isinstance(objs['account'], recurly.Account))
        self.assertEqual(objs['account'].username, 'verena')
        self.assertTrue('subscription' in objs)
        self.assertTrue(isinstance(objs['subscription'], recurly.Subscription))
        self.assertEqual(objs['subscription'].state, 'active')
github recurly / recurly-client-python / tests / tests_errors.py View on Github external
def test_transaction_error_property(self):
        """ Test ValidationError class 'transaction_error' property"""
        transaction = Transaction(
            amount_in_cents=1000,
            currency='USD',
            account=Account(
                account_code='transactionmock'
            )
        )

        # Mock 'save transaction' request to throw declined
        # transaction validation error
        with self.mock_request('transaction/declined-transaction.xml'):
            try:
                transaction.save()
            except ValidationError as e:
                error = e

        transaction_error = error.transaction_error

        self.assertEqual(transaction_error.error_code, 'insufficient_funds')
        self.assertEqual(transaction_error.error_category, 'soft')