chargebee 2.63.0 → 2.65.0
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 +4 -4
- data/CHANGELOG.md +56 -0
- data/Gemfile.lock +1 -1
- data/chargebee.gemspec +5 -3
- data/lib/chargebee/errors.rb +2 -0
- data/lib/chargebee/models/credit_note.rb +5 -5
- data/lib/chargebee/models/einvoice.rb +10 -0
- data/lib/chargebee/models/gift.rb +1 -0
- data/lib/chargebee/models/invoice.rb +7 -7
- data/lib/chargebee/models/item_price.rb +9 -0
- data/lib/chargebee/models/quoted_delta_ramp.rb +14 -0
- data/lib/chargebee/{nativeRequest.rb → native_request.rb} +15 -8
- data/lib/chargebee/result.rb +11 -0
- data/lib/chargebee.rb +4 -2
- data/spec/chargebee/native_request_spec.rb +13 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b0b37c72eef916eaec5a8fa4f508a1a071056dc10798590bc892591f412b00b
|
|
4
|
+
data.tar.gz: caf64e0b250f35d66a60ec73223314cbed3c91297ba4b9880ce073f84e8db857
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56203ce39083b6363cb44fc81f321794fbef5e147071ea122a8d7e526016d761db4b7b93ff583fca190cba420362bd04ae3c9b2a3f9e35be8b49a62ecef70eec
|
|
7
|
+
data.tar.gz: 5aac867679984bc681374ed1752d1f2139c7f22a6f7653e4b1e2922886494218bb28b0071d69e30a3e9feaf7472fe0ea58a6513388878f68f1920645a882df81
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
### v2.65.0 (2025-11-26)
|
|
2
|
+
* * *
|
|
3
|
+
|
|
4
|
+
### New Resources:
|
|
5
|
+
* Einvoice has been added.
|
|
6
|
+
* QuotedDeltaRamp has been added.
|
|
7
|
+
|
|
8
|
+
### New Attributes:
|
|
9
|
+
* line_items_next_offset has been added to CreditNote.
|
|
10
|
+
* line_items_next_offset has been added to Invoice.
|
|
11
|
+
* credit_lines has been added to SalesOrder.
|
|
12
|
+
* billable_unit_price has been added to SalesOrder#LineItem.
|
|
13
|
+
* billable_quantity has been added to SalesOrder#LineItem.
|
|
14
|
+
* billable_amount has been added to SalesOrder#LineItem.
|
|
15
|
+
|
|
16
|
+
### New Endpoint:
|
|
17
|
+
* move has been added to ItemPrice.
|
|
18
|
+
|
|
19
|
+
### New Parameters:
|
|
20
|
+
* line_items_limit has been added to CreditNote#RetrieveRequest.
|
|
21
|
+
* line_items_offset has been added to CreditNote#RetrieveRequest.
|
|
22
|
+
* line_items_limit has been added to Invoice#RetrieveRequest.
|
|
23
|
+
* line_items_offset has been added to Invoice#RetrieveRequest.
|
|
24
|
+
* item_tiers has been added to Estimate#GiftSubscriptionForItemsRequest.
|
|
25
|
+
* unit_price has been added to Estimate#SubscriptionItems#GiftSubscriptionForItemsRequest.
|
|
26
|
+
* unit_price_in_decimal has been added to Estimate#SubscriptionItems#GiftSubscriptionForItemsRequest.
|
|
27
|
+
* item_tiers has been added to Gift#CreateForItemsRequest.
|
|
28
|
+
* meta_data has been added to Gift#CreateForItemsRequest.
|
|
29
|
+
* unit_price has been added to Gift#SubscriptionItems#CreateForItemsRequest.
|
|
30
|
+
* unit_price_in_decimal has been added to Gift#SubscriptionItems#CreateForItemsRequest.
|
|
31
|
+
* item_tiers has been added to HostedPage#CheckoutGiftForItemsRequest.
|
|
32
|
+
* unit_price has been added to HostedPage#SubscriptionItems#CheckoutGiftForItemsRequest.
|
|
33
|
+
* unit_price_in_decimal has been added to HostedPage#SubscriptionItems#CheckoutGiftForItemsRequest.
|
|
34
|
+
* auto_select_local_currency has been added to PricingPageSession#CreateForNewSubscriptionRequest.
|
|
35
|
+
|
|
36
|
+
### New Enums:
|
|
37
|
+
* EZIDEBIT has been added to GatewayEnum.
|
|
38
|
+
* BUSINESS_RULE has been added to EntityTypeEnum.
|
|
39
|
+
* RULESET has been added to EntityTypeEnum.
|
|
40
|
+
|
|
41
|
+
### v2.64.0 (2025-11-10)
|
|
42
|
+
* * *
|
|
43
|
+
|
|
44
|
+
### Error Handling
|
|
45
|
+
- Added new `ForbiddenError` class that inherits from `Error`
|
|
46
|
+
- Enhanced `handle_for_error` method to detect and handle 403 status codes
|
|
47
|
+
- Provides clear error message: "Access forbidden. You do not have permission to access this resource."
|
|
48
|
+
|
|
49
|
+
### Code Quality Improvements
|
|
50
|
+
- Renamed `lib/chargebee/nativeRequest.rb` → `lib/chargebee/native_request.rb` to follow Ruby naming conventions
|
|
51
|
+
- Refactored `handle_for_error` to return error objects instead of raising them inline (cleaner separation of concerns)
|
|
52
|
+
- Added YARD documentation for `handle_for_error` method
|
|
53
|
+
|
|
54
|
+
### Testing
|
|
55
|
+
- Added comprehensive test coverage for 403 error scenarios
|
|
56
|
+
|
|
1
57
|
### v2.63.0 (2025-10-28)
|
|
2
58
|
* * *
|
|
3
59
|
|
data/Gemfile.lock
CHANGED
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 = '2025-
|
|
7
|
+
s.version = '2.65.0'
|
|
8
|
+
s.date = '2025-11-26'
|
|
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
|
s.metadata = {
|
|
@@ -66,6 +66,7 @@ Gem::Specification.new do |s|
|
|
|
66
66
|
lib/chargebee/models/differential_price.rb
|
|
67
67
|
lib/chargebee/models/discount.rb
|
|
68
68
|
lib/chargebee/models/download.rb
|
|
69
|
+
lib/chargebee/models/einvoice.rb
|
|
69
70
|
lib/chargebee/models/entitlement.rb
|
|
70
71
|
lib/chargebee/models/entitlement_override.rb
|
|
71
72
|
lib/chargebee/models/estimate.rb
|
|
@@ -117,6 +118,7 @@ Gem::Specification.new do |s|
|
|
|
117
118
|
lib/chargebee/models/quote.rb
|
|
118
119
|
lib/chargebee/models/quote_line_group.rb
|
|
119
120
|
lib/chargebee/models/quoted_charge.rb
|
|
121
|
+
lib/chargebee/models/quoted_delta_ramp.rb
|
|
120
122
|
lib/chargebee/models/quoted_ramp.rb
|
|
121
123
|
lib/chargebee/models/quoted_subscription.rb
|
|
122
124
|
lib/chargebee/models/ramp.rb
|
|
@@ -140,7 +142,7 @@ Gem::Specification.new do |s|
|
|
|
140
142
|
lib/chargebee/models/usage_file.rb
|
|
141
143
|
lib/chargebee/models/virtual_bank_account.rb
|
|
142
144
|
lib/chargebee/models/webhook_endpoint.rb
|
|
143
|
-
lib/chargebee/
|
|
145
|
+
lib/chargebee/native_request.rb
|
|
144
146
|
lib/chargebee/request.rb
|
|
145
147
|
lib/chargebee/rest.rb
|
|
146
148
|
lib/chargebee/result.rb
|
data/lib/chargebee/errors.rb
CHANGED
|
@@ -60,11 +60,11 @@ module ChargeBee
|
|
|
60
60
|
attr_accessor :id, :customer_id, :subscription_id, :reference_invoice_id, :type, :reason_code,
|
|
61
61
|
:status, :vat_number, :date, :price_type, :currency_code, :total, :amount_allocated, :amount_refunded,
|
|
62
62
|
:amount_available, :refunded_at, :voided_at, :generated_at, :resource_version, :updated_at,
|
|
63
|
-
:channel, :sub_total, :sub_total_in_local_currency, :total_in_local_currency,
|
|
64
|
-
:round_off_amount, :fractional_correction, :line_items, :line_item_tiers,
|
|
65
|
-
:line_item_taxes, :line_item_addresses, :discounts, :taxes, :tax_origin,
|
|
66
|
-
:deleted, :tax_category, :local_currency_exchange_rate, :create_reason_code,
|
|
67
|
-
:business_entity_id, :shipping_address, :billing_address, :einvoice, :site_details_at_creation
|
|
63
|
+
:channel, :line_items_next_offset, :sub_total, :sub_total_in_local_currency, :total_in_local_currency,
|
|
64
|
+
:local_currency_code, :round_off_amount, :fractional_correction, :line_items, :line_item_tiers,
|
|
65
|
+
:line_item_discounts, :line_item_taxes, :line_item_addresses, :discounts, :taxes, :tax_origin,
|
|
66
|
+
:linked_refunds, :allocations, :deleted, :tax_category, :local_currency_exchange_rate, :create_reason_code,
|
|
67
|
+
:vat_number_prefix, :business_entity_id, :shipping_address, :billing_address, :einvoice, :site_details_at_creation
|
|
68
68
|
|
|
69
69
|
# OPERATIONS
|
|
70
70
|
#-----------
|
|
@@ -94,13 +94,13 @@ module ChargeBee
|
|
|
94
94
|
:currency_code, :local_currency_code, :tax, :sub_total, :sub_total_in_local_currency, :total,
|
|
95
95
|
:total_in_local_currency, :amount_due, :amount_adjusted, :amount_paid, :paid_at, :write_off_amount,
|
|
96
96
|
:credits_applied, :dunning_status, :next_retry_at, :voided_at, :resource_version, :updated_at,
|
|
97
|
-
:first_invoice, :new_sales_amount, :has_advance_charges, :term_finalized,
|
|
98
|
-
:expected_payment_date, :amount_to_collect, :round_off_amount, :line_items,
|
|
99
|
-
:line_item_discounts, :line_item_taxes, :line_item_credits, :line_item_addresses,
|
|
100
|
-
:taxes, :tax_origin, :linked_payments, :reference_transactions, :dunning_attempts,
|
|
101
|
-
:adjustment_credit_notes, :issued_credit_notes, :linked_orders, :notes, :shipping_address,
|
|
102
|
-
:statement_descriptor, :einvoice, :void_reason_code, :deleted, :tax_category,
|
|
103
|
-
:channel, :business_entity_id, :site_details_at_creation
|
|
97
|
+
:line_items_next_offset, :first_invoice, :new_sales_amount, :has_advance_charges, :term_finalized,
|
|
98
|
+
:is_gifted, :generated_at, :expected_payment_date, :amount_to_collect, :round_off_amount, :line_items,
|
|
99
|
+
:line_item_tiers, :line_item_discounts, :line_item_taxes, :line_item_credits, :line_item_addresses,
|
|
100
|
+
:discounts, :taxes, :tax_origin, :linked_payments, :reference_transactions, :dunning_attempts,
|
|
101
|
+
:applied_credits, :adjustment_credit_notes, :issued_credit_notes, :linked_orders, :notes, :shipping_address,
|
|
102
|
+
:billing_address, :statement_descriptor, :einvoice, :void_reason_code, :deleted, :tax_category,
|
|
103
|
+
:vat_number_prefix, :channel, :business_entity_id, :site_details_at_creation
|
|
104
104
|
|
|
105
105
|
# OPERATIONS
|
|
106
106
|
#-----------
|
|
@@ -85,5 +85,14 @@ module ChargeBee
|
|
|
85
85
|
Request.send('get', uri_path("item_prices",id.to_s,"applicable_item_prices"), params, env, headers,nil, false, jsonKeys, options)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
def self.move_item_price(id, params, env=nil, headers={})
|
|
89
|
+
jsonKeys = {
|
|
90
|
+
}
|
|
91
|
+
options = {
|
|
92
|
+
:isIdempotent => true
|
|
93
|
+
}
|
|
94
|
+
Request.send('post', uri_path("item_prices",id.to_s,"move"), params, env, headers,nil, false, jsonKeys, options)
|
|
95
|
+
end
|
|
96
|
+
|
|
88
97
|
end # ~ItemPrice
|
|
89
98
|
end # ~ChargeBee
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module ChargeBee
|
|
2
|
+
class QuotedDeltaRamp < Model
|
|
3
|
+
|
|
4
|
+
class LineItem < Model
|
|
5
|
+
attr_accessor :item_level_discount_per_billing_cycle_in_decimal
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
attr_accessor :line_items
|
|
9
|
+
|
|
10
|
+
# OPERATIONS
|
|
11
|
+
#-----------
|
|
12
|
+
|
|
13
|
+
end # ~QuotedDeltaRamp
|
|
14
|
+
end # ~ChargeBee
|
|
@@ -167,26 +167,33 @@ module ChargeBee
|
|
|
167
167
|
end
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
+
# Handle errors returned by the ChargeBee API.
|
|
171
|
+
#
|
|
172
|
+
# @param rcode [Integer] HTTP status code.
|
|
173
|
+
# @param rbody [String] HTTP response body.
|
|
174
|
+
#
|
|
175
|
+
# @return [ChargeBee::Error] Appropriate ChargeBee error object.
|
|
170
176
|
def self.handle_for_error(rcode, rbody)
|
|
171
177
|
return Error.new("No response returned by ChargeBee API. HTTP status code: #{rcode}") if rcode == 204
|
|
178
|
+
return ForbiddenError.new("Access forbidden. You do not have permission to access this resource.") if rcode == 403
|
|
172
179
|
begin
|
|
173
180
|
error_obj = JSON.parse(rbody)
|
|
174
181
|
error_obj = Util.symbolize_keys(error_obj)
|
|
175
182
|
rescue Exception => e
|
|
176
|
-
|
|
183
|
+
return Error.new("Error response not in JSON format. The http status code is #{rcode} \n #{rbody.inspect}", e)
|
|
177
184
|
end
|
|
178
|
-
|
|
179
|
-
case type
|
|
185
|
+
|
|
186
|
+
case error_obj[:type]
|
|
180
187
|
when "payment"
|
|
181
|
-
|
|
188
|
+
PaymentError.new(rcode, error_obj)
|
|
182
189
|
when "operation_failed"
|
|
183
|
-
|
|
190
|
+
OperationFailedError.new(rcode, error_obj)
|
|
184
191
|
when "invalid_request"
|
|
185
|
-
|
|
192
|
+
InvalidRequestError.new(rcode, error_obj)
|
|
186
193
|
when "ubb_batch_ingestion_invalid_request"
|
|
187
|
-
|
|
194
|
+
UbbBatchIngestionInvalidRequestError.new(rcode, error_obj)
|
|
188
195
|
else
|
|
189
|
-
|
|
196
|
+
APIError.new(rcode, error_obj)
|
|
190
197
|
end
|
|
191
198
|
end
|
|
192
199
|
|
data/lib/chargebee/result.rb
CHANGED
|
@@ -121,6 +121,11 @@ module ChargeBee
|
|
|
121
121
|
return payment_schedule;
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
+
def einvoice()
|
|
125
|
+
einvoice = get(:einvoice, Einvoice);
|
|
126
|
+
return einvoice;
|
|
127
|
+
end
|
|
128
|
+
|
|
124
129
|
def tax_withheld()
|
|
125
130
|
tax_withheld = get(:tax_withheld, TaxWithheld);
|
|
126
131
|
return tax_withheld;
|
|
@@ -207,6 +212,12 @@ module ChargeBee
|
|
|
207
212
|
return quoted_ramp;
|
|
208
213
|
end
|
|
209
214
|
|
|
215
|
+
def quoted_delta_ramp()
|
|
216
|
+
quoted_delta_ramp = get(:quoted_delta_ramp, QuotedDeltaRamp,
|
|
217
|
+
{:line_items => QuotedDeltaRamp::LineItem});
|
|
218
|
+
return quoted_delta_ramp;
|
|
219
|
+
end
|
|
220
|
+
|
|
210
221
|
def billing_configuration()
|
|
211
222
|
billing_configuration = get(:billing_configuration, BillingConfiguration,
|
|
212
223
|
{:billing_dates => BillingConfiguration::BillingDate});
|
data/lib/chargebee.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/chargebee/environment'
|
|
2
|
-
require File.dirname(__FILE__) + '/chargebee/
|
|
2
|
+
require File.dirname(__FILE__) + '/chargebee/native_request'
|
|
3
3
|
require File.dirname(__FILE__) + '/chargebee/util'
|
|
4
4
|
require File.dirname(__FILE__) + '/chargebee/request'
|
|
5
5
|
require File.dirname(__FILE__) + '/chargebee/result'
|
|
@@ -94,11 +94,13 @@ require File.dirname(__FILE__) + '/chargebee/models/omnichannel_one_time_order_i
|
|
|
94
94
|
require File.dirname(__FILE__) + '/chargebee/models/personalized_offer'
|
|
95
95
|
require File.dirname(__FILE__) + '/chargebee/models/offer_event'
|
|
96
96
|
require File.dirname(__FILE__) + '/chargebee/models/offer_fulfillment'
|
|
97
|
+
require File.dirname(__FILE__) + '/chargebee/models/quoted_delta_ramp'
|
|
98
|
+
require File.dirname(__FILE__) + '/chargebee/models/einvoice'
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
module ChargeBee
|
|
100
102
|
|
|
101
|
-
VERSION = '2.
|
|
103
|
+
VERSION = '2.65.0'
|
|
102
104
|
|
|
103
105
|
@@default_env = nil
|
|
104
106
|
@@verify_ca_certs = true
|
|
@@ -141,6 +141,19 @@ module ChargeBee
|
|
|
141
141
|
end
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
+
it "raises ForbiddenError for 403 status code" do
|
|
145
|
+
stub_request(:get, "https://dummy.chargebee.com/test").to_return(
|
|
146
|
+
body: "<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n</body>\r\n</html>\r\n",
|
|
147
|
+
status: 403
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
expect {
|
|
151
|
+
NativeRequest.request(:get, "/test", env)
|
|
152
|
+
}.to raise_error(ForbiddenError) do |err|
|
|
153
|
+
expect(err.message).to eq("Access forbidden. You do not have permission to access this resource.")
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
144
157
|
it "retries once on HTTP 503 and succeeds on second attempt" do
|
|
145
158
|
stub_request(:get, "https://dummy.chargebee.com/test")
|
|
146
159
|
.to_return({ status: 503, body: "temporary error" },
|
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.65.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: 2025-
|
|
12
|
+
date: 2025-11-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: cgi
|
|
@@ -107,6 +107,7 @@ files:
|
|
|
107
107
|
- lib/chargebee/models/differential_price.rb
|
|
108
108
|
- lib/chargebee/models/discount.rb
|
|
109
109
|
- lib/chargebee/models/download.rb
|
|
110
|
+
- lib/chargebee/models/einvoice.rb
|
|
110
111
|
- lib/chargebee/models/entitlement.rb
|
|
111
112
|
- lib/chargebee/models/entitlement_override.rb
|
|
112
113
|
- lib/chargebee/models/estimate.rb
|
|
@@ -158,6 +159,7 @@ files:
|
|
|
158
159
|
- lib/chargebee/models/quote.rb
|
|
159
160
|
- lib/chargebee/models/quote_line_group.rb
|
|
160
161
|
- lib/chargebee/models/quoted_charge.rb
|
|
162
|
+
- lib/chargebee/models/quoted_delta_ramp.rb
|
|
161
163
|
- lib/chargebee/models/quoted_ramp.rb
|
|
162
164
|
- lib/chargebee/models/quoted_subscription.rb
|
|
163
165
|
- lib/chargebee/models/ramp.rb
|
|
@@ -181,7 +183,7 @@ files:
|
|
|
181
183
|
- lib/chargebee/models/usage_file.rb
|
|
182
184
|
- lib/chargebee/models/virtual_bank_account.rb
|
|
183
185
|
- lib/chargebee/models/webhook_endpoint.rb
|
|
184
|
-
- lib/chargebee/
|
|
186
|
+
- lib/chargebee/native_request.rb
|
|
185
187
|
- lib/chargebee/request.rb
|
|
186
188
|
- lib/chargebee/rest.rb
|
|
187
189
|
- lib/chargebee/result.rb
|