How to use the recurly.Transaction 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 / 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
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)
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')