當前位置: 首頁>>代碼示例>>Python>>正文


Python Plan.get方法代碼示例

本文整理匯總了Python中recurly.Plan.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Plan.get方法的具體用法?Python Plan.get怎麽用?Python Plan.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在recurly.Plan的用法示例。


在下文中一共展示了Plan.get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_plan

# 需要導入模塊: from recurly import Plan [as 別名]
# 或者: from recurly.Plan import get [as 別名]
    def test_plan(self):
        plan_code = 'plan%s' % self.test_id
        with self.mock_request('plan/does-not-exist.xml'):
            self.assertRaises(NotFoundError, Plan.get, plan_code)

        plan = Plan(
            plan_code=plan_code,
            name='Mock Plan',
            setup_fee_in_cents=Money(0),
            unit_amount_in_cents=Money(1000),
        )
        with self.mock_request('plan/created.xml'):
            plan.save()

        try:
            self.assertEqual(plan.plan_code, plan_code)

            with self.mock_request('plan/exists.xml'):
                same_plan = Plan.get(plan_code)
            self.assertEqual(same_plan.plan_code, plan_code)
            self.assertEqual(same_plan.name, 'Mock Plan')

            plan.plan_interval_length = 2
            plan.plan_interval_unit = 'months'
            plan.unit_amount_in_cents = Money(USD=2000)
            plan.setup_fee_in_cents = Money(USD=0)
            with self.mock_request('plan/updated.xml'):
                plan.save()
        finally:
            with self.mock_request('plan/deleted.xml'):
                plan.delete()
開發者ID:mbeale,項目名稱:recurly-client-python,代碼行數:33,代碼來源:test_resources.py

示例2: test_plan

# 需要導入模塊: from recurly import Plan [as 別名]
# 或者: from recurly.Plan import get [as 別名]
    def test_plan(self):
        plan_code = "plan%s" % self.test_id
        with self.mock_request("plan/does-not-exist.xml"):
            self.assertRaises(NotFoundError, Plan.get, plan_code)

        plan = Plan(
            plan_code=plan_code,
            name="Mock Plan",
            setup_fee_in_cents=Money(0),
            unit_amount_in_cents=Money(1000),
            total_billing_cycles=10,
        )
        with self.mock_request("plan/created.xml"):
            plan.save()

        try:
            self.assertEqual(plan.plan_code, plan_code)

            with self.mock_request("plan/exists.xml"):
                same_plan = Plan.get(plan_code)
            self.assertEqual(same_plan.plan_code, plan_code)
            self.assertEqual(same_plan.name, "Mock Plan")
            self.assertEqual(same_plan.total_billing_cycles, 10)

            plan.plan_interval_length = 2
            plan.plan_interval_unit = "months"
            plan.unit_amount_in_cents = Money(USD=2000)
            plan.setup_fee_in_cents = Money(USD=200)
            plan.setup_fee_accounting_code = "Setup Fee AC"
            with self.mock_request("plan/updated.xml"):
                plan.save()
        finally:
            with self.mock_request("plan/deleted.xml"):
                plan.delete()

        """Test taxed plan"""
        with self.mock_request("plan/show-taxed.xml"):
            plan = Plan.get(plan_code)
            self.assertTrue(plan.tax_exempt)
開發者ID:tbartelmess,項目名稱:recurly-client-python,代碼行數:41,代碼來源:test_resources.py


注:本文中的recurly.Plan.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。