当前位置: 首页>>代码示例>>Python>>正文


Python Account.invoices方法代码示例

本文整理汇总了Python中recurly.Account.invoices方法的典型用法代码示例。如果您正苦于以下问题:Python Account.invoices方法的具体用法?Python Account.invoices怎么用?Python Account.invoices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在recurly.Account的用法示例。


在下文中一共展示了Account.invoices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_invoice

# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoices [as 别名]
    def test_invoice(self):
        account = Account(account_code='invoice%s' % self.test_id)
        with self.mock_request('invoice/account-created.xml'):
            account.save()

        try:
            with self.mock_request('invoice/account-has-no-invoices.xml'):
                invoices = account.invoices()
            self.assertEqual(invoices, [])

            with self.mock_request('invoice/error-no-charges.xml'):
                try:
                    account.invoice()
                except ValidationError as exc:
                    error = exc
                else:
                    self.fail("Invoicing an account with no charges did not raise a ValidationError")
            self.assertEqual(error.symbol, 'will_not_invoice')

            charge = Adjustment(unit_amount_in_cents=1000, currency='USD', description='test charge', type='charge')
            with self.mock_request('invoice/charged.xml'):
                account.charge(charge)

            with self.mock_request('invoice/invoiced.xml'):
                account.invoice()

            with self.mock_request('invoice/account-has-invoices.xml'):
                invoices = account.invoices()
            self.assertEqual(len(invoices), 1)
        finally:
            with self.mock_request('invoice/account-deleted.xml'):
                account.delete()
开发者ID:Captricity,项目名称:recurly-client-python,代码行数:34,代码来源:test_resources.py

示例2: test_invoice

# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoices [as 别名]
    def test_invoice(self):
        account = Account(account_code="invoice%s" % self.test_id)
        with self.mock_request("invoice/account-created.xml"):
            account.save()

        try:
            with self.mock_request("invoice/account-has-no-invoices.xml"):
                invoices = account.invoices()
            self.assertEqual(invoices, [])

            with self.mock_request("invoice/error-no-charges.xml"):
                try:
                    account.invoice()
                except ValidationError as exc:
                    error = exc
                else:
                    self.fail("Invoicing an account with no charges did not raise a ValidationError")
            self.assertEqual(error.symbol, "will_not_invoice")

            charge = Adjustment(unit_amount_in_cents=1000, currency="USD", description="test charge", type="charge")
            with self.mock_request("invoice/charged.xml"):
                account.charge(charge)

            with self.mock_request("invoice/invoiced.xml"):
                account.invoice()

            with self.mock_request("invoice/account-has-invoices.xml"):
                invoices = account.invoices()
            self.assertEqual(len(invoices), 1)
        finally:
            with self.mock_request("invoice/account-deleted.xml"):
                account.delete()

        """Test taxed invoice"""
        with self.mock_request("invoice/show-taxed.xml"):
            invoice = account.invoices()[0]
            self.assertEqual(invoice.tax_type, "usst")

        """Test invoice with prefix"""
        with self.mock_request("invoice/show-with-prefix.xml"):
            invoice = account.invoices()[0]
            self.assertEqual(invoice.invoice_number, 1001)
            self.assertEqual(invoice.invoice_number_prefix, "GB")
            self.assertEqual(invoice.invoice_number_with_prefix(), "GB1001")
开发者ID:tbartelmess,项目名称:recurly-client-python,代码行数:46,代码来源:test_resources.py

示例3: test_invoice

# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoices [as 别名]
    def test_invoice(self):
        account = Account(account_code='invoice%s' % self.test_id)
        with self.mock_request('invoice/account-created.xml'):
            account.save()

        try:
            with self.mock_request('invoice/account-has-no-invoices.xml'):
                invoices = account.invoices()
            self.assertEqual(invoices, [])

            with self.mock_request('invoice/error-no-charges.xml'):
                try:
                    account.invoice()
                except ValidationError, exc:
                    error = exc
                else:
开发者ID:mbeale,项目名称:recurly-client-python,代码行数:18,代码来源:test_resources.py

示例4: Adjustment

# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoices [as 别名]
                    account.invoice()
                except ValidationError, exc:
                    error = exc
                else:
                    self.fail("Invoicing an account with no charges did not raise a ValidationError")
            self.assertEqual(error.symbol, 'will_not_invoice')

            charge = Adjustment(unit_amount_in_cents=1000, currency='USD', description='test charge', type='charge')
            with self.mock_request('invoice/charged.xml'):
                account.charge(charge)

            with self.mock_request('invoice/invoiced.xml'):
                account.invoice()

            with self.mock_request('invoice/account-has-invoices.xml'):
                invoices = account.invoices()
            self.assertEqual(len(invoices), 1)
        finally:
            with self.mock_request('invoice/account-deleted.xml'):
                account.delete()

    def test_pages(self):
        account_code = 'pages-%s-%%d' % self.test_id
        all_test_accounts = list()

        try:
            for i in range(1, 8):
                account = Account(account_code=account_code % i)
                all_test_accounts.append(account)
                with self.mock_request('pages/account-%d-created.xml' % i):
                    account.save()
开发者ID:mbeale,项目名称:recurly-client-python,代码行数:33,代码来源:test_resources.py


注:本文中的recurly.Account.invoices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。