File: plan.py

package info (click to toggle)
chargebee2-python 2.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 644 kB
  • sloc: python: 2,035; makefile: 3; sh: 3
file content (57 lines) | stat: -rw-r--r-- 2,468 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError

class Plan(Model):
    class Tier(Model):
      fields = ["starting_unit", "ending_unit", "price"]
      pass
    class ApplicableAddon(Model):
      fields = ["id"]
      pass
    class AttachedAddon(Model):
      fields = ["id", "quantity", "billing_cycles", "type"]
      pass
    class EventBasedAddon(Model):
      fields = ["id", "quantity", "on_event", "charge_once"]
      pass

    fields = ["id", "name", "invoice_name", "description", "price", "currency_code", "period", \
    "period_unit", "trial_period", "trial_period_unit", "pricing_model", "charge_model", "free_quantity", \
    "setup_cost", "downgrade_penalty", "status", "archived_at", "billing_cycles", "redirect_url", \
    "enabled_in_hosted_pages", "enabled_in_portal", "addon_applicability", "tax_code", "taxjar_product_code", \
    "avalara_sale_type", "avalara_transaction_type", "avalara_service_type", "sku", "accounting_code", \
    "accounting_category1", "accounting_category2", "is_shippable", "shipping_frequency_period", \
    "shipping_frequency_period_unit", "resource_version", "updated_at", "giftable", "claim_url", \
    "invoice_notes", "taxable", "tax_profile_id", "meta_data", "tiers", "applicable_addons", "attached_addons", \
    "event_based_addons"]


    @staticmethod
    def create(params, env=None, headers=None):
        return request.send('post', request.uri_path("plans"), params, env, headers)

    @staticmethod
    def update(id, params=None, env=None, headers=None):
        return request.send('post', request.uri_path("plans",id), params, env, headers)

    @staticmethod
    def list(params=None, env=None, headers=None):
        return request.send_list_request('get', request.uri_path("plans"), params, env, headers)

    @staticmethod
    def retrieve(id, env=None, headers=None):
        return request.send('get', request.uri_path("plans",id), None, env, headers)

    @staticmethod
    def delete(id, env=None, headers=None):
        return request.send('post', request.uri_path("plans",id,"delete"), None, env, headers)

    @staticmethod
    def copy(params, env=None, headers=None):
        return request.send('post', request.uri_path("plans","copy"), params, env, headers)

    @staticmethod
    def unarchive(id, env=None, headers=None):
        return request.send('post', request.uri_path("plans",id,"unarchive"), None, env, headers)