chargebee 2.14.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +65 -0
- data/chargebee.gemspec +6 -2
- data/lib/chargebee/models/addon.rb +2 -2
- data/lib/chargebee/models/attached_item.rb +2 -1
- data/lib/chargebee/models/credit_note.rb +5 -1
- data/lib/chargebee/models/customer.rb +3 -3
- data/lib/chargebee/models/entitlement_override.rb +23 -0
- data/lib/chargebee/models/feature.rb +47 -0
- data/lib/chargebee/models/invoice.rb +9 -1
- data/lib/chargebee/models/item.rb +3 -3
- data/lib/chargebee/models/item_entitlement.rb +30 -0
- data/lib/chargebee/models/item_family.rb +1 -1
- data/lib/chargebee/models/item_price.rb +3 -3
- data/lib/chargebee/models/plan.rb +2 -2
- data/lib/chargebee/models/subscription.rb +1 -1
- data/lib/chargebee/models/subscription_entitlement.rb +27 -0
- data/lib/chargebee/models/unbilled_charge.rb +4 -0
- data/lib/chargebee/result.rb +24 -0
- data/lib/chargebee/util.rb +4 -17
- data/lib/chargebee.rb +1 -1
- data/spec/chargebee_spec.rb +14 -14
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e91a90da69999c446d0f339ddaccef3239841ea
|
4
|
+
data.tar.gz: 8584192a936b3f00d2c842d4747be030b571ef78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0a0dfbc6687ceb4af29180ecc689bfe9836c3ac43ec48b6e4ef601b2651c9e5d991ff584e71dae0976850ce6b32cacdca5f823500e6e3720881d211711dac5f
|
7
|
+
data.tar.gz: ee4c770b3a428cf8fabb0407c6bb5d3aa1269ffaced5909339225261b31b8522ac24a061fdea340804ac9ce35708d483ab69989174a1450ce7ee91cbd9cc2fff
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,68 @@
|
|
1
|
+
### v2.16.0 (2022-05-23)
|
2
|
+
* * *
|
3
|
+
|
4
|
+
#### New endpoints:
|
5
|
+
* invoice#sync_usages and invoice#resend_einvoice have been added to the invoice resource.
|
6
|
+
* credit_notes#resend_einvoice has been added to the credit_notes resource.
|
7
|
+
* features#list_features, features#create_a_feature, features#update_a_feature, features#retrieve_a_feature, features#delete_a_feature, features#activate_a_feature, features#archive_a_feature and features#reactivate_a_feature have been added to the features resource.
|
8
|
+
* subscription_entitlements#subscription_entitlements_for_subscription and subscription_entitlements#set_subscription_entitlement_availability have been added to the subscription_entitlements resource.
|
9
|
+
* item_entitlements#item_entitlements_for_an_item, item_entitlements#item_entitlements_for_a_feature, item_entitlements#add_an_item_entitlements and item_entitlements#upsert_or_remove_an_item_entitlements_for_item have been added to the item_entitlements resource.
|
10
|
+
* entitlement_overrides#add_entitlement_override_for_a_subscription and entitlement_overrides#list_entitlement_override_for_a_subscription have been added to the entitlement_overrides resource.
|
11
|
+
|
12
|
+
#### New Resource:
|
13
|
+
* features, subscription_entitlements, item_entitlements and entitlement_overrides have been added.
|
14
|
+
|
15
|
+
#### New filter parameters:
|
16
|
+
* einvoice[status] filter parameter has been added in credit_notes#list_credit_notes api.
|
17
|
+
|
18
|
+
#### New Enum values:
|
19
|
+
* paypal_express_checkout has been added to payment_method_type enum.
|
20
|
+
* feature_created, feature_updated, feature_deleted, feature_activated, feature_reactivated, feature_archived, item_entitlements_updated, entitlement_overrides_updated, entitlement_overrides_removed, item_entitlements_removed and entitlement_overrides_auto_removed have been added to the event_type enum.
|
21
|
+
* action enum has been added.
|
22
|
+
|
23
|
+
### v2.15.0 (2022-04-25)
|
24
|
+
* * *
|
25
|
+
|
26
|
+
#### New endpoints:
|
27
|
+
* UnbilledCharge#CreateUnbilledCharge has been added to UnbilledCharge resource. Applicable only for PC1.0.
|
28
|
+
|
29
|
+
#### New attributes:
|
30
|
+
* channel have been added to the Addon, AttachedItem, CreditNote, Customer, Invoice, ItemFamily, ItemPrice, Plan and Subscription resources.
|
31
|
+
* external_name and channel have been added to the Item resource.
|
32
|
+
|
33
|
+
#### New input parameters:
|
34
|
+
* external_name have been added to Item#CreateRequest and Item#UpdateRequest.
|
35
|
+
* channel have been added to Addon#AddonListRequest.
|
36
|
+
* channel have been added to CreditNote#CreditNoteListRequest.
|
37
|
+
* channel have been added to Customer#CustomerListRequest.
|
38
|
+
* invoice[channel], subscription[channel] and customer[channel] have been added to Export#RevenueRecognitionRequest and Export#DeferredRevenueRequest.
|
39
|
+
* plan[channel] have been added to Export#PlansRequest.
|
40
|
+
* addon[channel] have been added to Export#AddonsRequest.
|
41
|
+
* customer[channel] have been added to Export#CustomersRequest.
|
42
|
+
* subscription[channel] have been added to Export#SubscriptionsRequest.
|
43
|
+
* invoice[channel] have been added to Export#InvoicesRequest.
|
44
|
+
* credit_note[channel] have been added to Export#CreditNotesRequest.
|
45
|
+
* item[channel] have been added to Export#ItemsRequest.
|
46
|
+
* item_price[channel] have been added to Export#ItemPricesRequest.
|
47
|
+
* channel have been added to Invoice#InvoiceListRequest.
|
48
|
+
* channel have been added to Item#ItemListRequest.
|
49
|
+
* channel have been added to ItemPrice#ItemPriceListRequest.
|
50
|
+
* channel have been added to Plan#PlanListRequest.
|
51
|
+
* channel have been added to Subscription#SubscriptionListRequest.
|
52
|
+
|
53
|
+
### Existing input parameter changes:
|
54
|
+
* item_family_id in Item#CreateRequest has been made as required field.
|
55
|
+
|
56
|
+
### Removed enum values:
|
57
|
+
* coupon_expired event has been removed from EventTypeEnum.
|
58
|
+
|
59
|
+
### v2.14.1 (2022-03-31)
|
60
|
+
* * *
|
61
|
+
|
62
|
+
### Fixes:
|
63
|
+
* Fixed serialization issue.
|
64
|
+
|
65
|
+
|
1
66
|
### v2.14.0 (2022-03-14)
|
2
67
|
* * *
|
3
68
|
|
data/chargebee.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
s.required_ruby_version = '>= 1.9.3'
|
6
6
|
s.name = 'chargebee'
|
7
|
-
s.version = '2.
|
8
|
-
s.date = '2022-
|
7
|
+
s.version = '2.16.0'
|
8
|
+
s.date = '2022-05-23'
|
9
9
|
s.summary = "Ruby client for Chargebee API."
|
10
10
|
s.description = "Subscription Billing - Simple. Secure. Affordable. More details at www.chargebee.com."
|
11
11
|
|
@@ -52,15 +52,18 @@ Gem::Specification.new do |s|
|
|
52
52
|
lib/chargebee/models/customer.rb
|
53
53
|
lib/chargebee/models/differential_price.rb
|
54
54
|
lib/chargebee/models/download.rb
|
55
|
+
lib/chargebee/models/entitlement_override.rb
|
55
56
|
lib/chargebee/models/estimate.rb
|
56
57
|
lib/chargebee/models/event.rb
|
57
58
|
lib/chargebee/models/export.rb
|
59
|
+
lib/chargebee/models/feature.rb
|
58
60
|
lib/chargebee/models/gift.rb
|
59
61
|
lib/chargebee/models/hierarchy.rb
|
60
62
|
lib/chargebee/models/hosted_page.rb
|
61
63
|
lib/chargebee/models/invoice.rb
|
62
64
|
lib/chargebee/models/invoice_estimate.rb
|
63
65
|
lib/chargebee/models/item.rb
|
66
|
+
lib/chargebee/models/item_entitlement.rb
|
64
67
|
lib/chargebee/models/item_family.rb
|
65
68
|
lib/chargebee/models/item_price.rb
|
66
69
|
lib/chargebee/models/model.rb
|
@@ -77,6 +80,7 @@ Gem::Specification.new do |s|
|
|
77
80
|
lib/chargebee/models/resource_migration.rb
|
78
81
|
lib/chargebee/models/site_migration_detail.rb
|
79
82
|
lib/chargebee/models/subscription.rb
|
83
|
+
lib/chargebee/models/subscription_entitlement.rb
|
80
84
|
lib/chargebee/models/subscription_estimate.rb
|
81
85
|
lib/chargebee/models/tax_withheld.rb
|
82
86
|
lib/chargebee/models/third_party_payment_method.rb
|
@@ -10,8 +10,8 @@ module ChargeBee
|
|
10
10
|
:tax_code, :hsn_code, :taxjar_product_code, :avalara_sale_type, :avalara_transaction_type, :avalara_service_type,
|
11
11
|
:sku, :accounting_code, :accounting_category1, :accounting_category2, :accounting_category3,
|
12
12
|
:accounting_category4, :is_shippable, :shipping_frequency_period, :shipping_frequency_period_unit,
|
13
|
-
:resource_version, :updated_at, :price_in_decimal, :included_in_mrr, :
|
14
|
-
:tax_profile_id, :meta_data, :tiers, :show_description_in_invoices, :show_description_in_quotes
|
13
|
+
:resource_version, :updated_at, :price_in_decimal, :included_in_mrr, :channel, :invoice_notes,
|
14
|
+
:taxable, :tax_profile_id, :meta_data, :tiers, :show_description_in_invoices, :show_description_in_quotes
|
15
15
|
|
16
16
|
# OPERATIONS
|
17
17
|
#-----------
|
@@ -2,7 +2,8 @@ module ChargeBee
|
|
2
2
|
class AttachedItem < Model
|
3
3
|
|
4
4
|
attr_accessor :id, :parent_item_id, :item_id, :type, :status, :quantity, :quantity_in_decimal,
|
5
|
-
:billing_cycles, :charge_on_event, :charge_once, :created_at, :resource_version, :updated_at
|
5
|
+
:billing_cycles, :charge_on_event, :charge_once, :created_at, :resource_version, :updated_at,
|
6
|
+
:channel
|
6
7
|
|
7
8
|
# OPERATIONS
|
8
9
|
#-----------
|
@@ -40,7 +40,7 @@ module ChargeBee
|
|
40
40
|
attr_accessor :id, :customer_id, :subscription_id, :reference_invoice_id, :type, :reason_code,
|
41
41
|
:status, :vat_number, :date, :price_type, :currency_code, :total, :amount_allocated, :amount_refunded,
|
42
42
|
:amount_available, :refunded_at, :voided_at, :generated_at, :resource_version, :updated_at,
|
43
|
-
:einvoice, :sub_total, :sub_total_in_local_currency, :total_in_local_currency, :local_currency_code,
|
43
|
+
:channel, :einvoice, :sub_total, :sub_total_in_local_currency, :total_in_local_currency, :local_currency_code,
|
44
44
|
:round_off_amount, :fractional_correction, :line_items, :discounts, :line_item_discounts, :line_item_tiers,
|
45
45
|
:taxes, :line_item_taxes, :linked_refunds, :allocations, :deleted, :create_reason_code, :vat_number_prefix
|
46
46
|
|
@@ -87,5 +87,9 @@ module ChargeBee
|
|
87
87
|
Request.send('post', uri_path("credit_notes",id.to_s,"delete"), params, env, headers)
|
88
88
|
end
|
89
89
|
|
90
|
+
def self.resend_einvoice(id, env=nil, headers={})
|
91
|
+
Request.send('post', uri_path("credit_notes",id.to_s,"resend_einvoice"), {}, env, headers)
|
92
|
+
end
|
93
|
+
|
90
94
|
end # ~CreditNote
|
91
95
|
end # ~ChargeBee
|
@@ -41,9 +41,9 @@ module ChargeBee
|
|
41
41
|
:offline_payment_method, :net_term_days, :vat_number_validated_time, :vat_number_status, :allow_direct_debit,
|
42
42
|
:is_location_valid, :created_at, :created_from_ip, :exemption_details, :taxability, :entity_code,
|
43
43
|
:exempt_number, :resource_version, :updated_at, :locale, :billing_date, :billing_date_mode,
|
44
|
-
:billing_day_of_week, :billing_day_of_week_mode, :pii_cleared, :auto_close_invoices, :
|
45
|
-
:fraud_flag, :primary_payment_source_id, :backup_payment_source_id, :billing_address,
|
46
|
-
:contacts, :payment_method, :invoice_notes, :preferred_currency_code, :promotional_credits,
|
44
|
+
:billing_day_of_week, :billing_day_of_week_mode, :pii_cleared, :auto_close_invoices, :channel,
|
45
|
+
:card_status, :fraud_flag, :primary_payment_source_id, :backup_payment_source_id, :billing_address,
|
46
|
+
:referral_urls, :contacts, :payment_method, :invoice_notes, :preferred_currency_code, :promotional_credits,
|
47
47
|
:unbilled_charges, :refundable_credits, :excess_payments, :balances, :entity_identifiers, :is_einvoice_enabled,
|
48
48
|
:meta_data, :deleted, :registered_for_gst, :consolidated_invoicing, :customer_type, :business_customer_without_vat_number,
|
49
49
|
:client_profile_id, :relationship, :use_default_hierarchy_settings, :parent_account_access,
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class EntitlementOverride < Model
|
3
|
+
|
4
|
+
class EmbeddedResource < Model
|
5
|
+
attr_accessor
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :id, :entity_id, :entity_type, :feature_id, :feature_name, :value, :name, :expires_at,
|
9
|
+
:embedded
|
10
|
+
|
11
|
+
# OPERATIONS
|
12
|
+
#-----------
|
13
|
+
|
14
|
+
def self.add_entitlement_override_for_subscription(id, params, env=nil, headers={})
|
15
|
+
Request.send('post', uri_path("subscriptions",id.to_s,"entitlement_overrides"), params, env, headers)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.list_entitlement_override_for_subscription(id, params={}, env=nil, headers={})
|
19
|
+
Request.send('get', uri_path("subscriptions",id.to_s,"entitlement_overrides"), params, env, headers)
|
20
|
+
end
|
21
|
+
|
22
|
+
end # ~EntitlementOverride
|
23
|
+
end # ~ChargeBee
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class Feature < Model
|
3
|
+
|
4
|
+
class Level < Model
|
5
|
+
attr_accessor :name, :value, :level, :is_unlimited
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :id, :name, :description, :status, :type, :unit, :resource_version, :updated_at,
|
9
|
+
:created_at, :levels
|
10
|
+
|
11
|
+
# OPERATIONS
|
12
|
+
#-----------
|
13
|
+
|
14
|
+
def self.list(params={}, env=nil, headers={})
|
15
|
+
Request.send_list_request('get', uri_path("features"), params, env, headers)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.create(params, env=nil, headers={})
|
19
|
+
Request.send('post', uri_path("features"), params, env, headers)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.update(id, params={}, env=nil, headers={})
|
23
|
+
Request.send('post', uri_path("features",id.to_s), params, env, headers)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.retrieve(id, env=nil, headers={})
|
27
|
+
Request.send('get', uri_path("features",id.to_s), {}, env, headers)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.delete(id, env=nil, headers={})
|
31
|
+
Request.send('post', uri_path("features",id.to_s,"delete"), {}, env, headers)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.activate(id, env=nil, headers={})
|
35
|
+
Request.send('post', uri_path("features",id.to_s,"activate_command"), {}, env, headers)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.archive(id, env=nil, headers={})
|
39
|
+
Request.send('post', uri_path("features",id.to_s,"archive_command"), {}, env, headers)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.reactivate(id, env=nil, headers={})
|
43
|
+
Request.send('post', uri_path("features",id.to_s,"reactivate_command"), {}, env, headers)
|
44
|
+
end
|
45
|
+
|
46
|
+
end # ~Feature
|
47
|
+
end # ~ChargeBee
|
@@ -74,7 +74,7 @@ module ChargeBee
|
|
74
74
|
:line_items, :discounts, :line_item_discounts, :taxes, :line_item_taxes, :line_item_tiers, :linked_payments,
|
75
75
|
:dunning_attempts, :applied_credits, :adjustment_credit_notes, :issued_credit_notes, :linked_orders,
|
76
76
|
:notes, :shipping_address, :billing_address, :einvoice, :payment_owner, :void_reason_code, :deleted,
|
77
|
-
:vat_number_prefix
|
77
|
+
:vat_number_prefix, :channel
|
78
78
|
|
79
79
|
# OPERATIONS
|
80
80
|
#-----------
|
@@ -111,6 +111,10 @@ module ChargeBee
|
|
111
111
|
Request.send('post', uri_path("invoices",id.to_s,"apply_payments"), params, env, headers)
|
112
112
|
end
|
113
113
|
|
114
|
+
def self.sync_usages(id, env=nil, headers={})
|
115
|
+
Request.send('post', uri_path("invoices",id.to_s,"sync_usages"), {}, env, headers)
|
116
|
+
end
|
117
|
+
|
114
118
|
def self.apply_credits(id, params={}, env=nil, headers={})
|
115
119
|
Request.send('post', uri_path("invoices",id.to_s,"apply_credits"), params, env, headers)
|
116
120
|
end
|
@@ -195,5 +199,9 @@ module ChargeBee
|
|
195
199
|
Request.send('post', uri_path("invoices",id.to_s,"update_details"), params, env, headers)
|
196
200
|
end
|
197
201
|
|
202
|
+
def self.resend_einvoice(id, env=nil, headers={})
|
203
|
+
Request.send('post', uri_path("invoices",id.to_s,"resend_einvoice"), {}, env, headers)
|
204
|
+
end
|
205
|
+
|
198
206
|
end # ~Invoice
|
199
207
|
end # ~ChargeBee
|
@@ -5,10 +5,10 @@ module ChargeBee
|
|
5
5
|
attr_accessor :id
|
6
6
|
end
|
7
7
|
|
8
|
-
attr_accessor :id, :name, :description, :status, :resource_version, :updated_at,
|
9
|
-
:type, :is_shippable, :is_giftable, :redirect_url, :enabled_for_checkout, :enabled_in_portal,
|
8
|
+
attr_accessor :id, :name, :external_name, :description, :status, :resource_version, :updated_at,
|
9
|
+
:item_family_id, :type, :is_shippable, :is_giftable, :redirect_url, :enabled_for_checkout, :enabled_in_portal,
|
10
10
|
:included_in_mrr, :item_applicability, :gift_claim_redirect_url, :unit, :metered, :usage_calculation,
|
11
|
-
:archived_at, :applicable_items, :metadata
|
11
|
+
:archived_at, :channel, :applicable_items, :metadata
|
12
12
|
|
13
13
|
# OPERATIONS
|
14
14
|
#-----------
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class ItemEntitlement < Model
|
3
|
+
|
4
|
+
class EmbeddedResource < Model
|
5
|
+
attr_accessor
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :id, :item_id, :item_type, :feature_id, :feature_name, :value, :name, :embedded
|
9
|
+
|
10
|
+
# OPERATIONS
|
11
|
+
#-----------
|
12
|
+
|
13
|
+
def self.item_entitlements_for_item(id, params={}, env=nil, headers={})
|
14
|
+
Request.send('get', uri_path("items",id.to_s,"item_entitlements"), params, env, headers)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.item_entitlements_for_feature(id, params={}, env=nil, headers={})
|
18
|
+
Request.send('get', uri_path("features",id.to_s,"item_entitlements"), params, env, headers)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.add_item_entitlements(id, params, env=nil, headers={})
|
22
|
+
Request.send('post', uri_path("features",id.to_s,"item_entitlements"), params, env, headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.upsert_or_remove_item_entitlements_for_item(id, params, env=nil, headers={})
|
26
|
+
Request.send('post', uri_path("items",id.to_s,"item_entitlements"), params, env, headers)
|
27
|
+
end
|
28
|
+
|
29
|
+
end # ~ItemEntitlement
|
30
|
+
end # ~ChargeBee
|
@@ -16,9 +16,9 @@ module ChargeBee
|
|
16
16
|
attr_accessor :id, :name, :item_family_id, :item_id, :description, :status, :external_name,
|
17
17
|
:pricing_model, :price, :price_in_decimal, :period, :currency_code, :period_unit, :trial_period,
|
18
18
|
:trial_period_unit, :trial_end_action, :shipping_period, :shipping_period_unit, :billing_cycles,
|
19
|
-
:free_quantity, :free_quantity_in_decimal, :resource_version, :updated_at, :created_at,
|
20
|
-
:invoice_notes, :tiers, :is_taxable, :tax_detail, :accounting_detail, :metadata,
|
21
|
-
:archivable, :parent_item_id, :show_description_in_invoices, :show_description_in_quotes
|
19
|
+
:free_quantity, :free_quantity_in_decimal, :channel, :resource_version, :updated_at, :created_at,
|
20
|
+
:archived_at, :invoice_notes, :tiers, :is_taxable, :tax_detail, :accounting_detail, :metadata,
|
21
|
+
:item_type, :archivable, :parent_item_id, :show_description_in_invoices, :show_description_in_quotes
|
22
22
|
|
23
23
|
# OPERATIONS
|
24
24
|
#-----------
|
@@ -24,8 +24,8 @@ module ChargeBee
|
|
24
24
|
:avalara_transaction_type, :avalara_service_type, :sku, :accounting_code, :accounting_category1,
|
25
25
|
:accounting_category2, :accounting_category3, :accounting_category4, :is_shippable, :shipping_frequency_period,
|
26
26
|
:shipping_frequency_period_unit, :resource_version, :updated_at, :giftable, :claim_url, :free_quantity_in_decimal,
|
27
|
-
:price_in_decimal, :invoice_notes, :taxable, :tax_profile_id, :meta_data, :tiers,
|
28
|
-
:attached_addons, :event_based_addons, :show_description_in_invoices, :show_description_in_quotes
|
27
|
+
:price_in_decimal, :channel, :invoice_notes, :taxable, :tax_profile_id, :meta_data, :tiers,
|
28
|
+
:applicable_addons, :attached_addons, :event_based_addons, :show_description_in_invoices, :show_description_in_quotes
|
29
29
|
|
30
30
|
# OPERATIONS
|
31
31
|
#-----------
|
@@ -49,7 +49,7 @@ module ChargeBee
|
|
49
49
|
:override_relationship, :pause_date, :resume_date, :cancelled_at, :cancel_reason, :affiliate_token,
|
50
50
|
:created_from_ip, :resource_version, :updated_at, :has_scheduled_advance_invoices, :has_scheduled_changes,
|
51
51
|
:payment_source_id, :plan_free_quantity_in_decimal, :plan_amount_in_decimal, :cancel_schedule_created_at,
|
52
|
-
:offline_payment_method, :net_term_days, :subscription_items, :item_tiers, :charged_items,
|
52
|
+
:offline_payment_method, :channel, :net_term_days, :subscription_items, :item_tiers, :charged_items,
|
53
53
|
:due_invoices_count, :due_since, :total_dues, :mrr, :exchange_rate, :base_currency_code, :addons,
|
54
54
|
:event_based_addons, :charged_event_based_addons, :coupon, :coupons, :shipping_address, :referral_info,
|
55
55
|
:invoice_notes, :meta_data, :metadata, :deleted, :changes_scheduled_at, :contract_term, :cancel_reason_code,
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module ChargeBee
|
2
|
+
class SubscriptionEntitlement < Model
|
3
|
+
|
4
|
+
class Component < Model
|
5
|
+
attr_accessor
|
6
|
+
end
|
7
|
+
|
8
|
+
class EmbeddedResource < Model
|
9
|
+
attr_accessor
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :id, :subscription_id, :feature_id, :feature_name, :feature_unit, :value, :name,
|
13
|
+
:is_overridden, :is_enabled, :expires_at, :components, :embedded
|
14
|
+
|
15
|
+
# OPERATIONS
|
16
|
+
#-----------
|
17
|
+
|
18
|
+
def self.subscription_entitlements_for_subscription(id, params={}, env=nil, headers={})
|
19
|
+
Request.send('get', uri_path("subscriptions",id.to_s,"subscription_entitlements"), params, env, headers)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.set_subscription_entitlement_availability(id, params, env=nil, headers={})
|
23
|
+
Request.send('post', uri_path("subscriptions",id.to_s,"subscription_entitlements/set_availability"), params, env, headers)
|
24
|
+
end
|
25
|
+
|
26
|
+
end # ~SubscriptionEntitlement
|
27
|
+
end # ~ChargeBee
|
@@ -13,6 +13,10 @@ module ChargeBee
|
|
13
13
|
# OPERATIONS
|
14
14
|
#-----------
|
15
15
|
|
16
|
+
def self.create_unbilled_charge(params, env=nil, headers={})
|
17
|
+
Request.send('post', uri_path("unbilled_charges","create"), params, env, headers)
|
18
|
+
end
|
19
|
+
|
16
20
|
def self.create(params, env=nil, headers={})
|
17
21
|
Request.send('post', uri_path("unbilled_charges"), params, env, headers)
|
18
22
|
end
|
data/lib/chargebee/result.rb
CHANGED
@@ -272,6 +272,30 @@ module ChargeBee
|
|
272
272
|
return differential_price;
|
273
273
|
end
|
274
274
|
|
275
|
+
def feature()
|
276
|
+
feature = get(:feature, Feature,
|
277
|
+
{:levels => Feature::Level});
|
278
|
+
return feature;
|
279
|
+
end
|
280
|
+
|
281
|
+
def subscription_entitlement()
|
282
|
+
subscription_entitlement = get(:subscription_entitlement, SubscriptionEntitlement,
|
283
|
+
{:component => SubscriptionEntitlement::Component, :embedded_resource => SubscriptionEntitlement::EmbeddedResource});
|
284
|
+
return subscription_entitlement;
|
285
|
+
end
|
286
|
+
|
287
|
+
def item_entitlement()
|
288
|
+
item_entitlement = get(:item_entitlement, ItemEntitlement,
|
289
|
+
{:embedded_resource => ItemEntitlement::EmbeddedResource});
|
290
|
+
return item_entitlement;
|
291
|
+
end
|
292
|
+
|
293
|
+
def entitlement_override()
|
294
|
+
entitlement_override = get(:entitlement_override, EntitlementOverride,
|
295
|
+
{:embedded_resource => EntitlementOverride::EmbeddedResource});
|
296
|
+
return entitlement_override;
|
297
|
+
end
|
298
|
+
|
275
299
|
|
276
300
|
def unbilled_charges()
|
277
301
|
unbilled_charges = get_list(:unbilled_charges, UnbilledCharge,
|
data/lib/chargebee/util.rb
CHANGED
@@ -6,21 +6,8 @@ module ChargeBee
|
|
6
6
|
case value
|
7
7
|
when Hash
|
8
8
|
value.each do |k, v|
|
9
|
-
if(v.kind_of? Hash)
|
9
|
+
if(v.kind_of? Hash or v.kind_of? Array)
|
10
10
|
serialized.merge!(serialize(v, k))
|
11
|
-
elsif(v.kind_of? Array)
|
12
|
-
arrayContainsValue = false
|
13
|
-
v.each_with_index do |v1, i1|
|
14
|
-
if(v1.kind_of? Hash)
|
15
|
-
serialized.merge!(serialize(v1, k, i1))
|
16
|
-
else
|
17
|
-
arrayContainsValue = true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
if(arrayContainsValue == true)
|
21
|
-
key = "#{(prefix!=nil) ? prefix:''}#{(prefix!=nil) ? '['+k.to_s+']' : k}#{(idx != nil) ? '['+idx.to_s+']':''}"
|
22
|
-
serialized.merge!({key => as_str(v)})
|
23
|
-
end
|
24
11
|
else
|
25
12
|
key = "#{(prefix!=nil) ? prefix:''}#{(prefix!=nil) ? '['+k.to_s+']' : k}#{(idx != nil) ? '['+idx.to_s+']':''}"
|
26
13
|
serialized.merge!({key => as_str(v)})
|
@@ -31,12 +18,12 @@ module ChargeBee
|
|
31
18
|
serialized.merge!(serialize(v, prefix, i))
|
32
19
|
end
|
33
20
|
else
|
34
|
-
|
21
|
+
if(idx != nil and prefix != nil)
|
35
22
|
key = "#{prefix}[#{idx.to_s}]"
|
36
23
|
serialized.merge!({key => as_str(value)})
|
37
|
-
|
24
|
+
else
|
38
25
|
raise ArgumentError.new("only hash or arrays are allowed as value")
|
39
|
-
|
26
|
+
end
|
40
27
|
end
|
41
28
|
serialized
|
42
29
|
end
|
data/lib/chargebee.rb
CHANGED
data/spec/chargebee_spec.rb
CHANGED
@@ -23,20 +23,20 @@ describe "chargebee" do
|
|
23
23
|
:cvv => "007"
|
24
24
|
}
|
25
25
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
26
|
+
after = {
|
27
|
+
"id"=>"sub_KyVq7DNSNM7CSD",
|
28
|
+
"plan_id"=>"free",
|
29
|
+
"addons[id][0]"=>"monitor",
|
30
|
+
"addons[quantity][0]"=>"2",
|
31
|
+
"addons[id][1]"=>"ssl",
|
32
|
+
"addon_ids[0]"=>"addon_one",
|
33
|
+
"addon_ids[1]"=>"addon_two",
|
34
|
+
"card[first_name]"=>"Rajaraman",
|
35
|
+
"card[last_name]"=>"Santhanam",
|
36
|
+
"card[number]"=>"4111111111111111",
|
37
|
+
"card[expiry_month]"=>"1",
|
38
|
+
"card[expiry_year]"=>"2024",
|
39
|
+
"card[cvv]"=>"007"}
|
40
40
|
expect(ChargeBee::Util.serialize(before)).to eq(after)
|
41
41
|
end
|
42
42
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargebee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajaraman S
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_pure
|
@@ -128,15 +128,18 @@ files:
|
|
128
128
|
- lib/chargebee/models/customer.rb
|
129
129
|
- lib/chargebee/models/differential_price.rb
|
130
130
|
- lib/chargebee/models/download.rb
|
131
|
+
- lib/chargebee/models/entitlement_override.rb
|
131
132
|
- lib/chargebee/models/estimate.rb
|
132
133
|
- lib/chargebee/models/event.rb
|
133
134
|
- lib/chargebee/models/export.rb
|
135
|
+
- lib/chargebee/models/feature.rb
|
134
136
|
- lib/chargebee/models/gift.rb
|
135
137
|
- lib/chargebee/models/hierarchy.rb
|
136
138
|
- lib/chargebee/models/hosted_page.rb
|
137
139
|
- lib/chargebee/models/invoice.rb
|
138
140
|
- lib/chargebee/models/invoice_estimate.rb
|
139
141
|
- lib/chargebee/models/item.rb
|
142
|
+
- lib/chargebee/models/item_entitlement.rb
|
140
143
|
- lib/chargebee/models/item_family.rb
|
141
144
|
- lib/chargebee/models/item_price.rb
|
142
145
|
- lib/chargebee/models/model.rb
|
@@ -153,6 +156,7 @@ files:
|
|
153
156
|
- lib/chargebee/models/resource_migration.rb
|
154
157
|
- lib/chargebee/models/site_migration_detail.rb
|
155
158
|
- lib/chargebee/models/subscription.rb
|
159
|
+
- lib/chargebee/models/subscription_entitlement.rb
|
156
160
|
- lib/chargebee/models/subscription_estimate.rb
|
157
161
|
- lib/chargebee/models/tax_withheld.rb
|
158
162
|
- lib/chargebee/models/third_party_payment_method.rb
|