chargebee 2.10.1 → 2.12.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 +75 -0
- data/LICENSE +1 -1
- data/Rakefile +150 -150
- data/chargebee.gemspec +4 -5
- data/lib/chargebee/environment.rb +6 -2
- data/lib/chargebee/list_result.rb +28 -28
- data/lib/chargebee/models/addon.rb +1 -1
- data/lib/chargebee/models/credit_note.rb +11 -3
- data/lib/chargebee/models/customer.rb +9 -5
- data/lib/chargebee/models/download.rb +1 -1
- data/lib/chargebee/models/export.rb +1 -1
- data/lib/chargebee/models/invoice.rb +10 -1
- data/lib/chargebee/models/item_price.rb +9 -1
- data/lib/chargebee/models/payment_source.rb +5 -1
- data/lib/chargebee/models/plan.rb +1 -1
- data/lib/chargebee/models/tax_withheld.rb +11 -0
- data/lib/chargebee/rest.rb +9 -3
- data/lib/chargebee/result.rb +16 -5
- data/lib/chargebee/util.rb +56 -56
- data/lib/chargebee.rb +8 -1
- data/lib/ssl/ca-certs.crt +3385 -3385
- data/spec/chargebee/list_result_spec.rb +53 -53
- data/spec/chargebee_spec.rb +99 -99
- data/spec/spec_helper.rb +24 -24
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbe622f534d1cd172b212749959aced99a1d8665
|
4
|
+
data.tar.gz: 2de898ac2c61e2aaec5f505d23a1914dffb493ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa416ff2bc0c9adac99e093c279de72120ae2966198e97fbcbf884ed4b9cc5c962902098c5d7e99474adbfad737fba41c17eb1e385f664dffcf7e75a8ccd9f54
|
7
|
+
data.tar.gz: 80f0bb873cb06d1fa17d9c6c29fea40da8468fc1d35097f797f96020fbfaad4e9c33c6d540cd676a1604665087e1c8c59f3801779216d1778d9f900f5f9d71ba
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,78 @@
|
|
1
|
+
### v2.12.0 (2022-01-21)
|
2
|
+
* * *
|
3
|
+
|
4
|
+
#### New endpoints:
|
5
|
+
* credit_notes#download_einvoice has been added to the credit_notes resource.
|
6
|
+
* invoice#download_einvoice has been added to the invoice resource.
|
7
|
+
|
8
|
+
#### New attributes:
|
9
|
+
* is_einvoice_enabled, entity_identifier_scheme, entity_identifier_standard and entity_identifiers[] have been added to the customer resource.
|
10
|
+
* einvoice has been added to the invoice resource.
|
11
|
+
* einvoice has been added to the credit_notes resource.
|
12
|
+
* mime_type has been added to the download resource.
|
13
|
+
|
14
|
+
#### New Input parameters:
|
15
|
+
* entity_identifier_scheme, entity_identifier_standard, is_einvoice_enabled, entity_identifiers[id][0..N], entity_identifiers[scheme][0..N], entity_identifiers[value][0..N], entity_identifiers[standard][0..N] have been added to customers#create_a_customer, customers#update_billing_info_for_a_customer apis.
|
16
|
+
* customer[entity_identifier_scheme], customer[entity_identifier_standard], customer[is_einvoice_enabled], entity_identifiers[id][0..N], entity_identifiers[scheme][0..N], entity_identifiers[value][0..N], entity_identifiers[standard][0..N] have been added to the subscriptions#create_a_subscription api.
|
17
|
+
* customer[entity_identifier_scheme], customer[entity_identifier_standard], customer[is_einvoice_enabled] have been added to subscriptions#update_a_subscription and subscriptions#update_subscription_for_items apis.
|
18
|
+
|
19
|
+
#### New Enum values:
|
20
|
+
* operation enum has been added.
|
21
|
+
* status enum has been added in credit_notes_einvoice subresource of credit_notes resource.
|
22
|
+
|
23
|
+
#### Deprecated attributes:
|
24
|
+
* user, type, payment_method and exchange_rate have been deprecated from TaxWithHeld resource.
|
25
|
+
|
26
|
+
#### Deprecated enums:
|
27
|
+
* type and payment_method have been deprecated in TaxWithHeld resource.
|
28
|
+
|
29
|
+
#### Updated parameters:
|
30
|
+
* hierarchy_operation_type has been made mandatory in customers#get_hierarchy api.
|
31
|
+
|
32
|
+
#### Removed Filter parameters:
|
33
|
+
* create_pending_invoices has been removed from subscriptions#list_subscriptions api.
|
34
|
+
|
35
|
+
|
36
|
+
### v2.11.2 (2021-01-05)
|
37
|
+
* * *
|
38
|
+
|
39
|
+
### Fixes:
|
40
|
+
* Improved error message for Invalid JSON response.
|
41
|
+
|
42
|
+
### v2.11.1 (2021-12-22)
|
43
|
+
* * *
|
44
|
+
|
45
|
+
### Fixes:
|
46
|
+
* Not restricting to use CGI version till 0.1.0 to address security vulnerabilities.
|
47
|
+
|
48
|
+
### v2.11.0 (2021-12-08)
|
49
|
+
* * *
|
50
|
+
|
51
|
+
### Fixes:
|
52
|
+
* Exposed function ChargeBee#update_connect_timeout_secs and ChargeBee#update_read_timeout_secs to set custom connect and read timeout.
|
53
|
+
* Updated default request connect and read timeout to 30s and 80s respectively.
|
54
|
+
|
55
|
+
#### New endpoints:
|
56
|
+
* payment_sources#update_bank_account have been added in payment_sources resource.
|
57
|
+
* item_price#item_price_find_applicable_items and item_price#item_price_find_applicable_item_prices have been added in item_price resource.
|
58
|
+
|
59
|
+
#### New Attributes:
|
60
|
+
* hsn_code have been added to the resource addon, item_price and plan.
|
61
|
+
* first_name, last_name and email have been added to the resource payment_sources.
|
62
|
+
|
63
|
+
#### New Resource:
|
64
|
+
* TaxWithheld has been added.Applicable only for API V2.
|
65
|
+
|
66
|
+
#### New Input parameters:
|
67
|
+
* hsn_code have been added to addons#create_an_addon, addons#update_an_addon, plan#create_an_plan and plan#update_an_plan apis.
|
68
|
+
* bank_account[first_name],bank_account[last_name] and bank_account[email] have been added to payment_sources#update_bank_account api.
|
69
|
+
* 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.
|
70
|
+
* tax_detail[hsn_code] have been added in item_price#create_an_itemPrice and item_price#update_an_itemPrice apis.
|
71
|
+
* include_deleted have been added in plan#plan_list and addon#addon_list apis.Applicable only for Product Catalog V1.
|
72
|
+
|
73
|
+
#### New Enum values:
|
74
|
+
* subscription_activated_with_backdating, tax_withheld_recorded, tax_withheld_deleted and tax_withheld_refunded has been added to event_type enum.
|
75
|
+
|
1
76
|
### v2.10.1 (2021-10-18)
|
2
77
|
* * *
|
3
78
|
|
data/LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -1,150 +1,150 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'date'
|
4
|
-
|
5
|
-
#############################################################################
|
6
|
-
#
|
7
|
-
# Helper functions
|
8
|
-
#
|
9
|
-
#############################################################################
|
10
|
-
|
11
|
-
def name
|
12
|
-
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
-
end
|
14
|
-
|
15
|
-
def version
|
16
|
-
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
17
|
-
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
18
|
-
end
|
19
|
-
|
20
|
-
def date
|
21
|
-
Date.today.to_s
|
22
|
-
end
|
23
|
-
|
24
|
-
def rubyforge_project
|
25
|
-
name
|
26
|
-
end
|
27
|
-
|
28
|
-
def gemspec_file
|
29
|
-
"#{name}.gemspec"
|
30
|
-
end
|
31
|
-
|
32
|
-
def gem_file
|
33
|
-
"#{name}-#{version}.gem"
|
34
|
-
end
|
35
|
-
|
36
|
-
def replace_header(head, header_name)
|
37
|
-
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
38
|
-
end
|
39
|
-
|
40
|
-
#############################################################################
|
41
|
-
#
|
42
|
-
# Standard tasks
|
43
|
-
#
|
44
|
-
#############################################################################
|
45
|
-
|
46
|
-
task :default => :test
|
47
|
-
|
48
|
-
require 'rake/testtask'
|
49
|
-
Rake::TestTask.new(:test) do |test|
|
50
|
-
test.libs << 'lib' << 'test'
|
51
|
-
test.pattern = 'test/**/test_*.rb'
|
52
|
-
test.verbose = true
|
53
|
-
end
|
54
|
-
|
55
|
-
desc "Generate RCov test coverage and open in your browser"
|
56
|
-
task :coverage do
|
57
|
-
require 'rcov'
|
58
|
-
sh "rm -fr coverage"
|
59
|
-
sh "rcov test/test_*.rb"
|
60
|
-
sh "open coverage/index.html"
|
61
|
-
end
|
62
|
-
|
63
|
-
# require 'rake/rdoctask'
|
64
|
-
# Rake::RDocTask.new do |rdoc|
|
65
|
-
# rdoc.rdoc_dir = 'rdoc'
|
66
|
-
# rdoc.title = "#{name} #{version}"
|
67
|
-
# rdoc.rdoc_files.include('README*')
|
68
|
-
# rdoc.rdoc_files.include('lib/**/*.rb')
|
69
|
-
# end
|
70
|
-
|
71
|
-
desc "Open an irb session preloaded with this library"
|
72
|
-
task :console do
|
73
|
-
sh "irb -rubygems -r ./lib/#{name}.rb"
|
74
|
-
end
|
75
|
-
|
76
|
-
#############################################################################
|
77
|
-
#
|
78
|
-
# Custom tasks (add your own tasks here)
|
79
|
-
#
|
80
|
-
#############################################################################
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
#############################################################################
|
85
|
-
#
|
86
|
-
# Packaging tasks
|
87
|
-
#
|
88
|
-
#############################################################################
|
89
|
-
|
90
|
-
desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
|
91
|
-
task :release => :build do
|
92
|
-
unless `git branch` =~ /^\* master$/
|
93
|
-
puts "You must be on the master branch to release!"
|
94
|
-
exit!
|
95
|
-
end
|
96
|
-
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
97
|
-
sh "git tag v#{version}"
|
98
|
-
sh "git push origin master"
|
99
|
-
sh "git push origin v#{version}"
|
100
|
-
sh "gem push pkg/#{name}-#{version}.gem"
|
101
|
-
end
|
102
|
-
|
103
|
-
desc "Build #{gem_file} into the pkg directory"
|
104
|
-
task :build => :gemspec do
|
105
|
-
sh "mkdir -p pkg"
|
106
|
-
sh "gem build #{gemspec_file}"
|
107
|
-
sh "mv #{gem_file} pkg"
|
108
|
-
end
|
109
|
-
|
110
|
-
desc "Generate #{gemspec_file}"
|
111
|
-
task :gemspec => :validate do
|
112
|
-
# read spec file and split out manifest section
|
113
|
-
spec = File.read(gemspec_file)
|
114
|
-
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
115
|
-
|
116
|
-
# replace name version and date
|
117
|
-
replace_header(head, :name)
|
118
|
-
replace_header(head, :version)
|
119
|
-
replace_header(head, :date)
|
120
|
-
#comment this out if your rubyforge_project has a different name
|
121
|
-
replace_header(head, :rubyforge_project)
|
122
|
-
|
123
|
-
# determine file list from git ls-files
|
124
|
-
files = `git ls-files`.
|
125
|
-
split("\n").
|
126
|
-
sort.
|
127
|
-
reject { |file| file =~ /^\./ }.
|
128
|
-
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
129
|
-
map { |file| " #{file}" }.
|
130
|
-
join("\n")
|
131
|
-
|
132
|
-
# piece file back together and write
|
133
|
-
manifest = " s.files = %w[\n#{files}\n ]\n"
|
134
|
-
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
135
|
-
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
136
|
-
puts "Updated #{gemspec_file}"
|
137
|
-
end
|
138
|
-
|
139
|
-
desc "Validate #{gemspec_file}"
|
140
|
-
task :validate do
|
141
|
-
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}", "lib/ssl"]
|
142
|
-
unless libfiles.empty?
|
143
|
-
puts "Directory `lib` should only contain a `#{name}.rb` file, `#{name}` dir and `lib/ssl` dir."
|
144
|
-
exit!
|
145
|
-
end
|
146
|
-
unless Dir['VERSION*'].empty?
|
147
|
-
puts "A `VERSION` file at root level violates Gem best practices."
|
148
|
-
exit!
|
149
|
-
end
|
150
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
#############################################################################
|
6
|
+
#
|
7
|
+
# Helper functions
|
8
|
+
#
|
9
|
+
#############################################################################
|
10
|
+
|
11
|
+
def name
|
12
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
17
|
+
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
18
|
+
end
|
19
|
+
|
20
|
+
def date
|
21
|
+
Date.today.to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def rubyforge_project
|
25
|
+
name
|
26
|
+
end
|
27
|
+
|
28
|
+
def gemspec_file
|
29
|
+
"#{name}.gemspec"
|
30
|
+
end
|
31
|
+
|
32
|
+
def gem_file
|
33
|
+
"#{name}-#{version}.gem"
|
34
|
+
end
|
35
|
+
|
36
|
+
def replace_header(head, header_name)
|
37
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
38
|
+
end
|
39
|
+
|
40
|
+
#############################################################################
|
41
|
+
#
|
42
|
+
# Standard tasks
|
43
|
+
#
|
44
|
+
#############################################################################
|
45
|
+
|
46
|
+
task :default => :test
|
47
|
+
|
48
|
+
require 'rake/testtask'
|
49
|
+
Rake::TestTask.new(:test) do |test|
|
50
|
+
test.libs << 'lib' << 'test'
|
51
|
+
test.pattern = 'test/**/test_*.rb'
|
52
|
+
test.verbose = true
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Generate RCov test coverage and open in your browser"
|
56
|
+
task :coverage do
|
57
|
+
require 'rcov'
|
58
|
+
sh "rm -fr coverage"
|
59
|
+
sh "rcov test/test_*.rb"
|
60
|
+
sh "open coverage/index.html"
|
61
|
+
end
|
62
|
+
|
63
|
+
# require 'rake/rdoctask'
|
64
|
+
# Rake::RDocTask.new do |rdoc|
|
65
|
+
# rdoc.rdoc_dir = 'rdoc'
|
66
|
+
# rdoc.title = "#{name} #{version}"
|
67
|
+
# rdoc.rdoc_files.include('README*')
|
68
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
69
|
+
# end
|
70
|
+
|
71
|
+
desc "Open an irb session preloaded with this library"
|
72
|
+
task :console do
|
73
|
+
sh "irb -rubygems -r ./lib/#{name}.rb"
|
74
|
+
end
|
75
|
+
|
76
|
+
#############################################################################
|
77
|
+
#
|
78
|
+
# Custom tasks (add your own tasks here)
|
79
|
+
#
|
80
|
+
#############################################################################
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
#############################################################################
|
85
|
+
#
|
86
|
+
# Packaging tasks
|
87
|
+
#
|
88
|
+
#############################################################################
|
89
|
+
|
90
|
+
desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
|
91
|
+
task :release => :build do
|
92
|
+
unless `git branch` =~ /^\* master$/
|
93
|
+
puts "You must be on the master branch to release!"
|
94
|
+
exit!
|
95
|
+
end
|
96
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
97
|
+
sh "git tag v#{version}"
|
98
|
+
sh "git push origin master"
|
99
|
+
sh "git push origin v#{version}"
|
100
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
101
|
+
end
|
102
|
+
|
103
|
+
desc "Build #{gem_file} into the pkg directory"
|
104
|
+
task :build => :gemspec do
|
105
|
+
sh "mkdir -p pkg"
|
106
|
+
sh "gem build #{gemspec_file}"
|
107
|
+
sh "mv #{gem_file} pkg"
|
108
|
+
end
|
109
|
+
|
110
|
+
desc "Generate #{gemspec_file}"
|
111
|
+
task :gemspec => :validate do
|
112
|
+
# read spec file and split out manifest section
|
113
|
+
spec = File.read(gemspec_file)
|
114
|
+
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
115
|
+
|
116
|
+
# replace name version and date
|
117
|
+
replace_header(head, :name)
|
118
|
+
replace_header(head, :version)
|
119
|
+
replace_header(head, :date)
|
120
|
+
#comment this out if your rubyforge_project has a different name
|
121
|
+
replace_header(head, :rubyforge_project)
|
122
|
+
|
123
|
+
# determine file list from git ls-files
|
124
|
+
files = `git ls-files`.
|
125
|
+
split("\n").
|
126
|
+
sort.
|
127
|
+
reject { |file| file =~ /^\./ }.
|
128
|
+
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
129
|
+
map { |file| " #{file}" }.
|
130
|
+
join("\n")
|
131
|
+
|
132
|
+
# piece file back together and write
|
133
|
+
manifest = " s.files = %w[\n#{files}\n ]\n"
|
134
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
135
|
+
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
136
|
+
puts "Updated #{gemspec_file}"
|
137
|
+
end
|
138
|
+
|
139
|
+
desc "Validate #{gemspec_file}"
|
140
|
+
task :validate do
|
141
|
+
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}", "lib/ssl"]
|
142
|
+
unless libfiles.empty?
|
143
|
+
puts "Directory `lib` should only contain a `#{name}.rb` file, `#{name}` dir and `lib/ssl` dir."
|
144
|
+
exit!
|
145
|
+
end
|
146
|
+
unless Dir['VERSION*'].empty?
|
147
|
+
puts "A `VERSION` file at root level violates Gem best practices."
|
148
|
+
exit!
|
149
|
+
end
|
150
|
+
end
|
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.
|
8
|
-
s.date = '
|
9
|
-
|
7
|
+
s.version = '2.12.0'
|
8
|
+
s.date = '2022-01-21'
|
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', '
|
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
|
|
@@ -80,6 +78,7 @@ Gem::Specification.new do |s|
|
|
80
78
|
lib/chargebee/models/site_migration_detail.rb
|
81
79
|
lib/chargebee/models/subscription.rb
|
82
80
|
lib/chargebee/models/subscription_estimate.rb
|
81
|
+
lib/chargebee/models/tax_withheld.rb
|
83
82
|
lib/chargebee/models/third_party_payment_method.rb
|
84
83
|
lib/chargebee/models/time_machine.rb
|
85
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
|
-
[:
|
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)
|
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
|
3
|
-
module ChargeBee
|
4
|
-
class ListResult
|
5
|
-
extend Forwardable
|
6
|
-
include Enumerable
|
7
|
-
|
8
|
-
def_delegator :@list, :each, :each
|
9
|
-
def_delegator :@list, :length, :length
|
10
|
-
|
11
|
-
attr_reader :next_offset
|
12
|
-
|
13
|
-
def initialize(response, next_offset=nil)
|
14
|
-
@response = response
|
15
|
-
@list = Array.new
|
16
|
-
@next_offset = JSON.parse(next_offset).to_s if next_offset
|
17
|
-
initItems()
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
def initItems()
|
22
|
-
@response.each do |item|
|
23
|
-
@list.push(Result.new(item))
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module ChargeBee
|
4
|
+
class ListResult
|
5
|
+
extend Forwardable
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
def_delegator :@list, :each, :each
|
9
|
+
def_delegator :@list, :length, :length
|
10
|
+
|
11
|
+
attr_reader :next_offset
|
12
|
+
|
13
|
+
def initialize(response, next_offset=nil)
|
14
|
+
@response = response
|
15
|
+
@list = Array.new
|
16
|
+
@next_offset = JSON.parse(next_offset).to_s if next_offset
|
17
|
+
initItems()
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def initItems()
|
22
|
+
@response.each do |item|
|
23
|
+
@list.push(Result.new(item))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -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,
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class CreditNote < Model
|
3
3
|
|
4
|
+
class Einvoice < Model
|
5
|
+
attr_accessor :id, :status, :message
|
6
|
+
end
|
7
|
+
|
4
8
|
class LineItem < Model
|
5
9
|
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
10
|
end
|
@@ -36,9 +40,9 @@ module ChargeBee
|
|
36
40
|
attr_accessor :id, :customer_id, :subscription_id, :reference_invoice_id, :type, :reason_code,
|
37
41
|
:status, :vat_number, :date, :price_type, :currency_code, :total, :amount_allocated, :amount_refunded,
|
38
42
|
:amount_available, :refunded_at, :voided_at, :generated_at, :resource_version, :updated_at,
|
39
|
-
:sub_total, :sub_total_in_local_currency, :total_in_local_currency, :local_currency_code,
|
40
|
-
:fractional_correction, :line_items, :discounts, :line_item_discounts, :line_item_tiers,
|
41
|
-
:line_item_taxes, :linked_refunds, :allocations, :deleted, :create_reason_code, :vat_number_prefix
|
43
|
+
:einvoice, :sub_total, :sub_total_in_local_currency, :total_in_local_currency, :local_currency_code,
|
44
|
+
:round_off_amount, :fractional_correction, :line_items, :discounts, :line_item_discounts, :line_item_tiers,
|
45
|
+
:taxes, :line_item_taxes, :linked_refunds, :allocations, :deleted, :create_reason_code, :vat_number_prefix
|
42
46
|
|
43
47
|
# OPERATIONS
|
44
48
|
#-----------
|
@@ -55,6 +59,10 @@ module ChargeBee
|
|
55
59
|
Request.send('post', uri_path("credit_notes",id.to_s,"pdf"), params, env, headers)
|
56
60
|
end
|
57
61
|
|
62
|
+
def self.download_einvoice(id, env=nil, headers={})
|
63
|
+
Request.send('get', uri_path("credit_notes",id.to_s,"download_einvoice"), {}, env, headers)
|
64
|
+
end
|
65
|
+
|
58
66
|
def self.refund(id, params={}, env=nil, headers={})
|
59
67
|
Request.send('post', uri_path("credit_notes",id.to_s,"refund"), params, env, headers)
|
60
68
|
end
|
@@ -21,6 +21,10 @@ module ChargeBee
|
|
21
21
|
attr_accessor :promotional_credits, :excess_payments, :refundable_credits, :unbilled_charges, :currency_code, :balance_currency_code
|
22
22
|
end
|
23
23
|
|
24
|
+
class EntityIdentifier < Model
|
25
|
+
attr_accessor :id, :value, :scheme, :standard
|
26
|
+
end
|
27
|
+
|
24
28
|
class Relationship < Model
|
25
29
|
attr_accessor :parent_id, :payment_owner_id, :invoice_owner_id
|
26
30
|
end
|
@@ -40,10 +44,10 @@ module ChargeBee
|
|
40
44
|
:billing_day_of_week, :billing_day_of_week_mode, :pii_cleared, :auto_close_invoices, :card_status,
|
41
45
|
:fraud_flag, :primary_payment_source_id, :backup_payment_source_id, :billing_address, :referral_urls,
|
42
46
|
:contacts, :payment_method, :invoice_notes, :preferred_currency_code, :promotional_credits,
|
43
|
-
:unbilled_charges, :refundable_credits, :excess_payments, :balances, :
|
44
|
-
:consolidated_invoicing, :customer_type, :business_customer_without_vat_number,
|
45
|
-
:relationship, :use_default_hierarchy_settings, :parent_account_access,
|
46
|
-
:vat_number_prefix
|
47
|
+
:unbilled_charges, :refundable_credits, :excess_payments, :balances, :entity_identifiers, :is_einvoice_enabled,
|
48
|
+
:meta_data, :deleted, :registered_for_gst, :consolidated_invoicing, :customer_type, :business_customer_without_vat_number,
|
49
|
+
:client_profile_id, :relationship, :use_default_hierarchy_settings, :parent_account_access,
|
50
|
+
:child_account_access, :vat_number_prefix, :entity_identifier_scheme, :entity_identifier_standard
|
47
51
|
|
48
52
|
# OPERATIONS
|
49
53
|
#-----------
|
@@ -140,7 +144,7 @@ module ChargeBee
|
|
140
144
|
Request.send('post', uri_path("customers",id.to_s,"delete_relationship"), {}, env, headers)
|
141
145
|
end
|
142
146
|
|
143
|
-
def self.hierarchy(id, params
|
147
|
+
def self.hierarchy(id, params, env=nil, headers={})
|
144
148
|
Request.send('get', uri_path("customers",id.to_s,"hierarchy"), params, env, headers)
|
145
149
|
end
|
146
150
|
|
@@ -61,6 +61,10 @@ module ChargeBee
|
|
61
61
|
attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
|
62
62
|
end
|
63
63
|
|
64
|
+
class Einvoice < Model
|
65
|
+
attr_accessor :id, :status, :message
|
66
|
+
end
|
67
|
+
|
64
68
|
attr_accessor :id, :po_number, :customer_id, :subscription_id, :recurring, :status, :vat_number,
|
65
69
|
:price_type, :date, :due_date, :net_term_days, :exchange_rate, :currency_code, :total, :amount_paid,
|
66
70
|
:amount_adjusted, :write_off_amount, :credits_applied, :amount_due, :paid_at, :dunning_status,
|
@@ -69,7 +73,8 @@ module ChargeBee
|
|
69
73
|
:term_finalized, :is_gifted, :generated_at, :expected_payment_date, :amount_to_collect, :round_off_amount,
|
70
74
|
:line_items, :discounts, :line_item_discounts, :taxes, :line_item_taxes, :line_item_tiers, :linked_payments,
|
71
75
|
:dunning_attempts, :applied_credits, :adjustment_credit_notes, :issued_credit_notes, :linked_orders,
|
72
|
-
:notes, :shipping_address, :billing_address, :payment_owner, :void_reason_code, :deleted,
|
76
|
+
:notes, :shipping_address, :billing_address, :einvoice, :payment_owner, :void_reason_code, :deleted,
|
77
|
+
:vat_number_prefix
|
73
78
|
|
74
79
|
# OPERATIONS
|
75
80
|
#-----------
|
@@ -130,6 +135,10 @@ module ChargeBee
|
|
130
135
|
Request.send('post', uri_path("invoices",id.to_s,"pdf"), params, env, headers)
|
131
136
|
end
|
132
137
|
|
138
|
+
def self.download_einvoice(id, env=nil, headers={})
|
139
|
+
Request.send('get', uri_path("invoices",id.to_s,"download_einvoice"), {}, env, headers)
|
140
|
+
end
|
141
|
+
|
133
142
|
def self.add_charge(id, params, env=nil, headers={})
|
134
143
|
Request.send('post', uri_path("invoices",id.to_s,"add_charge"), params, env, headers)
|
135
144
|
end
|
@@ -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
|