chargebee 2.11.2 → 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 +5 -5
- data/CHANGELOG.md +35 -0
- data/LICENSE +1 -1
- data/Rakefile +150 -150
- data/chargebee.gemspec +2 -2
- data/lib/chargebee/list_result.rb +28 -28
- 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/tax_withheld.rb +2 -1
- data/lib/chargebee/result.rb +11 -5
- data/lib/chargebee/util.rb +56 -56
- data/lib/chargebee.rb +1 -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 +21 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
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,38 @@
|
|
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
|
+
|
1
36
|
### v2.11.2 (2021-01-05)
|
2
37
|
* * *
|
3
38
|
|
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,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-01-
|
7
|
+
s.version = '2.12.0'
|
8
|
+
s.date = '2022-01-21'
|
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
|
|
@@ -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
|
@@ -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
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module ChargeBee
|
2
2
|
class TaxWithheld < Model
|
3
3
|
|
4
|
-
attr_accessor :id, :reference_number, :description, :date, :currency_code,
|
4
|
+
attr_accessor :id, :user, :reference_number, :description, :type, :payment_method, :date, :currency_code,
|
5
|
+
:amount, :exchange_rate
|
5
6
|
|
6
7
|
# OPERATIONS
|
7
8
|
#-----------
|
data/lib/chargebee/result.rb
CHANGED
@@ -24,7 +24,7 @@ module ChargeBee
|
|
24
24
|
|
25
25
|
def customer()
|
26
26
|
customer = get(:customer, Customer,
|
27
|
-
{:billing_address => Customer::BillingAddress, :referral_urls => Customer::ReferralUrl, :contacts => Customer::Contact, :payment_method => Customer::PaymentMethod, :balances => Customer::Balance, :relationship => Customer::Relationship, :parent_account_access => Customer::ParentAccountAccess, :child_account_access => Customer::ChildAccountAccess});
|
27
|
+
{:billing_address => Customer::BillingAddress, :referral_urls => Customer::ReferralUrl, :contacts => Customer::Contact, :payment_method => Customer::PaymentMethod, :balances => Customer::Balance, :entity_identifiers => Customer::EntityIdentifier, :relationship => Customer::Relationship, :parent_account_access => Customer::ParentAccountAccess, :child_account_access => Customer::ChildAccountAccess});
|
28
28
|
return customer;
|
29
29
|
end
|
30
30
|
|
@@ -71,7 +71,7 @@ module ChargeBee
|
|
71
71
|
|
72
72
|
def invoice()
|
73
73
|
invoice = get(:invoice, Invoice,
|
74
|
-
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :dunning_attempts => Invoice::DunningAttempt, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress});
|
74
|
+
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :dunning_attempts => Invoice::DunningAttempt, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress, :einvoice => Invoice::Einvoice});
|
75
75
|
return invoice;
|
76
76
|
end
|
77
77
|
|
@@ -82,7 +82,7 @@ module ChargeBee
|
|
82
82
|
|
83
83
|
def credit_note()
|
84
84
|
credit_note = get(:credit_note, CreditNote,
|
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});
|
85
|
+
{:einvoice => CreditNote::Einvoice, :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});
|
86
86
|
return credit_note;
|
87
87
|
end
|
88
88
|
|
@@ -281,7 +281,7 @@ module ChargeBee
|
|
281
281
|
|
282
282
|
def credit_notes()
|
283
283
|
credit_notes = get_list(:credit_notes, CreditNote,
|
284
|
-
{: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});
|
284
|
+
{:einvoice => CreditNote::Einvoice, :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});
|
285
285
|
return credit_notes;
|
286
286
|
end
|
287
287
|
|
@@ -297,9 +297,15 @@ module ChargeBee
|
|
297
297
|
return hierarchies;
|
298
298
|
end
|
299
299
|
|
300
|
+
def downloads()
|
301
|
+
downloads = get_list(:downloads, Download,
|
302
|
+
{});
|
303
|
+
return downloads;
|
304
|
+
end
|
305
|
+
|
300
306
|
def invoices()
|
301
307
|
invoices = get_list(:invoices, Invoice,
|
302
|
-
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :dunning_attempts => Invoice::DunningAttempt, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress});
|
308
|
+
{:line_items => Invoice::LineItem, :discounts => Invoice::Discount, :line_item_discounts => Invoice::LineItemDiscount, :taxes => Invoice::Tax, :line_item_taxes => Invoice::LineItemTax, :line_item_tiers => Invoice::LineItemTier, :linked_payments => Invoice::LinkedPayment, :dunning_attempts => Invoice::DunningAttempt, :applied_credits => Invoice::AppliedCredit, :adjustment_credit_notes => Invoice::AdjustmentCreditNote, :issued_credit_notes => Invoice::IssuedCreditNote, :linked_orders => Invoice::LinkedOrder, :notes => Invoice::Note, :shipping_address => Invoice::ShippingAddress, :billing_address => Invoice::BillingAddress, :einvoice => Invoice::Einvoice});
|
303
309
|
return invoices;
|
304
310
|
end
|
305
311
|
|