chargebee 2.11.1 → 2.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: e664476f0031637f5dc53d9d0222d6b3200302412d09e0f538c52b566c290bcc
4
- data.tar.gz: e6f0dc23f445dc4adba98662b23590b3a957918ec3f0e8d274c750b2fab4a985
2
+ SHA1:
3
+ metadata.gz: 84ddec3287c1f877d8c82aa863ddc577be16d9df
4
+ data.tar.gz: e2f4657d35d5a3273449f202ce60633e898e270b
5
5
  SHA512:
6
- metadata.gz: 6771250ed0a73f48d33fc4056cec1e5fa58a4222a7606e40a3ec484519a33e00caaede36b9cdd93a3c9918ca7107a054709cda4b12b8616c7812f5b43cb47868
7
- data.tar.gz: 49d50cef08a046ecce8493de915fe1ba93e66a5b84b79cc8d8904dcb5e05d0e33018288393c9b55cf22954b504bd5e6a721e377aab622ffea821975a599400d7
6
+ metadata.gz: 0172714c7ae6194e8e6215f3b50dcbee257c1a0f12dd87df8caca7ae83dc28c424f715dab3e44cdd5607ff62ae5cf3756c5d6222d150cef16ad4eb58a636618f
7
+ data.tar.gz: 15c633d1d3efd0f826dd1d45d0131b4541da62d56d47571300f393fd8f5392456d2d6d0f45d5f02aabbb0eeca0aaf133c419bacc1c786371a2a5c6ba3dcf3882
data/CHANGELOG.md CHANGED
@@ -1,3 +1,85 @@
1
+ ### v2.13.0 (2022-03-08)
2
+ * * *
3
+
4
+ ### Fixes:
5
+ * Fixed serialization issue for nested array attributes.
6
+ * Fixed method_missing implementation.
7
+ * Fixed RSpec deprecation warnings issue.
8
+
9
+ #### New attributes:
10
+ * upi, mandates and their subresources have been added to the payment_source resource.
11
+
12
+ #### New Input parameters:
13
+ * bank_account[phone] have been added to customers#create_bank_account
14
+ * payment_intent[payment_method_type] have been added to customers#create_payment_intent, customers#collect_payment_intent
15
+ * payment_intent[payment_method_type] have been added to estimate#gift_subscription and estimate#gift_subscription_for_items.
16
+ * payment_intent[payment_method_type] have been added to gift#create_payment_intent and gift#create_gift_for_items_payment_intent.
17
+ * customer[is_einvoice_enabled], customer[entity_identifier_scheme], customer[entity_identifier_standard], entity_identifiers[id], entity_identifiers[scheme], entity_identifiers[value], entity_identifiers[operation], entity_identifiers[standard] have been added to hosted_page#checkout_onetime_for_items, hosted_page#checkout_new_for_items and hosted_page#checkout_existing_for_items.
18
+ * bank_account[phone] have been added to invoice#create_bank_account, invoice#create_bank_account_for_chargeitems_and_charges
19
+ * payment_intent[payment_method_type] have been added to invoice#create_payment_intent, invoice#create_payment_intent_for_chargeitems_and_charges
20
+ * bank_account[phone] have been added to payment_source#create_bank_account
21
+ * payment_intent[payment_method_type] have been added to payment_source#create_using_payment_intent
22
+ * subscription_id have been added to payment_source#list_payment_source
23
+ * bank_account[phone] have been added to subscription#create_bank_account
24
+ * payment_intent[payment_method_type] have been added to subscription#create_payment_intent, subscription#create_payment_intent_for_customer, subscription#create_payment_intent_with_items, subscription#update_payment_intent, subscription#update_payment_intent_for_items, subscription#reactivate_payment_intent, subscription#resume_payment_intent
25
+ * activated_at have been added to subscription#import_subscription, subscription#import_subscription_for_customer, subscription#import_subscription_for_items
26
+
27
+ #### New Enum values:
28
+ * upi, netbanking_emandates enum has been added in customer_payment_method_type subresource of customer resource
29
+ * current enum has been added in account_type.
30
+ * quickbooks, razorpay enum has been added in gateway.
31
+ * upi, netbanking_emandates enum has been added in payment_method,payment_method_type, type
32
+ * upi, netbanking_emandates, apple_pay enum has been added in payment_method_type subresource of payment_intent resource
33
+ * current enum has been added in bank_account_type subresource of payment_source.
34
+
35
+ #### Deprecated attributes:
36
+ * coupon attribute have been added and deprecated in hosted_page resource.
37
+
38
+ #### Deprecated enums:
39
+ * NetdPaymentDueReminder have been deprecated in event_type.
40
+
41
+
42
+ ### v2.12.0 (2022-01-21)
43
+ * * *
44
+
45
+ #### New endpoints:
46
+ * credit_notes#download_einvoice has been added to the credit_notes resource.
47
+ * invoice#download_einvoice has been added to the invoice resource.
48
+
49
+ #### New attributes:
50
+ * is_einvoice_enabled, entity_identifier_scheme, entity_identifier_standard and entity_identifiers[] have been added to the customer resource.
51
+ * einvoice has been added to the invoice resource.
52
+ * einvoice has been added to the credit_notes resource.
53
+ * mime_type has been added to the download resource.
54
+
55
+ #### New Input parameters:
56
+ * 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.
57
+ * 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.
58
+ * 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.
59
+
60
+ #### New Enum values:
61
+ * operation enum has been added.
62
+ * status enum has been added in credit_notes_einvoice subresource of credit_notes resource.
63
+
64
+ #### Deprecated attributes:
65
+ * user, type, payment_method and exchange_rate have been deprecated from TaxWithHeld resource.
66
+
67
+ #### Deprecated enums:
68
+ * type and payment_method have been deprecated in TaxWithHeld resource.
69
+
70
+ #### Updated parameters:
71
+ * hierarchy_operation_type has been made mandatory in customers#get_hierarchy api.
72
+
73
+ #### Removed Filter parameters:
74
+ * create_pending_invoices has been removed from subscriptions#list_subscriptions api.
75
+
76
+
77
+ ### v2.11.2 (2021-01-05)
78
+ * * *
79
+
80
+ ### Fixes:
81
+ * Improved error message for Invalid JSON response.
82
+
1
83
  ### v2.11.1 (2021-12-22)
2
84
  * * *
3
85
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2011-2021 ChargeBee, Inc.
3
+ Copyright (c) 2011-2022 ChargeBee, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person
6
6
  obtaining a copy of this software and associated documentation
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.11.1'
8
- s.date = '2021-12-22'
7
+ s.version = '2.13.0'
8
+ s.date = '2022-03-08'
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, :round_off_amount,
40
- :fractional_correction, :line_items, :discounts, :line_item_discounts, :line_item_tiers, :taxes,
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, :meta_data, :deleted, :registered_for_gst,
44
- :consolidated_invoicing, :customer_type, :business_customer_without_vat_number, :client_profile_id,
45
- :relationship, :use_default_hierarchy_settings, :parent_account_access, :child_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={}, env=nil, headers={})
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
 
@@ -1,7 +1,7 @@
1
1
  module ChargeBee
2
2
  class Download < Model
3
3
 
4
- attr_accessor :download_url, :valid_till
4
+ attr_accessor :download_url, :valid_till, :mime_type
5
5
 
6
6
  # OPERATIONS
7
7
  #-----------
@@ -2,7 +2,7 @@ module ChargeBee
2
2
  class Export < Model
3
3
 
4
4
  class Download < Model
5
- attr_accessor :download_url, :valid_till
5
+ attr_accessor :download_url, :valid_till, :mime_type
6
6
  end
7
7
 
8
8
  attr_accessor :id, :operation_type, :mime_type, :status, :created_at, :download
@@ -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, :vat_number_prefix
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
@@ -47,8 +47,8 @@ module ChargeBee
47
47
  elsif(m[0,3] == "cf_") # All the custom fields start with prefix cf_.
48
48
  return nil
49
49
  end
50
- puts "There's no method called #{m} #{args} here -- please try again."
51
- puts @values
50
+ message = "There's no method called #{m} #{args} here -- please try again."
51
+ raise NoMethodError, message
52
52
  end
53
53
 
54
54
  def self.uri_path(*paths)
@@ -13,13 +13,21 @@ module ChargeBee
13
13
  attr_accessor :email, :agreement_id
14
14
  end
15
15
 
16
+ class Upi < Model
17
+ attr_accessor :vpa
18
+ end
19
+
16
20
  class Paypal < Model
17
21
  attr_accessor :email, :agreement_id
18
22
  end
19
23
 
24
+ class Mandate < Model
25
+ attr_accessor :id, :subscription_id, :created_at
26
+ end
27
+
20
28
  attr_accessor :id, :resource_version, :updated_at, :created_at, :customer_id, :type, :reference_id,
21
29
  :status, :gateway, :gateway_account_id, :ip_address, :issuing_country, :card, :bank_account,
22
- :amazon_payment, :paypal, :deleted
30
+ :amazon_payment, :upi, :paypal, :mandates, :deleted
23
31
 
24
32
  # OPERATIONS
25
33
  #-----------
@@ -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, :amount
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
  #-----------
@@ -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