chargebee 2.10.0 → 2.11.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d03fc282854cb898307e411cee36e55fbb132484
4
- data.tar.gz: 6a607154dcff6dd8610a51ff196885c80d3e2736
2
+ SHA256:
3
+ metadata.gz: 0161fb2d18ed430ea6daacbff4d15094aa5a277c99dc7fe26c1e97d6b2090e38
4
+ data.tar.gz: 52b81f2222f0ab37e676468f1df9b317c8dfa78add2a92a5fdde1e53634b48b3
5
5
  SHA512:
6
- metadata.gz: f9869ff5135009f10765feb75ee519ee180146d1f90f7855bd148f1d632d1483bdb53d0339fda41c5d5eb2dbb8b6cac741bec47f5b5e5932b0fd61e2461e4c8e
7
- data.tar.gz: 7660122305df9aaf9ae0099f5cfff629dba6856441856f7fab4e652b05c5cee3a1f87bf52c2f191ea91c526e0e0f9241b1c38257c63a6ad0dfc2929ec135837c
6
+ metadata.gz: 60d4112a05bef4c902e4e64b93ce50c30637922dfc00c32f92af996e7c349e02ec2ce55fc10198cd6a595545627a68ef6229ab0d490223c16a79f2667fbaee96
7
+ data.tar.gz: ad7310dbc8448c6be60bb36c6054e3d753d3cfe96fd7a79762806b6a85dcba5f4580c4ed2c3322bed84ea1d8e531dea83d023a35077c1f0eee998e570415bc38
data/CHANGELOG.md CHANGED
@@ -1,9 +1,51 @@
1
- ### v2.10.0 (2021-10-14)
1
+ ### v2.11.2 (2021-01-05)
2
+ * * *
3
+
4
+ ### Fixes:
5
+ * Improved error message for Invalid JSON response.
6
+
7
+ ### v2.11.1 (2021-12-22)
8
+ * * *
9
+
10
+ ### Fixes:
11
+ * Not restricting to use CGI version till 0.1.0 to address security vulnerabilities.
12
+
13
+ ### v2.11.0 (2021-12-08)
14
+ * * *
15
+
16
+ ### Fixes:
17
+ * Exposed function ChargeBee#update_connect_timeout_secs and ChargeBee#update_read_timeout_secs to set custom connect and read timeout.
18
+ * Updated default request connect and read timeout to 30s and 80s respectively.
19
+
20
+ #### New endpoints:
21
+ * payment_sources#update_bank_account have been added in payment_sources resource.
22
+ * item_price#item_price_find_applicable_items and item_price#item_price_find_applicable_item_prices have been added in item_price resource.
23
+
24
+ #### New Attributes:
25
+ * hsn_code have been added to the resource addon, item_price and plan.
26
+ * first_name, last_name and email have been added to the resource payment_sources.
27
+
28
+ #### New Resource:
29
+ * TaxWithheld has been added.Applicable only for API V2.
30
+
31
+ #### New Input parameters:
32
+ * hsn_code have been added to addons#create_an_addon, addons#update_an_addon, plan#create_an_plan and plan#update_an_plan apis.
33
+ * bank_account[first_name],bank_account[last_name] and bank_account[email] have been added to payment_sources#update_bank_account api.
34
+ * charges[hsn_code] have been added in estimate#Create_Invoice, estimate#Create_Invoice_For_Items, hosted_pages#Checkout_One_Time, hosted_pages#Checkout_One_Time_For_Items, invoice#create_an_invoice, invoice#Create_For_Charge_Items_And_Charges and unbilledCharge#create_an_unbilledCharge apis.
35
+ * tax_detail[hsn_code] have been added in item_price#create_an_itemPrice and item_price#update_an_itemPrice apis.
36
+ * include_deleted have been added in plan#plan_list and addon#addon_list apis.Applicable only for Product Catalog V1.
37
+
38
+ #### New Enum values:
39
+ * subscription_activated_with_backdating, tax_withheld_recorded, tax_withheld_deleted and tax_withheld_refunded has been added to event_type enum.
40
+
41
+ ### v2.10.1 (2021-10-18)
2
42
  * * *
3
43
 
4
44
  ### Fixes:
5
45
  * Fixed .DS_Store file generation issue
6
46
 
47
+ ### v2.10.0 (2021-10-14)
48
+
7
49
  #### New Attributes:
8
50
  * entity_id has been added in order_line_item_discounts resource.
9
51
 
data/chargebee.gemspec CHANGED
@@ -4,9 +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.10.0'
8
- s.date = '2021-10-14'
9
-
7
+ s.version = '2.11.2'
8
+ s.date = '2022-01-05'
10
9
  s.summary = "Ruby client for Chargebee API."
11
10
  s.description = "Subscription Billing - Simple. Secure. Affordable. More details at www.chargebee.com."
12
11
 
@@ -22,8 +21,7 @@ Gem::Specification.new do |s|
22
21
 
23
22
  s.add_dependency('json_pure', '~> 2.1')
24
23
  s.add_dependency('rest-client', '>=1.8', '<=2.0.2')
25
- s.add_dependency('cgi', '<=0.1.0')
26
-
24
+ s.add_dependency('cgi', '>=0.1.0', '<1.0.0')
27
25
  s.add_development_dependency('rspec', '~> 3.0.0')
28
26
  s.add_development_dependency('mocha')
29
27
 
@@ -34,7 +32,6 @@ Gem::Specification.new do |s|
34
32
  README.rdoc
35
33
  Rakefile
36
34
  chargebee.gemspec
37
- lib/.DS_Store
38
35
  lib/chargebee.rb
39
36
  lib/chargebee/environment.rb
40
37
  lib/chargebee/errors.rb
@@ -81,6 +78,7 @@ Gem::Specification.new do |s|
81
78
  lib/chargebee/models/site_migration_detail.rb
82
79
  lib/chargebee/models/subscription.rb
83
80
  lib/chargebee/models/subscription_estimate.rb
81
+ lib/chargebee/models/tax_withheld.rb
84
82
  lib/chargebee/models/third_party_payment_method.rb
85
83
  lib/chargebee/models/time_machine.rb
86
84
  lib/chargebee/models/token.rb
@@ -4,14 +4,18 @@ module ChargeBee
4
4
  # in seconds
5
5
  TIME_MACHINE_TIMEOUT = 3
6
6
  EXPORT_TIMEOUT = 10
7
+ CONNECT_TIMEOUT = 30
8
+ READ_TIMEOUT = 80
7
9
 
8
- attr_accessor :api_key, :site, :time_machine_sleeptime, :export_sleeptime
10
+ attr_accessor :api_key, :site, :time_machine_sleeptime, :export_sleeptime, :connect_timeout, :read_timeout
9
11
  attr_reader :api_endpoint
10
12
 
11
13
  def initialize(options)
12
14
  options[:time_machine_sleeptime] ||= TIME_MACHINE_TIMEOUT
13
15
  options[:export_sleeptime] ||= EXPORT_TIMEOUT
14
- [:api_key, :site, :time_machine_sleeptime, :export_sleeptime].each do |attr|
16
+ options[:connect_timeout] ||= CONNECT_TIMEOUT
17
+ options[:read_timeout] ||= READ_TIMEOUT
18
+ [:api_key, :site, :time_machine_sleeptime, :export_sleeptime, :connect_timeout, :read_timeout].each do |attr|
15
19
  instance_variable_set "@#{attr}", options[attr]
16
20
  end
17
21
  if($CHARGEBEE_DOMAIN == nil)
@@ -7,7 +7,7 @@ module ChargeBee
7
7
 
8
8
  attr_accessor :id, :name, :invoice_name, :description, :pricing_model, :type, :charge_type,
9
9
  :price, :currency_code, :period, :period_unit, :unit, :status, :archived_at, :enabled_in_portal,
10
- :tax_code, :taxjar_product_code, :avalara_sale_type, :avalara_transaction_type, :avalara_service_type,
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
13
  :resource_version, :updated_at, :price_in_decimal, :included_in_mrr, :invoice_notes, :taxable,
@@ -6,7 +6,7 @@ module ChargeBee
6
6
  end
7
7
 
8
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
9
+ attr_accessor :tax_profile_id, :avalara_sale_type, :avalara_transaction_type, :avalara_service_type, :avalara_tax_code, :hsn_code, :taxjar_product_code
10
10
  end
11
11
 
12
12
  class AccountingDetail < Model
@@ -43,5 +43,13 @@ module ChargeBee
43
43
  Request.send('post', uri_path("item_prices",id.to_s,"delete"), {}, env, headers)
44
44
  end
45
45
 
46
+ def self.find_applicable_items(id, params={}, env=nil, headers={})
47
+ Request.send('get', uri_path("item_prices",id.to_s,"applicable_items"), params, env, headers)
48
+ end
49
+
50
+ def self.find_applicable_item_prices(id, params={}, env=nil, headers={})
51
+ Request.send('get', uri_path("item_prices",id.to_s,"applicable_item_prices"), params, env, headers)
52
+ end
53
+
46
54
  end # ~ItemPrice
47
55
  end # ~ChargeBee
@@ -6,7 +6,7 @@ module ChargeBee
6
6
  end
7
7
 
8
8
  class BankAccount < Model
9
- attr_accessor :last4, :name_on_account, :bank_name, :mandate_id, :account_type, :echeck_type, :account_holder_type
9
+ attr_accessor :last4, :name_on_account, :first_name, :last_name, :bank_name, :mandate_id, :account_type, :echeck_type, :account_holder_type, :email
10
10
  end
11
11
 
12
12
  class AmazonPayment < Model
@@ -52,6 +52,10 @@ module ChargeBee
52
52
  Request.send('post', uri_path("payment_sources",id.to_s,"update_card"), params, env, headers)
53
53
  end
54
54
 
55
+ def self.update_bank_account(id, params={}, env=nil, headers={})
56
+ Request.send('post', uri_path("payment_sources",id.to_s,"update_bank_account"), params, env, headers)
57
+ end
58
+
55
59
  def self.verify_bank_account(id, params, env=nil, headers={})
56
60
  Request.send('post', uri_path("payment_sources",id.to_s,"verify_bank_account"), params, env, headers)
57
61
  end
@@ -20,7 +20,7 @@ module ChargeBee
20
20
  attr_accessor :id, :name, :invoice_name, :description, :price, :currency_code, :period, :period_unit,
21
21
  :trial_period, :trial_period_unit, :trial_end_action, :pricing_model, :charge_model, :free_quantity,
22
22
  :setup_cost, :downgrade_penalty, :status, :archived_at, :billing_cycles, :redirect_url, :enabled_in_hosted_pages,
23
- :enabled_in_portal, :addon_applicability, :tax_code, :taxjar_product_code, :avalara_sale_type,
23
+ :enabled_in_portal, :addon_applicability, :tax_code, :hsn_code, :taxjar_product_code, :avalara_sale_type,
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,
@@ -0,0 +1,10 @@
1
+ module ChargeBee
2
+ class TaxWithheld < Model
3
+
4
+ attr_accessor :id, :reference_number, :description, :date, :currency_code, :amount
5
+
6
+ # OPERATIONS
7
+ #-----------
8
+
9
+ end # ~TaxWithheld
10
+ end # ~ChargeBee
@@ -39,8 +39,8 @@ module ChargeBee
39
39
  :user => api_key,
40
40
  :headers => headers,
41
41
  :payload => payload,
42
- :open_timeout => 50,
43
- :timeout => 100
42
+ :open_timeout => env.connect_timeout,
43
+ :timeout => env.read_timeout
44
44
  }.merge(ssl_opts)
45
45
 
46
46
  begin
@@ -59,7 +59,13 @@ module ChargeBee
59
59
  begin
60
60
  resp = JSON.parse(rbody)
61
61
  rescue Exception => e
62
- raise Error.new("Response not in JSON format. Probably not a ChargeBee response \n #{rbody.inspect}",e)
62
+ if rbody.include? "503"
63
+ raise Error.new("Sorry, the server is currently unable to handle the request due to a temporary overload or scheduled maintenance. Please retry after sometime. \n type: internal_temporary_error, \n http_status_code: 503, \n error_code: internal_temporary_error,\n content: #{rbody.inspect}",e)
64
+ elsif rbody.include? "504"
65
+ raise Error.new("The server did not receive a timely response from an upstream server, request aborted. If this problem persists, contact us at support@chargebee.com. \n type: gateway_timeout, \n http_status_code: 504, \n error_code: gateway_timeout,\n content: #{rbody.inspect}",e)
66
+ else
67
+ raise Error.new("Sorry, something went wrong when trying to process the request. If this problem persists, contact us at support@chargebee.com. \n type: internal_error, \n http_status_code: 500, \n error_code: internal_error,\n content: #{rbody.inspect}",e)
68
+ end
63
69
  end
64
70
  resp = Util.symbolize_keys(resp)
65
71
  resp
@@ -75,6 +75,11 @@ module ChargeBee
75
75
  return invoice;
76
76
  end
77
77
 
78
+ def tax_withheld()
79
+ tax_withheld = get(:tax_withheld, TaxWithheld);
80
+ return tax_withheld;
81
+ end
82
+
78
83
  def credit_note()
79
84
  credit_note = get(:credit_note, CreditNote,
80
85
  {:line_items => CreditNote::LineItem, :discounts => CreditNote::Discount, :line_item_discounts => CreditNote::LineItemDiscount, :line_item_tiers => CreditNote::LineItemTier, :taxes => CreditNote::Tax, :line_item_taxes => CreditNote::LineItemTax, :linked_refunds => CreditNote::LinkedRefund, :allocations => CreditNote::Allocation});
data/lib/chargebee.rb CHANGED
@@ -53,7 +53,7 @@ require File.dirname(__FILE__) + '/chargebee/models/usage.rb'
53
53
 
54
54
  module ChargeBee
55
55
 
56
- VERSION = '2.10.0'
56
+ VERSION = '2.11.2'
57
57
 
58
58
  @@default_env = nil
59
59
  @@verify_ca_certs = true
@@ -89,5 +89,12 @@ module ChargeBee
89
89
  @@user_agent
90
90
  end
91
91
 
92
+ def self.update_connect_timeout_secs(connect_timeout)
93
+ @@default_env.connect_timeout = connect_timeout
94
+ end
95
+
96
+ def self.update_read_timeout_secs(read_timeout)
97
+ @@default_env.read_timeout = read_timeout
98
+ end
92
99
  end
93
100
 
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.10.0
4
+ version: 2.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajaraman S
@@ -9,82 +9,88 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-14 00:00:00.000000000 Z
12
+ date: 2022-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_pure
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '2.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '2.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rest-client
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.8'
35
- - - <=
35
+ - - "<="
36
36
  - !ruby/object:Gem::Version
37
37
  version: 2.0.2
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - '>='
42
+ - - ">="
43
43
  - !ruby/object:Gem::Version
44
44
  version: '1.8'
45
- - - <=
45
+ - - "<="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 2.0.2
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: cgi
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - <=
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.0
55
+ - - "<"
56
+ - !ruby/object:Gem::Version
57
+ version: 1.0.0
55
58
  type: :runtime
56
59
  prerelease: false
57
60
  version_requirements: !ruby/object:Gem::Requirement
58
61
  requirements:
59
- - - <=
62
+ - - ">="
60
63
  - !ruby/object:Gem::Version
61
64
  version: 0.1.0
65
+ - - "<"
66
+ - !ruby/object:Gem::Version
67
+ version: 1.0.0
62
68
  - !ruby/object:Gem::Dependency
63
69
  name: rspec
64
70
  requirement: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - ~>
72
+ - - "~>"
67
73
  - !ruby/object:Gem::Version
68
74
  version: 3.0.0
69
75
  type: :development
70
76
  prerelease: false
71
77
  version_requirements: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - ~>
79
+ - - "~>"
74
80
  - !ruby/object:Gem::Version
75
81
  version: 3.0.0
76
82
  - !ruby/object:Gem::Dependency
77
83
  name: mocha
78
84
  requirement: !ruby/object:Gem::Requirement
79
85
  requirements:
80
- - - '>='
86
+ - - ">="
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  type: :development
84
90
  prerelease: false
85
91
  version_requirements: !ruby/object:Gem::Requirement
86
92
  requirements:
87
- - - '>='
93
+ - - ">="
88
94
  - !ruby/object:Gem::Version
89
95
  version: '0'
90
96
  description: Subscription Billing - Simple. Secure. Affordable. More details at www.chargebee.com.
@@ -102,7 +108,6 @@ files:
102
108
  - README.rdoc
103
109
  - Rakefile
104
110
  - chargebee.gemspec
105
- - lib/.DS_Store
106
111
  - lib/chargebee.rb
107
112
  - lib/chargebee/environment.rb
108
113
  - lib/chargebee/errors.rb
@@ -149,6 +154,7 @@ files:
149
154
  - lib/chargebee/models/site_migration_detail.rb
150
155
  - lib/chargebee/models/subscription.rb
151
156
  - lib/chargebee/models/subscription_estimate.rb
157
+ - lib/chargebee/models/tax_withheld.rb
152
158
  - lib/chargebee/models/third_party_payment_method.rb
153
159
  - lib/chargebee/models/time_machine.rb
154
160
  - lib/chargebee/models/token.rb
@@ -172,22 +178,21 @@ licenses:
172
178
  metadata: {}
173
179
  post_install_message:
174
180
  rdoc_options:
175
- - --charset=UTF-8
181
+ - "--charset=UTF-8"
176
182
  require_paths:
177
183
  - lib
178
184
  required_ruby_version: !ruby/object:Gem::Requirement
179
185
  requirements:
180
- - - '>='
186
+ - - ">="
181
187
  - !ruby/object:Gem::Version
182
188
  version: 1.9.3
183
189
  required_rubygems_version: !ruby/object:Gem::Requirement
184
190
  requirements:
185
- - - '>='
191
+ - - ">="
186
192
  - !ruby/object:Gem::Version
187
193
  version: '0'
188
194
  requirements: []
189
- rubyforge_project:
190
- rubygems_version: 2.4.5
195
+ rubygems_version: 3.0.3
191
196
  signing_key:
192
197
  specification_version: 2
193
198
  summary: Ruby client for Chargebee API.
data/lib/.DS_Store DELETED
Binary file