chargebee 2.7.9 → 2.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +118 -1
- data/chargebee.gemspec +8 -2
- data/lib/chargebee.rb +1 -1
- data/lib/chargebee/models/addon.rb +4 -3
- data/lib/chargebee/models/attached_item.rb +35 -0
- data/lib/chargebee/models/coupon.rb +18 -2
- data/lib/chargebee/models/credit_note.rb +2 -2
- data/lib/chargebee/models/credit_note_estimate.rb +2 -2
- data/lib/chargebee/models/customer.rb +7 -7
- data/lib/chargebee/models/differential_price.rb +39 -0
- data/lib/chargebee/models/estimate.rb +32 -0
- data/lib/chargebee/models/export.rb +20 -0
- data/lib/chargebee/models/gift.rb +4 -0
- data/lib/chargebee/models/hosted_page.rb +12 -0
- data/lib/chargebee/models/invoice.rb +14 -2
- data/lib/chargebee/models/invoice_estimate.rb +2 -2
- data/lib/chargebee/models/item.rb +37 -0
- data/lib/chargebee/models/item_family.rb +30 -0
- data/lib/chargebee/models/item_price.rb +47 -0
- data/lib/chargebee/models/payment_intent.rb +2 -2
- data/lib/chargebee/models/plan.rb +6 -6
- data/lib/chargebee/models/promotional_credit.rb +2 -2
- data/lib/chargebee/models/quote.rb +13 -1
- data/lib/chargebee/models/quote_line_group.rb +1 -1
- data/lib/chargebee/models/quoted_subscription.rb +11 -3
- data/lib/chargebee/models/subscription.rb +53 -7
- data/lib/chargebee/models/transaction.rb +4 -0
- data/lib/chargebee/models/unbilled_charge.rb +7 -2
- data/lib/chargebee/models/usage.rb +31 -0
- data/lib/chargebee/result.rb +44 -5
- metadata +23 -16
@@ -83,5 +83,25 @@ end
|
|
83
83
|
Request.send('post', uri_path("exports","orders"), params, env, headers)
|
84
84
|
end
|
85
85
|
|
86
|
+
def self.item_families(params={}, env=nil, headers={})
|
87
|
+
Request.send('post', uri_path("exports","item_families"), params, env, headers)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.items(params={}, env=nil, headers={})
|
91
|
+
Request.send('post', uri_path("exports","items"), params, env, headers)
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.item_prices(params={}, env=nil, headers={})
|
95
|
+
Request.send('post', uri_path("exports","item_prices"), params, env, headers)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.attached_items(params={}, env=nil, headers={})
|
99
|
+
Request.send('post', uri_path("exports","attached_items"), params, env, headers)
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.differential_prices(params={}, env=nil, headers={})
|
103
|
+
Request.send('post', uri_path("exports","differential_prices"), params, env, headers)
|
104
|
+
end
|
105
|
+
|
86
106
|
end # ~Export
|
87
107
|
end # ~ChargeBee
|
@@ -23,6 +23,10 @@ module ChargeBee
|
|
23
23
|
Request.send('post', uri_path("gifts"), params, env, headers)
|
24
24
|
end
|
25
25
|
|
26
|
+
def self.create_for_items(params, env=nil, headers={})
|
27
|
+
Request.send('post', uri_path("gifts","create_for_items"), params, env, headers)
|
28
|
+
end
|
29
|
+
|
26
30
|
def self.retrieve(id, env=nil, headers={})
|
27
31
|
Request.send('get', uri_path("gifts",id.to_s), {}, env, headers)
|
28
32
|
end
|
@@ -22,10 +22,22 @@ module ChargeBee
|
|
22
22
|
Request.send('post', uri_path("hosted_pages","checkout_new"), params, env, headers)
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.checkout_one_time(params={}, env=nil, headers={})
|
26
|
+
Request.send('post', uri_path("hosted_pages","checkout_one_time"), params, env, headers)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.checkout_new_for_items(params, env=nil, headers={})
|
30
|
+
Request.send('post', uri_path("hosted_pages","checkout_new_for_items"), params, env, headers)
|
31
|
+
end
|
32
|
+
|
25
33
|
def self.checkout_existing(params, env=nil, headers={})
|
26
34
|
Request.send('post', uri_path("hosted_pages","checkout_existing"), params, env, headers)
|
27
35
|
end
|
28
36
|
|
37
|
+
def self.checkout_existing_for_items(params, env=nil, headers={})
|
38
|
+
Request.send('post', uri_path("hosted_pages","checkout_existing_for_items"), params, env, headers)
|
39
|
+
end
|
40
|
+
|
29
41
|
def self.update_card(params, env=nil, headers={})
|
30
42
|
Request.send('post', uri_path("hosted_pages","update_card"), params, env, headers)
|
31
43
|
end
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
2
2
|
class Invoice < Model
|
3
3
|
|
4
4
|
class LineItem < Model
|
5
|
-
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
5
|
+
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :unit_amount_in_decimal, :quantity_in_decimal, :amount_in_decimal, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
6
6
|
end
|
7
7
|
|
8
8
|
class Discount < Model
|
@@ -22,7 +22,7 @@ module ChargeBee
|
|
22
22
|
end
|
23
23
|
|
24
24
|
class LineItemTier < Model
|
25
|
-
attr_accessor :line_item_id, :starting_unit, :ending_unit, :quantity_used, :unit_amount
|
25
|
+
attr_accessor :line_item_id, :starting_unit, :ending_unit, :quantity_used, :unit_amount, :starting_unit_in_decimal, :ending_unit_in_decimal, :quantity_used_in_decimal, :unit_amount_in_decimal
|
26
26
|
end
|
27
27
|
|
28
28
|
class LinkedPayment < Model
|
@@ -78,6 +78,10 @@ module ChargeBee
|
|
78
78
|
Request.send('post', uri_path("invoices"), params, env, headers)
|
79
79
|
end
|
80
80
|
|
81
|
+
def self.create_for_charge_items_and_charges(params={}, env=nil, headers={})
|
82
|
+
Request.send('post', uri_path("invoices","create_for_charge_items_and_charges"), params, env, headers)
|
83
|
+
end
|
84
|
+
|
81
85
|
def self.charge(params, env=nil, headers={})
|
82
86
|
Request.send('post', uri_path("invoices","charge"), params, env, headers)
|
83
87
|
end
|
@@ -86,6 +90,10 @@ module ChargeBee
|
|
86
90
|
Request.send('post', uri_path("invoices","charge_addon"), params, env, headers)
|
87
91
|
end
|
88
92
|
|
93
|
+
def self.create_for_charge_item(params, env=nil, headers={})
|
94
|
+
Request.send('post', uri_path("invoices","create_for_charge_item"), params, env, headers)
|
95
|
+
end
|
96
|
+
|
89
97
|
def self.stop_dunning(id, params={}, env=nil, headers={})
|
90
98
|
Request.send('post', uri_path("invoices",id.to_s,"stop_dunning"), params, env, headers)
|
91
99
|
end
|
@@ -130,6 +138,10 @@ module ChargeBee
|
|
130
138
|
Request.send('post', uri_path("invoices",id.to_s,"add_addon_charge"), params, env, headers)
|
131
139
|
end
|
132
140
|
|
141
|
+
def self.add_charge_item(id, params, env=nil, headers={})
|
142
|
+
Request.send('post', uri_path("invoices",id.to_s,"add_charge_item"), params, env, headers)
|
143
|
+
end
|
144
|
+
|
133
145
|
def self.close(id, params={}, env=nil, headers={})
|
134
146
|
Request.send('post', uri_path("invoices",id.to_s,"close"), params, env, headers)
|
135
147
|
end
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
2
2
|
class InvoiceEstimate < Model
|
3
3
|
|
4
4
|
class LineItem < Model
|
5
|
-
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
5
|
+
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :unit_amount_in_decimal, :quantity_in_decimal, :amount_in_decimal, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
6
6
|
end
|
7
7
|
|
8
8
|
class Discount < Model
|
@@ -18,7 +18,7 @@ module ChargeBee
|
|
18
18
|
end
|
19
19
|
|
20
20
|
class LineItemTier < Model
|
21
|
-
attr_accessor :line_item_id, :starting_unit, :ending_unit, :quantity_used, :unit_amount
|
21
|
+
attr_accessor :line_item_id, :starting_unit, :ending_unit, :quantity_used, :unit_amount, :starting_unit_in_decimal, :ending_unit_in_decimal, :quantity_used_in_decimal, :unit_amount_in_decimal
|
22
22
|
end
|
23
23
|
|
24
24
|
class LineItemDiscount < Model
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class Item < Model
|
3
|
+
|
4
|
+
class ApplicableItem < Model
|
5
|
+
attr_accessor :id
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :id, :name, :description, :status, :resource_version, :updated_at, :item_family_id,
|
9
|
+
:type, :is_shippable, :is_giftable, :redirect_url, :enabled_for_checkout, :enabled_in_portal,
|
10
|
+
:included_in_mrr, :item_applicability, :gift_claim_redirect_url, :unit, :metered, :usage_calculation,
|
11
|
+
:applicable_items, :metadata
|
12
|
+
|
13
|
+
# OPERATIONS
|
14
|
+
#-----------
|
15
|
+
|
16
|
+
def self.create(params, env=nil, headers={})
|
17
|
+
Request.send('post', uri_path("items"), params, env, headers)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.retrieve(id, env=nil, headers={})
|
21
|
+
Request.send('get', uri_path("items",id.to_s), {}, env, headers)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.update(id, params={}, env=nil, headers={})
|
25
|
+
Request.send('post', uri_path("items",id.to_s), params, env, headers)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.list(params={}, env=nil, headers={})
|
29
|
+
Request.send_list_request('get', uri_path("items"), params, env, headers)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.delete(id, env=nil, headers={})
|
33
|
+
Request.send('post', uri_path("items",id.to_s,"delete"), {}, env, headers)
|
34
|
+
end
|
35
|
+
|
36
|
+
end # ~Item
|
37
|
+
end # ~ChargeBee
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class ItemFamily < Model
|
3
|
+
|
4
|
+
attr_accessor :id, :name, :description, :status, :resource_version, :updated_at
|
5
|
+
|
6
|
+
# OPERATIONS
|
7
|
+
#-----------
|
8
|
+
|
9
|
+
def self.create(params, env=nil, headers={})
|
10
|
+
Request.send('post', uri_path("item_families"), params, env, headers)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.retrieve(id, env=nil, headers={})
|
14
|
+
Request.send('get', uri_path("item_families",id.to_s), {}, env, headers)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.list(params={}, env=nil, headers={})
|
18
|
+
Request.send_list_request('get', uri_path("item_families"), params, env, headers)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.update(id, params={}, env=nil, headers={})
|
22
|
+
Request.send('post', uri_path("item_families",id.to_s), params, env, headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.delete(id, env=nil, headers={})
|
26
|
+
Request.send('post', uri_path("item_families",id.to_s,"delete"), {}, env, headers)
|
27
|
+
end
|
28
|
+
|
29
|
+
end # ~ItemFamily
|
30
|
+
end # ~ChargeBee
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class ItemPrice < Model
|
3
|
+
|
4
|
+
class Tier < Model
|
5
|
+
attr_accessor :starting_unit, :ending_unit, :price, :starting_unit_in_decimal, :ending_unit_in_decimal, :price_in_decimal
|
6
|
+
end
|
7
|
+
|
8
|
+
class TaxDetail < Model
|
9
|
+
attr_accessor :tax_profile_id, :avalara_sale_type, :avalara_transaction_type, :avalara_service_type, :avalara_tax_code, :taxjar_product_code
|
10
|
+
end
|
11
|
+
|
12
|
+
class AccountingDetail < Model
|
13
|
+
attr_accessor :sku, :accounting_code, :accounting_category1, :accounting_category2
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_accessor :id, :name, :item_family_id, :item_id, :description, :status, :external_name,
|
17
|
+
:pricing_model, :price, :period, :currency_code, :period_unit, :trial_period, :trial_period_unit,
|
18
|
+
:shipping_period, :shipping_period_unit, :billing_cycles, :free_quantity, :free_quantity_in_decimal,
|
19
|
+
:price_in_decimal, :resource_version, :updated_at, :created_at, :invoice_notes, :tiers, :is_taxable,
|
20
|
+
:tax_detail, :accounting_detail, :metadata, :item_type, :archivable, :parent_item_id, :show_description_in_invoices,
|
21
|
+
:show_description_in_quotes
|
22
|
+
|
23
|
+
# OPERATIONS
|
24
|
+
#-----------
|
25
|
+
|
26
|
+
def self.create(params, env=nil, headers={})
|
27
|
+
Request.send('post', uri_path("item_prices"), params, env, headers)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.retrieve(id, env=nil, headers={})
|
31
|
+
Request.send('get', uri_path("item_prices",id.to_s), {}, env, headers)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.update(id, params={}, env=nil, headers={})
|
35
|
+
Request.send('post', uri_path("item_prices",id.to_s), params, env, headers)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.list(params={}, env=nil, headers={})
|
39
|
+
Request.send_list_request('get', uri_path("item_prices"), params, env, headers)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.delete(id, env=nil, headers={})
|
43
|
+
Request.send('post', uri_path("item_prices",id.to_s,"delete"), {}, env, headers)
|
44
|
+
end
|
45
|
+
|
46
|
+
end # ~ItemPrice
|
47
|
+
end # ~ChargeBee
|
@@ -6,8 +6,8 @@ module ChargeBee
|
|
6
6
|
end
|
7
7
|
|
8
8
|
attr_accessor :id, :status, :currency_code, :amount, :gateway_account_id, :expires_at, :reference_id,
|
9
|
-
:payment_method_type, :
|
10
|
-
:gateway, :active_payment_attempt
|
9
|
+
:payment_method_type, :success_url, :failure_url, :created_at, :modified_at, :resource_version,
|
10
|
+
:updated_at, :customer_id, :gateway, :active_payment_attempt
|
11
11
|
|
12
12
|
# OPERATIONS
|
13
13
|
#-----------
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
2
2
|
class Plan < Model
|
3
3
|
|
4
4
|
class Tier < Model
|
5
|
-
attr_accessor :starting_unit, :ending_unit, :price
|
5
|
+
attr_accessor :starting_unit, :ending_unit, :price, :starting_unit_in_decimal, :ending_unit_in_decimal, :price_in_decimal
|
6
6
|
end
|
7
7
|
|
8
8
|
class ApplicableAddon < Model
|
@@ -10,11 +10,11 @@ module ChargeBee
|
|
10
10
|
end
|
11
11
|
|
12
12
|
class AttachedAddon < Model
|
13
|
-
attr_accessor :id, :quantity, :billing_cycles, :type
|
13
|
+
attr_accessor :id, :quantity, :billing_cycles, :type, :quantity_in_decimal
|
14
14
|
end
|
15
15
|
|
16
16
|
class EventBasedAddon < Model
|
17
|
-
attr_accessor :id, :quantity, :on_event, :charge_once
|
17
|
+
attr_accessor :id, :quantity, :on_event, :charge_once, :quantity_in_decimal
|
18
18
|
end
|
19
19
|
|
20
20
|
attr_accessor :id, :name, :invoice_name, :description, :price, :currency_code, :period, :period_unit,
|
@@ -23,9 +23,9 @@ module ChargeBee
|
|
23
23
|
:enabled_in_portal, :addon_applicability, :tax_code, :taxjar_product_code, :avalara_sale_type,
|
24
24
|
:avalara_transaction_type, :avalara_service_type, :sku, :accounting_code, :accounting_category1,
|
25
25
|
:accounting_category2, :is_shippable, :shipping_frequency_period, :shipping_frequency_period_unit,
|
26
|
-
:resource_version, :updated_at, :giftable, :claim_url, :
|
27
|
-
:
|
28
|
-
:show_description_in_quotes
|
26
|
+
:resource_version, :updated_at, :giftable, :claim_url, :free_quantity_in_decimal, :price_in_decimal,
|
27
|
+
:invoice_notes, :taxable, :tax_profile_id, :meta_data, :tiers, :applicable_addons, :attached_addons,
|
28
|
+
:event_based_addons, :show_description_in_invoices, :show_description_in_quotes
|
29
29
|
|
30
30
|
# OPERATIONS
|
31
31
|
#-----------
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class PromotionalCredit < Model
|
3
3
|
|
4
|
-
attr_accessor :id, :customer_id, :type, :amount, :currency_code, :description,
|
5
|
-
:reference, :closing_balance, :done_by, :created_at
|
4
|
+
attr_accessor :id, :customer_id, :type, :amount_in_decimal, :amount, :currency_code, :description,
|
5
|
+
:credit_type, :reference, :closing_balance, :done_by, :created_at
|
6
6
|
|
7
7
|
# OPERATIONS
|
8
8
|
#-----------
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
2
2
|
class Quote < Model
|
3
3
|
|
4
4
|
class LineItem < Model
|
5
|
-
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
5
|
+
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :unit_amount_in_decimal, :quantity_in_decimal, :amount_in_decimal, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
6
6
|
end
|
7
7
|
|
8
8
|
class Discount < Model
|
@@ -50,6 +50,10 @@ module ChargeBee
|
|
50
50
|
Request.send('post', uri_path("quotes",id.to_s,"edit_create_subscription_quote"), params, env, headers)
|
51
51
|
end
|
52
52
|
|
53
|
+
def self.create_sub_items_for_customer_quote(id, params, env=nil, headers={})
|
54
|
+
Request.send('post', uri_path("customers",id.to_s,"create_subscription_quote_for_items"), params, env, headers)
|
55
|
+
end
|
56
|
+
|
53
57
|
def self.update_subscription_quote(params, env=nil, headers={})
|
54
58
|
Request.send('post', uri_path("quotes","update_subscription_quote"), params, env, headers)
|
55
59
|
end
|
@@ -58,10 +62,18 @@ module ChargeBee
|
|
58
62
|
Request.send('post', uri_path("quotes",id.to_s,"edit_update_subscription_quote"), params, env, headers)
|
59
63
|
end
|
60
64
|
|
65
|
+
def self.update_subscription_quote_for_items(params, env=nil, headers={})
|
66
|
+
Request.send('post', uri_path("quotes","update_subscription_quote_for_items"), params, env, headers)
|
67
|
+
end
|
68
|
+
|
61
69
|
def self.create_for_onetime_charges(params, env=nil, headers={})
|
62
70
|
Request.send('post', uri_path("quotes","create_for_onetime_charges"), params, env, headers)
|
63
71
|
end
|
64
72
|
|
73
|
+
def self.create_for_charge_items_and_charges(params, env=nil, headers={})
|
74
|
+
Request.send('post', uri_path("quotes","create_for_charge_items_and_charges"), params, env, headers)
|
75
|
+
end
|
76
|
+
|
65
77
|
def self.edit_one_time_quote(id, params={}, env=nil, headers={})
|
66
78
|
Request.send('post', uri_path("quotes",id.to_s,"edit_one_time_quote"), params, env, headers)
|
67
79
|
end
|
@@ -2,7 +2,7 @@ module ChargeBee
|
|
2
2
|
class QuoteLineGroup < Model
|
3
3
|
|
4
4
|
class LineItem < Model
|
5
|
-
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
5
|
+
attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :unit_amount_in_decimal, :quantity_in_decimal, :amount_in_decimal, :discount_amount, :item_level_discount_amount, :description, :entity_description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
|
6
6
|
end
|
7
7
|
|
8
8
|
class Discount < Model
|
@@ -2,20 +2,28 @@ module ChargeBee
|
|
2
2
|
class QuotedSubscription < Model
|
3
3
|
|
4
4
|
class Addon < Model
|
5
|
-
attr_accessor :id, :quantity, :unit_price, :amount, :trial_end, :remaining_billing_cycles
|
5
|
+
attr_accessor :id, :quantity, :unit_price, :amount, :trial_end, :remaining_billing_cycles, :quantity_in_decimal, :unit_price_in_decimal, :amount_in_decimal
|
6
6
|
end
|
7
7
|
|
8
8
|
class EventBasedAddon < Model
|
9
|
-
attr_accessor :id, :quantity, :unit_price, :service_period_in_days, :on_event, :charge_once
|
9
|
+
attr_accessor :id, :quantity, :unit_price, :service_period_in_days, :on_event, :charge_once, :quantity_in_decimal, :unit_price_in_decimal
|
10
10
|
end
|
11
11
|
|
12
12
|
class Coupon < Model
|
13
13
|
attr_accessor :coupon_id, :apply_till, :applied_count, :coupon_code
|
14
14
|
end
|
15
15
|
|
16
|
+
class SubscriptionItem < Model
|
17
|
+
attr_accessor :item_price_id, :item_type, :quantity, :unit_price, :amount, :free_quantity, :trial_end, :billing_cycles, :service_period_days, :charge_on_event, :charge_once, :charge_on_option
|
18
|
+
end
|
19
|
+
|
20
|
+
class ItemTier < Model
|
21
|
+
attr_accessor :item_price_id, :starting_unit, :ending_unit, :price
|
22
|
+
end
|
23
|
+
|
16
24
|
attr_accessor :id, :plan_id, :plan_quantity, :plan_unit_price, :setup_fee, :billing_period,
|
17
25
|
:billing_period_unit, :start_date, :trial_end, :remaining_billing_cycles, :po_number, :auto_collection,
|
18
|
-
:addons, :event_based_addons, :coupons
|
26
|
+
:addons, :event_based_addons, :coupons, :subscription_items, :item_tiers
|
19
27
|
|
20
28
|
# OPERATIONS
|
21
29
|
#-----------
|
@@ -1,12 +1,24 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class Subscription < Model
|
3
3
|
|
4
|
+
class SubscriptionItem < Model
|
5
|
+
attr_accessor :item_price_id, :item_type, :quantity, :metered_quantity, :last_calculated_at, :unit_price, :amount, :free_quantity, :trial_end, :billing_cycles, :service_period_days, :charge_on_event, :charge_once, :charge_on_option
|
6
|
+
end
|
7
|
+
|
8
|
+
class ItemTier < Model
|
9
|
+
attr_accessor :item_price_id, :starting_unit, :ending_unit, :price, :starting_unit_in_decimal, :ending_unit_in_decimal, :price_in_decimal
|
10
|
+
end
|
11
|
+
|
12
|
+
class ChargedItem < Model
|
13
|
+
attr_accessor :item_price_id, :last_charged_at
|
14
|
+
end
|
15
|
+
|
4
16
|
class Addon < Model
|
5
|
-
attr_accessor :id, :quantity, :unit_price, :amount, :trial_end, :remaining_billing_cycles
|
17
|
+
attr_accessor :id, :quantity, :unit_price, :amount, :trial_end, :remaining_billing_cycles, :quantity_in_decimal, :unit_price_in_decimal, :amount_in_decimal
|
6
18
|
end
|
7
19
|
|
8
20
|
class EventBasedAddon < Model
|
9
|
-
attr_accessor :id, :quantity, :unit_price, :service_period_in_days, :on_event, :charge_once
|
21
|
+
attr_accessor :id, :quantity, :unit_price, :service_period_in_days, :on_event, :charge_once, :quantity_in_decimal, :unit_price_in_decimal
|
10
22
|
end
|
11
23
|
|
12
24
|
class ChargedEventBasedAddon < Model
|
@@ -34,11 +46,13 @@ module ChargeBee
|
|
34
46
|
:customer_id, :plan_amount, :plan_free_quantity, :status, :trial_start, :current_term_start,
|
35
47
|
:current_term_end, :next_billing_at, :created_at, :started_at, :activated_at, :gift_id, :contract_term_billing_cycle_on_renewal,
|
36
48
|
:override_relationship, :pause_date, :resume_date, :cancelled_at, :cancel_reason, :affiliate_token,
|
37
|
-
:created_from_ip, :resource_version, :updated_at, :
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
49
|
+
:created_from_ip, :resource_version, :updated_at, :has_scheduled_advance_invoices, :has_scheduled_changes,
|
50
|
+
:payment_source_id, :plan_free_quantity_in_decimal, :plan_quantity_in_decimal, :plan_unit_price_in_decimal,
|
51
|
+
:plan_amount_in_decimal, :offline_payment_method, :subscription_items, :item_tiers, :charged_items,
|
52
|
+
:due_invoices_count, :due_since, :total_dues, :mrr, :exchange_rate, :base_currency_code, :addons,
|
53
|
+
:event_based_addons, :charged_event_based_addons, :coupon, :coupons, :shipping_address, :referral_info,
|
54
|
+
:invoice_notes, :meta_data, :metadata, :deleted, :contract_term, :cancel_reason_code, :free_period,
|
55
|
+
:free_period_unit, :create_pending_invoices, :auto_close_invoices
|
42
56
|
|
43
57
|
# OPERATIONS
|
44
58
|
#-----------
|
@@ -51,6 +65,10 @@ module ChargeBee
|
|
51
65
|
Request.send('post', uri_path("customers",id.to_s,"subscriptions"), params, env, headers)
|
52
66
|
end
|
53
67
|
|
68
|
+
def self.create_with_items(id, params, env=nil, headers={})
|
69
|
+
Request.send('post', uri_path("customers",id.to_s,"subscription_for_items"), params, env, headers)
|
70
|
+
end
|
71
|
+
|
54
72
|
def self.list(params={}, env=nil, headers={})
|
55
73
|
Request.send_list_request('get', uri_path("subscriptions"), params, env, headers)
|
56
74
|
end
|
@@ -87,6 +105,10 @@ module ChargeBee
|
|
87
105
|
Request.send('post', uri_path("subscriptions",id.to_s), params, env, headers)
|
88
106
|
end
|
89
107
|
|
108
|
+
def self.update_for_items(id, params, env=nil, headers={})
|
109
|
+
Request.send('post', uri_path("subscriptions",id.to_s,"update_for_items"), params, env, headers)
|
110
|
+
end
|
111
|
+
|
90
112
|
def self.change_term_end(id, params, env=nil, headers={})
|
91
113
|
Request.send('post', uri_path("subscriptions",id.to_s,"change_term_end"), params, env, headers)
|
92
114
|
end
|
@@ -107,6 +129,22 @@ module ChargeBee
|
|
107
129
|
Request.send('post', uri_path("subscriptions",id.to_s,"charge_future_renewals"), params, env, headers)
|
108
130
|
end
|
109
131
|
|
132
|
+
def self.edit_advance_invoice_schedule(id, params={}, env=nil, headers={})
|
133
|
+
Request.send('post', uri_path("subscriptions",id.to_s,"edit_advance_invoice_schedule"), params, env, headers)
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.retrieve_advance_invoice_schedule(id, env=nil, headers={})
|
137
|
+
Request.send('get', uri_path("subscriptions",id.to_s,"retrieve_advance_invoice_schedule"), {}, env, headers)
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.remove_advance_invoice_schedule(id, params={}, env=nil, headers={})
|
141
|
+
Request.send('post', uri_path("subscriptions",id.to_s,"remove_advance_invoice_schedule"), params, env, headers)
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.regenerate_invoice(id, params={}, env=nil, headers={})
|
145
|
+
Request.send('post', uri_path("subscriptions",id.to_s,"regenerate_invoice"), params, env, headers)
|
146
|
+
end
|
147
|
+
|
110
148
|
def self.import_subscription(params, env=nil, headers={})
|
111
149
|
Request.send('post', uri_path("subscriptions","import_subscription"), params, env, headers)
|
112
150
|
end
|
@@ -119,6 +157,10 @@ module ChargeBee
|
|
119
157
|
Request.send('post', uri_path("subscriptions",id.to_s,"import_contract_term"), params, env, headers)
|
120
158
|
end
|
121
159
|
|
160
|
+
def self.import_for_items(id, params, env=nil, headers={})
|
161
|
+
Request.send('post', uri_path("customers",id.to_s,"import_for_items"), params, env, headers)
|
162
|
+
end
|
163
|
+
|
122
164
|
def self.override_billing_profile(id, params={}, env=nil, headers={})
|
123
165
|
Request.send('post', uri_path("subscriptions",id.to_s,"override_billing_profile"), params, env, headers)
|
124
166
|
end
|
@@ -135,6 +177,10 @@ module ChargeBee
|
|
135
177
|
Request.send('post', uri_path("subscriptions",id.to_s,"cancel"), params, env, headers)
|
136
178
|
end
|
137
179
|
|
180
|
+
def self.cancel_for_items(id, params={}, env=nil, headers={})
|
181
|
+
Request.send('post', uri_path("subscriptions",id.to_s,"cancel_for_items"), params, env, headers)
|
182
|
+
end
|
183
|
+
|
138
184
|
def self.resume(id, params={}, env=nil, headers={})
|
139
185
|
Request.send('post', uri_path("subscriptions",id.to_s,"resume"), params, env, headers)
|
140
186
|
end
|