本文整理汇总了Python中recurly.Account.invoice方法的典型用法代码示例。如果您正苦于以下问题:Python Account.invoice方法的具体用法?Python Account.invoice怎么用?Python Account.invoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类recurly.Account
的用法示例。
在下文中一共展示了Account.invoice方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_invoice
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [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()
示例2: test_invoice
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [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:
示例3: test_invoice
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [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")
示例4: test_invoice_refund_amount
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [as 别名]
def test_invoice_refund_amount(self):
account = Account(account_code="invoice%s" % self.test_id)
with self.mock_request("invoice/account-created.xml"):
account.save()
with self.mock_request("invoice/invoiced.xml"):
invoice = account.invoice()
with self.mock_request("invoice/refunded.xml"):
refund_invoice = invoice.refund_amount(1000)
self.assertEqual(refund_invoice.subtotal_in_cents, -1000)
示例5: test_invoice_refund
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [as 别名]
def test_invoice_refund(self):
account = Account(account_code="invoice%s" % self.test_id)
with self.mock_request("invoice/account-created.xml"):
account.save()
with self.mock_request("invoice/invoiced-line-items.xml"):
invoice = account.invoice()
with self.mock_request("invoice/line-item-refunded.xml"):
line_items = [{"adjustment": invoice.line_items[0], "quantity": 1, "prorate": False}]
refund_invoice = invoice.refund(line_items)
self.assertEqual(refund_invoice.subtotal_in_cents, -1000)
示例6: test_invoice_with_optionals
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [as 别名]
def test_invoice_with_optionals(self):
account = Account(account_code='invoice%s' % self.test_id)
with self.mock_request('invoice/account-created.xml'):
account.save()
with self.mock_request('invoice/invoiced-with-optionals.xml'):
invoice = account.invoice(terms_and_conditions='Some Terms and Conditions',
customer_notes='Some Customer Notes')
self.assertEqual(type(invoice), recurly.Invoice)
self.assertEqual(invoice.terms_and_conditions, 'Some Terms and Conditions')
self.assertEqual(invoice.customer_notes, 'Some Customer Notes')
示例7: test_invoice_refund
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [as 别名]
def test_invoice_refund(self):
account = Account(account_code='invoice%s' % self.test_id)
with self.mock_request('invoice/account-created.xml'):
account.save()
with self.mock_request('invoice/invoiced-line-items.xml'):
invoice = account.invoice()
with self.mock_request('invoice/line-item-refunded.xml'):
line_items = [{ 'adjustment': invoice.line_items[0], 'quantity': 1,
'prorate': False }]
refund_invoice = invoice.refund(line_items)
self.assertEqual(refund_invoice.subtotal_in_cents, -1000)
示例8: Adjustment
# 需要导入模块: from recurly import Account [as 别名]
# 或者: from recurly.Account import invoice [as 别名]
with self.mock_request('invoice/error-no-charges.xml'):
try:
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)