File: differential_price.py

package info (click to toggle)
chargebee2-python 2.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 740 kB
  • sloc: python: 2,492; makefile: 4; sh: 3
file content (36 lines) | stat: -rw-r--r-- 1,494 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
import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError

class DifferentialPrice(Model):
    class Tier(Model):
      fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in_decimal"]
      pass
    class ParentPeriod(Model):
      fields = ["period_unit", "period"]
      pass

    fields = ["id", "item_price_id", "parent_item_id", "price", "price_in_decimal", "status", \
    "resource_version", "updated_at", "created_at", "modified_at", "tiers", "currency_code", "parent_periods"]


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

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

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

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

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