• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python recurly.Account类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_subscribe

    def test_subscribe(self):
        logging.basicConfig(level=logging.DEBUG)  # make sure it's init'ed
        logger = logging.getLogger('recurly.http.request')
        logger.setLevel(logging.DEBUG)

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

        try:
            account = Account(account_code='subscribe%s' % self.test_id)
            with self.mock_request('subscription/account-created.xml'):
                account.save()

            try:

                sub = Subscription(
                    plan_code='basicplan',
                    currency='USD',
                    unit_amount_in_cents=1000,
                )

                with self.mock_request('subscription/error-no-billing-info.xml'):
                    try:
                        account.subscribe(sub)
                    except BadRequestError, exc:
                        error = exc
                    else:
                        self.fail("Subscribing with no billing info did not raise a BadRequestError")
开发者ID:mbeale,项目名称:recurly-client-python,代码行数:34,代码来源:test_resources.py


示例2: test_authentication

    def test_authentication(self):
        recurly.API_KEY = None

        account_code = 'test%s' % self.test_id
        try:
            Account.get(account_code)
        except recurly.UnauthorizedError, exc:
            pass
开发者ID:andreebrazeau,项目名称:recurly-client-python,代码行数:8,代码来源:test_resources.py


示例3: test_authentication

    def test_authentication(self):
        recurly.API_KEY = None

        account_code = 'test%s' % self.test_id
        try:
            Account.get(account_code)
        except recurly.UnauthorizedError as exc:
            pass
        else:
            self.fail("Updating account with invalid email address did not raise a ValidationError")
开发者ID:issuu,项目名称:recurly-client-python,代码行数:10,代码来源:test_resources.py


示例4: test_authentication

    def test_authentication(self):
        recurly.API_KEY = None

        account_code = 'test%s' % self.test_id
        with self.mock_request('authentication/unauthenticated.xml'):
            try:
                Account.get(account_code)
            except recurly.UnauthorizedError, exc:
                pass
            else:
开发者ID:mbeale,项目名称:recurly-client-python,代码行数:10,代码来源:test_resources.py


示例5: test_charge

    def test_charge(self):
        account = Account(account_code='charge%s' % self.test_id)
        with self.mock_request('adjustment/account-created.xml'):
            account.save()

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

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

            with self.mock_request('adjustment/account-has-charges.xml'):
                charges = account.adjustments()
            self.assertEqual(len(charges), 1)
            same_charge = charges[0]
            self.assertEqual(same_charge.unit_amount_in_cents, 1000)
            self.assertEqual(same_charge.currency, 'USD')
            self.assertEqual(same_charge.description, 'test charge')
            self.assertEqual(same_charge.type, 'charge')
        finally:
            with self.mock_request('adjustment/account-deleted.xml'):
                account.delete()
开发者ID:aitorciki,项目名称:recurly-client-python,代码行数:25,代码来源:test_resources.py


示例6: test_invoice_refund_amount

    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)
开发者ID:tbartelmess,项目名称:recurly-client-python,代码行数:11,代码来源:test_resources.py


示例7: test_invoice_refund

    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)
开发者ID:tbartelmess,项目名称:recurly-client-python,代码行数:12,代码来源:test_resources.py


示例8: test_invoice_with_optionals

    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')
开发者ID:Asset-Map,项目名称:recurly-client-python,代码行数:12,代码来源:test_resources.py


示例9: test_invoice_refund

    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)
开发者ID:Asset-Map,项目名称:recurly-client-python,代码行数:13,代码来源:test_resources.py


示例10: get_accounts

	def get_accounts(self):
		accounts = []
		for account in Account.all():
			acct = {}
			acct['email'] = account.email
			acct['first_name'] = account.first_name
			acct['last_name'] = account.last_name
			acct['company_name'] = account.company_name
			accounts.append(acct)
		return {'Accounts': accounts}
开发者ID:ashray-velapanur,项目名称:grind_app,代码行数:10,代码来源:recurly_api.py


示例11: test_invoice

    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,代码行数:16,代码来源:test_resources.py


示例12: test_pages

    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()
                    self.mock_sleep(1)

            with self.mock_request('pages/list.xml'):
                accounts = Account.all(per_page=4)
            self.assertEqual(len(accounts), 4)
            self.assertTrue(isinstance(accounts[0], Account))
            self.assertRaises(IndexError, lambda: accounts[4])
            self.assertEqual(accounts[0].account_code, account_code % 7)
            self.assertEqual(accounts[3].account_code, account_code % 4)

            # Test errors, since the first page has no first page.
            self.assertRaises(PageError, lambda: accounts.first_page())
            # Make sure PageError is a ValueError.
            self.assertRaises(ValueError, lambda: accounts.first_page())

            with self.mock_request('pages/next-list.xml'):
                next_accounts = accounts.next_page()
            # We asked for all the accounts, which may include closed accounts
            # from previous tests or data, not just the three we created.
            self.assertTrue(3 <= len(next_accounts))
            self.assertTrue(len(next_accounts) <= 4)
            self.assertTrue(isinstance(next_accounts[0], Account))
            self.assertRaises(IndexError, lambda: next_accounts[4])
            self.assertEqual(next_accounts[0].account_code, account_code % 3)
            self.assertEqual(next_accounts[2].account_code, account_code % 1)

            with self.mock_request('pages/list.xml'):  # should be just like the first
                first_accounts = next_accounts.first_page()
            self.assertEqual(len(first_accounts), 4)
            self.assertTrue(isinstance(first_accounts[0], Account))
            self.assertEqual(first_accounts[0].account_code, account_code % 7)
            self.assertEqual(first_accounts[3].account_code, account_code % 4)

        finally:
            for i, account in enumerate(all_test_accounts, 1):
                with self.mock_request('pages/account-%d-deleted.xml' % i):
                    account.delete()
开发者ID:EnHatch,项目名称:recurly-client-python,代码行数:47,代码来源:test_resources.py


示例13: booking_create_handler

def booking_create_handler():
    print "In booking create"
    user = UserController().get_item(session['email']) if 'email' in session else None
    if user:
        form = request.form
        space_id = form['space_id']
        room_id = form['room_id']
        date = form['date']
        start = form['start']
        end = form['end']
        print date, start, end
        controller = BookingController()
        account = Account.get(user['email'])
        account.billing_info = BillingInfo(token_id = form['recurly-token'])
        account.save()
        transaction = Transaction(
          amount_in_cents=int(form['amount'])*100,
          currency='INR',
          account=account
        )
        transaction.save()
        success = False
        if transaction.status == 'success':
            third_party_user_controller = ThirdPartyUserController()
            tp_user = third_party_user_controller.get_item(user['email'], 'cobot')
            from_time = datetime.datetime.strptime(date+' '+start, '%Y-%m-%d %H:%M')
            to_time = datetime.datetime.strptime(date+' '+end, '%Y-%m-%d %H:%M')
            print from_time, to_time
            type='room'
            api = CobotAPI()
            result = api.create_booking(tp_user['id'], from_time, to_time, type+'_'+space_id+'_'+room_id+'_'+str(from_time)+'_'+str(to_time))
            print result
            #create_booking(type='room', space_id=space_id, room_id=room_id, date=date, start_time=start, end_time=end)
            success = True
            bookings = api.list_bookings(tp_user['id'], from_time, to_time)
            print bookings
        return json.dumps({'success':success})
开发者ID:ashray-velapanur,项目名称:grind_app_flask,代码行数:37,代码来源:bookings.py


示例14: test_billing_info

    def test_billing_info(self):
        logging.basicConfig(level=logging.DEBUG)  # make sure it's init'ed
        logger = logging.getLogger('recurly.http.request')
        logger.setLevel(logging.DEBUG)

        log_content = StringIO()
        log_handler = logging.StreamHandler(log_content)
        logger.addHandler(log_handler)

        account = Account(account_code='binfo%s' % self.test_id)
        with self.mock_request('billing-info/account-created.xml'):
            account.save()

        logger.removeHandler(log_handler)
        self.assertTrue('<account' in log_content.getvalue())

        try:

            # Billing info link won't be present at all yet.
            self.assertRaises(AttributeError, getattr, account, 'billing_info')

            log_content = StringIO()
            log_handler = logging.StreamHandler(log_content)
            logger.addHandler(log_handler)

            binfo = BillingInfo(
                first_name='Verena',
                last_name='Example',
                address1='123 Main St',
                city=u'San Jos\xe9',
                state='CA',
                zip='94105',
                country='US',
                type='credit_card',
                number='4111 1111 1111 1111',
                verification_value='7777',
                year='2015',
                month='12',
            )
            with self.mock_request('billing-info/created.xml'):
                account.update_billing_info(binfo)

            logger.removeHandler(log_handler)
            log_content = log_content.getvalue()
            self.assertTrue('<billing_info' in log_content)
            # See if we redacted our sensitive fields properly.
            self.assertTrue('4111' not in log_content)
            self.assertTrue('7777' not in log_content)

            with self.mock_request('billing-info/account-exists.xml'):
                same_account = Account.get('binfo%s' % self.test_id)
            with self.mock_request('billing-info/exists.xml'):
                same_binfo = same_account.billing_info
            self.assertEqual(same_binfo.first_name, 'Verena')
            self.assertEqual(same_binfo.city, u'San Jos\xe9')

            with self.mock_request('billing-info/deleted.xml'):
                binfo.delete()
        finally:
            with self.mock_request('billing-info/account-deleted.xml'):
                account.delete()

        log_content = StringIO()
        log_handler = logging.StreamHandler(log_content)
        logger.addHandler(log_handler)

        account = Account(account_code='binfo-%s-2' % self.test_id)
        account.billing_info = BillingInfo(
            first_name='Verena',
            last_name='Example',
            address1='123 Main St',
            city=u'San Jos\xe9',
            state='CA',
            zip='94105',
            country='US',
            type='credit_card',
            number='4111 1111 1111 1111',
            verification_value='7777',
            year='2015',
            month='12',
        )
        with self.mock_request('billing-info/account-embed-created.xml'):
            account.save()

        try:
            logger.removeHandler(log_handler)
            log_content = log_content.getvalue()
            self.assertTrue('<account' in log_content)
            self.assertTrue('<billing_info' in log_content)
            self.assertTrue('4111' not in log_content)
            self.assertTrue('7777' not in log_content)

            with self.mock_request('billing-info/account-embed-exists.xml'):
                same_account = Account.get('binfo-%s-2' % self.test_id)
            with self.mock_request('billing-info/embedded-exists.xml'):
                binfo = same_account.billing_info
            self.assertEqual(binfo.first_name, 'Verena')
        finally:
            with self.mock_request('billing-info/account-embed-deleted.xml'):
                account.delete()
开发者ID:mbeale,项目名称:recurly-client-python,代码行数:100,代码来源:test_resources.py


示例15: str

                suberror = exc.errors['account.email']
                self.assertEqual(suberror.symbol, 'invalid_email')
                self.assertTrue(suberror.message)
                self.assertEqual(suberror.message, str(suberror))
            else:
                self.fail("Updating account with invalid email address did not raise a ValidationError")

        account.email = '[email protected]'
        with self.mock_request('account/updated.xml'):
            account.save()

        with self.mock_request('account/deleted.xml'):
            account.delete()

        with self.mock_request('account/list-closed.xml'):
            closed = Account.all_closed()
        self.assertTrue(len(closed) >= 1)
        self.assertEqual(closed[0].account_code, account_code)

        with self.mock_request('account/list-active-when-closed.xml'):
            active = Account.all_active()
        self.assertTrue(len(active) < 1 or active[0].account_code != account_code)

        # Make sure we can reopen a closed account.
        with self.mock_request('account/reopened.xml'):
            account.reopen()
        try:
            with self.mock_request('account/list-active.xml'):
                active = Account.all_active()
            self.assertTrue(len(active) >= 1)
            self.assertEqual(active[0].account_code, account_code)
开发者ID:mbeale,项目名称:recurly-client-python,代码行数:31,代码来源:test_resources.py


示例16: test_account_notes

    def test_account_notes(self):
        account1 = Account(account_code='note%s' % self.test_id)
        account2 = Account(account_code='note%s' % self.test_id)

        with self.mock_request('account-notes/account1-created.xml'):
            account1.save()
        with self.mock_request('account-notes/account2-created.xml'):
            account2.save()
        try:
            with self.mock_request('account-notes/account1-note-list.xml'):
                notes1 = account1.notes()
            with self.mock_request('account-notes/account2-note-list.xml'):
                notes2 = account2.notes()

            # assert accounts don't share notes
            self.assertNotEqual(notes1, notes2)

            # assert contains the proper notes
            self.assertEqual(notes1[0].message, "Python Madness")
            self.assertEqual(notes1[1].message, "Some message")
            self.assertEqual(notes2[0].message, "Foo Bar")
            self.assertEqual(notes2[1].message, "Baz Boo Bop")

        finally:
            with self.mock_request('account-notes/account1-deleted.xml'):
                account1.delete()
            with self.mock_request('account-notes/account2-deleted.xml'):
                account2.delete()
开发者ID:issuu,项目名称:recurly-client-python,代码行数:28,代码来源:test_resources.py


示例17: test_invoice

    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')
开发者ID:issuu,项目名称:recurly-client-python,代码行数:37,代码来源:test_resources.py


示例18: test_subscribe_add_on

    def test_subscribe_add_on(self):
        plan = Plan(
            plan_code='basicplan',
            name='Basic Plan',
            setup_fee_in_cents=Money(0),
            unit_amount_in_cents=Money(1000),
        )
        with self.mock_request('subscribe-add-on/plan-created.xml'):
            plan.save()

        try:

            add_on = AddOn(
                add_on_code='mock_add_on',
                name='Mock Add-On',
                unit_amount_in_cents=Money(100),
            )
            with self.mock_request('subscribe-add-on/add-on-created.xml'):
                plan.create_add_on(add_on)

            second_add_on = AddOn(
                add_on_code='second_add_on',
                name='Second Add-On',
                unit_amount_in_cents=Money(50),
            )
            with self.mock_request('subscribe-add-on/second-add-on-created.xml'):
                plan.create_add_on(second_add_on)

            account_code='sad-on-%s' % self.test_id
            sub = Subscription(
                plan_code='basicplan',
                subscription_add_ons=[
                    SubscriptionAddOn(
                        add_on_code='mock_add_on',
                    ),
                    SubscriptionAddOn(
                        add_on_code='second_add_on',
                    ),
                ],
                currency='USD',
                account=Account(
                    account_code=account_code,
                    billing_info=BillingInfo(
                        first_name='Verena',
                        last_name='Example',
                        number='4111 1111 1111 1111',
                        address1='123 Main St',
                        city='San Francisco',
                        state='CA',
                        zip='94105',
                        country='US',
                        verification_value='7777',
                        year='2015',
                        month='12',
                    ),
                ),
            )
            with self.mock_request('subscribe-add-on/subscribed.xml'):
                sub.save()

            # Subscription amounts are in one real currency, so they aren't Money instances.
            sub_amount = sub.unit_amount_in_cents
            self.assertTrue(not isinstance(sub_amount, Money))
            self.assertEqual(sub_amount, 1000)

            # Test that the add-ons' amounts aren't real Money instances either.
            add_on_1, add_on_2 = sub.subscription_add_ons
            self.assertIsInstance(add_on_1, SubscriptionAddOn)
            amount_1 = add_on_1.unit_amount_in_cents
            self.assertTrue(not isinstance(amount_1, Money))
            self.assertEqual(amount_1, 100)

            with self.mock_request('subscribe-add-on/account-exists.xml'):
                account = Account.get(account_code)
            with self.mock_request('subscribe-add-on/account-deleted.xml'):
                account.delete()

        finally:
            with self.mock_request('subscribe-add-on/plan-deleted.xml'):
                plan.delete()
开发者ID:mbeale,项目名称:recurly-client-python,代码行数:80,代码来源:test_resources.py


示例19: test_invoice

    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,代码行数:44,代码来源:test_resources.py


示例20: test_subscribe

    def test_subscribe(self):
        logging.basicConfig(level=logging.DEBUG)  # make sure it's init'ed
        logger = logging.getLogger("recurly.http.request")
        logger.setLevel(logging.DEBUG)

        plan = Plan(
            plan_code="basicplan", name="Basic Plan", setup_fee_in_cents=Money(0), unit_amount_in_cents=Money(1000)
        )
        with self.mock_request("subscription/plan-created.xml"):
            plan.save()

        try:
            account = Account(account_code="subscribe%s" % self.test_id)
            with self.mock_request("subscription/account-created.xml"):
                account.save()

            try:

                sub = Subscription(
                    plan_code="basicplan",
                    currency="USD",
                    unit_amount_in_cents=1000,
                    bulk=True,
                    terms_and_conditions="Some Terms and Conditions",
                    customer_notes="Some Customer Notes",
                )

                with self.mock_request("subscription/error-no-billing-info.xml"):
                    try:
                        account.subscribe(sub)
                    except BadRequestError as exc:
                        error = exc
                    else:
                        self.fail("Subscribing with no billing info did not raise a BadRequestError")
                self.assertEqual(error.symbol, "billing_info_required")

                binfo = BillingInfo(
                    first_name="Verena",
                    last_name="Example",
                    address1="123 Main St",
                    city=six.u("San Jos\xe9"),
                    state="CA",
                    zip="94105",
                    country="US",
                    type="credit_card",
                    number="4111 1111 1111 1111",
                    verification_value="7777",
                    year="2015",
                    month="12",
                )
                with self.mock_request("subscription/update-billing-info.xml"):
                    account.update_billing_info(binfo)

                with self.mock_request("subscription/subscribed.xml"):
                    account.subscribe(sub)
                self.assertTrue(sub._url)

                manualsub = Subscription(
                    plan_code="basicplan", currency="USD", net_terms=10, po_number="1000", collection_method="manual"
                )
                with self.mock_request("subscription/subscribed-manual.xml"):
                    account.subscribe(manualsub)
                self.assertTrue(manualsub._url)
                self.assertEqual(manualsub.net_terms, 10)
                self.assertEqual(manualsub.collection_method, "manual")
                self.assertEqual(manualsub.po_number, "1000")

                with self.mock_request("subscription/account-subscriptions.xml"):
                    subs = account.subscriptions()
                self.assertTrue(len(subs) > 0)
                self.assertEqual(subs[0].uuid, sub.uuid)

                with self.mock_request("subscription/all-subscriptions.xml"):
                    subs = Subscription.all()
                self.assertTrue(len(subs) > 0)
                self.assertEqual(subs[0].uuid, sub.uuid)

                with self.mock_request("subscription/cancelled.xml"):
                    sub.cancel()
                with self.mock_request("subscription/reactivated.xml"):
                    sub.reactivate()

                # Try modifying the subscription.
                sub.timeframe = "renewal"
                sub.unit_amount_in_cents = 800
                with self.mock_request("subscription/updated-at-renewal.xml"):
                    sub.save()
                pending_sub = sub.pending_subscription
                self.assertTrue(isinstance(pending_sub, Subscription))
                self.assertEqual(pending_sub.unit_amount_in_cents, 800)
                self.assertEqual(sub.unit_amount_in_cents, 1000)

                with self.mock_request("subscription/terminated.xml"):
                    sub.terminate(refund="none")

                log_content = StringIO()
                log_handler = logging.StreamHandler(log_content)
                logger.addHandler(log_handler)

                sub = Subscription(
#.........这里部分代码省略.........
开发者ID:tbartelmess,项目名称:recurly-client-python,代码行数:101,代码来源:test_resources.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python recurly.Plan类代码示例发布时间:2022-05-26
下一篇:
Python recurly.base_uri函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap