chargebee 1.7.4 → 2.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1107 -94
  3. data/LICENSE +1 -1
  4. data/README.rdoc +22 -15
  5. data/chargebee.gemspec +27 -7
  6. data/lib/.DS_Store +0 -0
  7. data/lib/chargebee.rb +28 -2
  8. data/lib/chargebee/environment.rb +11 -6
  9. data/lib/chargebee/errors.rb +1 -1
  10. data/lib/chargebee/models/addon.rb +18 -3
  11. data/lib/chargebee/models/address.rb +1 -1
  12. data/lib/chargebee/models/card.rb +8 -7
  13. data/lib/chargebee/models/comment.rb +1 -1
  14. data/lib/chargebee/models/contact.rb +11 -0
  15. data/lib/chargebee/models/coupon.rb +20 -4
  16. data/lib/chargebee/models/coupon_code.rb +9 -1
  17. data/lib/chargebee/models/coupon_set.rb +38 -0
  18. data/lib/chargebee/models/credit_note.rb +78 -0
  19. data/lib/chargebee/models/credit_note_estimate.rb +36 -0
  20. data/lib/chargebee/models/customer.rb +73 -12
  21. data/lib/chargebee/models/estimate.rb +26 -15
  22. data/lib/chargebee/models/event.rb +1 -1
  23. data/lib/chargebee/models/export.rb +87 -0
  24. data/lib/chargebee/models/gift.rb +43 -0
  25. data/lib/chargebee/models/hierarchy.rb +10 -0
  26. data/lib/chargebee/models/hosted_page.rb +33 -5
  27. data/lib/chargebee/models/invoice.rb +82 -19
  28. data/lib/chargebee/models/invoice_estimate.rb +36 -0
  29. data/lib/chargebee/models/model.rb +34 -3
  30. data/lib/chargebee/models/order.rb +49 -3
  31. data/lib/chargebee/models/payment_source.rb +84 -0
  32. data/lib/chargebee/models/plan.rb +33 -5
  33. data/lib/chargebee/models/promotional_credit.rb +31 -0
  34. data/lib/chargebee/models/quote.rb +77 -0
  35. data/lib/chargebee/models/resource_migration.rb +14 -0
  36. data/lib/chargebee/models/site_migration_detail.rb +15 -0
  37. data/lib/chargebee/models/subscription.rb +60 -8
  38. data/lib/chargebee/models/subscription_estimate.rb +14 -0
  39. data/lib/chargebee/models/third_party_payment_method.rb +10 -0
  40. data/lib/chargebee/models/time_machine.rb +47 -0
  41. data/lib/chargebee/models/token.rb +11 -0
  42. data/lib/chargebee/models/transaction.rb +29 -10
  43. data/lib/chargebee/models/unbilled_charge.rb +32 -0
  44. data/lib/chargebee/models/virtual_bank_account.rb +32 -0
  45. data/lib/chargebee/request.rb +11 -0
  46. data/lib/chargebee/rest.rb +6 -4
  47. data/lib/chargebee/result.rb +183 -27
  48. data/spec/errors_spec.rb +23 -0
  49. data/spec/sample_response.rb +1 -1
  50. metadata +39 -11
  51. data/lib/chargebee/models/payment_intent.rb +0 -27
@@ -0,0 +1,10 @@
1
+ module ChargeBee
2
+ class Hierarchy < Model
3
+
4
+ attr_accessor :parent_id, :payment_owner_id, :invoice_owner_id, :customer_id, :children_ids
5
+
6
+ # OPERATIONS
7
+ #-----------
8
+
9
+ end # ~Hierarchy
10
+ end # ~ChargeBee
@@ -2,7 +2,7 @@ module ChargeBee
2
2
  class HostedPage < Model
3
3
 
4
4
  attr_accessor :id, :type, :url, :state, :failure_reason, :pass_thru_content, :embed, :created_at,
5
- :expires_at
5
+ :expires_at, :updated_at, :resource_version, :checkout_info
6
6
 
7
7
  class Content < Result
8
8
  end
@@ -34,17 +34,45 @@ module ChargeBee
34
34
  Request.send('post', uri_path("hosted_pages","update_payment_method"), params, env, headers)
35
35
  end
36
36
 
37
- def self.checkout_onetime_charge(params, env=nil, headers={})
38
- Request.send('post', uri_path("hosted_pages","checkout_onetime_charge"), params, env, headers)
37
+ def self.manage_payment_sources(params, env=nil, headers={})
38
+ Request.send('post', uri_path("hosted_pages","manage_payment_sources"), params, env, headers)
39
39
  end
40
40
 
41
- def self.checkout_onetime_addons(params, env=nil, headers={})
42
- Request.send('post', uri_path("hosted_pages","checkout_onetime_addons"), params, env, headers)
41
+ def self.collect_now(params, env=nil, headers={})
42
+ Request.send('post', uri_path("hosted_pages","collect_now"), params, env, headers)
43
+ end
44
+
45
+ def self.accept_quote(params, env=nil, headers={})
46
+ Request.send('post', uri_path("hosted_pages","accept_quote"), params, env, headers)
47
+ end
48
+
49
+ def self.extend_subscription(params, env=nil, headers={})
50
+ Request.send('post', uri_path("hosted_pages","extend_subscription"), params, env, headers)
51
+ end
52
+
53
+ def self.checkout_gift(params, env=nil, headers={})
54
+ Request.send('post', uri_path("hosted_pages","checkout_gift"), params, env, headers)
55
+ end
56
+
57
+ def self.claim_gift(params, env=nil, headers={})
58
+ Request.send('post', uri_path("hosted_pages","claim_gift"), params, env, headers)
59
+ end
60
+
61
+ def self.retrieve_agreement_pdf(params, env=nil, headers={})
62
+ Request.send('post', uri_path("hosted_pages","retrieve_agreement_pdf"), params, env, headers)
63
+ end
64
+
65
+ def self.acknowledge(id, env=nil, headers={})
66
+ Request.send('post', uri_path("hosted_pages",id.to_s,"acknowledge"), {}, env, headers)
43
67
  end
44
68
 
45
69
  def self.retrieve(id, env=nil, headers={})
46
70
  Request.send('get', uri_path("hosted_pages",id.to_s), {}, env, headers)
47
71
  end
48
72
 
73
+ def self.list(params={}, env=nil, headers={})
74
+ Request.send_list_request('get', uri_path("hosted_pages"), params, env, headers)
75
+ end
76
+
49
77
  end # ~HostedPage
50
78
  end # ~ChargeBee
@@ -2,23 +2,51 @@ module ChargeBee
2
2
  class Invoice < Model
3
3
 
4
4
  class LineItem < Model
5
- attr_accessor :date_from, :date_to, :unit_amount, :quantity, :is_taxed, :tax, :tax_rate, :amount, :description, :type, :entity_type, :entity_id
5
+ attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
6
6
  end
7
7
 
8
8
  class Discount < Model
9
- attr_accessor :amount, :description, :type, :entity_id
9
+ attr_accessor :amount, :description, :entity_type, :entity_id
10
+ end
11
+
12
+ class LineItemDiscount < Model
13
+ attr_accessor :line_item_id, :discount_type, :coupon_id, :discount_amount
10
14
  end
11
15
 
12
16
  class Tax < Model
13
- attr_accessor :amount, :description
17
+ attr_accessor :name, :amount, :description
18
+ end
19
+
20
+ class LineItemTax < Model
21
+ attr_accessor :line_item_id, :tax_name, :tax_rate, :is_partial_tax_applied, :is_non_compliance_tax, :taxable_amount, :tax_amount, :tax_juris_type, :tax_juris_name, :tax_juris_code
22
+ end
23
+
24
+ class LineItemTier < Model
25
+ attr_accessor :line_item_id, :starting_unit, :ending_unit, :quantity_used, :unit_amount
26
+ end
27
+
28
+ class LinkedPayment < Model
29
+ attr_accessor :txn_id, :applied_amount, :applied_at, :txn_status, :txn_date, :txn_amount
14
30
  end
15
31
 
16
- class LinkedTransaction < Model
17
- attr_accessor :txn_id, :applied_amount, :applied_at, :txn_type, :txn_status, :txn_date, :txn_amount
32
+ class DunningAttempt < Model
33
+ attr_accessor :attempt, :transaction_id, :dunning_type, :created_at, :txn_status, :txn_amount
34
+ end
35
+
36
+ class AppliedCredit < Model
37
+ attr_accessor :cn_id, :applied_amount, :applied_at, :cn_reason_code, :cn_date, :cn_status
38
+ end
39
+
40
+ class AdjustmentCreditNote < Model
41
+ attr_accessor :cn_id, :cn_reason_code, :cn_date, :cn_total, :cn_status
42
+ end
43
+
44
+ class IssuedCreditNote < Model
45
+ attr_accessor :cn_id, :cn_reason_code, :cn_date, :cn_total, :cn_status
18
46
  end
19
47
 
20
48
  class LinkedOrder < Model
21
- attr_accessor :id, :status, :reference_id, :fulfillment_status, :batch_id, :created_at
49
+ attr_accessor :id, :document_number, :status, :order_type, :reference_id, :fulfillment_status, :batch_id, :created_at
22
50
  end
23
51
 
24
52
  class Note < Model
@@ -26,18 +54,21 @@ module ChargeBee
26
54
  end
27
55
 
28
56
  class ShippingAddress < Model
29
- attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip
57
+ attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
30
58
  end
31
59
 
32
60
  class BillingAddress < Model
33
- attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip
61
+ attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
34
62
  end
35
63
 
36
64
  attr_accessor :id, :po_number, :customer_id, :subscription_id, :recurring, :status, :vat_number,
37
- :price_type, :start_date, :end_date, :amount, :amount_paid, :amount_adjusted, :credits_applied,
38
- :amount_due, :paid_on, :dunning_status, :next_retry, :sub_total, :tax, :first_invoice, :currency_code,
39
- :line_items, :discounts, :taxes, :linked_transactions, :linked_orders, :notes, :shipping_address,
40
- :billing_address
65
+ :price_type, :date, :due_date, :net_term_days, :currency_code, :total, :amount_paid, :amount_adjusted,
66
+ :write_off_amount, :credits_applied, :amount_due, :paid_at, :dunning_status, :next_retry_at,
67
+ :voided_at, :resource_version, :updated_at, :sub_total, :tax, :first_invoice, :has_advance_charges,
68
+ :term_finalized, :is_gifted, :expected_payment_date, :amount_to_collect, :round_off_amount,
69
+ :line_items, :discounts, :line_item_discounts, :taxes, :line_item_taxes, :line_item_tiers, :linked_payments,
70
+ :dunning_attempts, :applied_credits, :adjustment_credit_notes, :issued_credit_notes, :linked_orders,
71
+ :notes, :shipping_address, :billing_address, :payment_owner, :deleted
41
72
 
42
73
  # OPERATIONS
43
74
  #-----------
@@ -54,12 +85,24 @@ module ChargeBee
54
85
  Request.send('post', uri_path("invoices","charge_addon"), params, env, headers)
55
86
  end
56
87
 
57
- def self.stop_dunning(id, env=nil, headers={})
58
- Request.send('post', uri_path("invoices",id.to_s,"stop_dunning"), {}, env, headers)
88
+ def self.stop_dunning(id, params={}, env=nil, headers={})
89
+ Request.send('post', uri_path("invoices",id.to_s,"stop_dunning"), params, env, headers)
90
+ end
91
+
92
+ def self.import_invoice(params, env=nil, headers={})
93
+ Request.send('post', uri_path("invoices","import_invoice"), params, env, headers)
94
+ end
95
+
96
+ def self.apply_payments(id, params={}, env=nil, headers={})
97
+ Request.send('post', uri_path("invoices",id.to_s,"apply_payments"), params, env, headers)
98
+ end
99
+
100
+ def self.apply_credits(id, params={}, env=nil, headers={})
101
+ Request.send('post', uri_path("invoices",id.to_s,"apply_credits"), params, env, headers)
59
102
  end
60
103
 
61
104
  def self.list(params={}, env=nil, headers={})
62
- Request.send('get', uri_path("invoices"), params, env, headers)
105
+ Request.send_list_request('get', uri_path("invoices"), params, env, headers)
63
106
  end
64
107
 
65
108
  def self.invoices_for_customer(id, params={}, env=nil, headers={})
@@ -74,8 +117,8 @@ module ChargeBee
74
117
  Request.send('get', uri_path("invoices",id.to_s), {}, env, headers)
75
118
  end
76
119
 
77
- def self.pdf(id, env=nil, headers={})
78
- Request.send('post', uri_path("invoices",id.to_s,"pdf"), {}, env, headers)
120
+ def self.pdf(id, params={}, env=nil, headers={})
121
+ Request.send('post', uri_path("invoices",id.to_s,"pdf"), params, env, headers)
79
122
  end
80
123
 
81
124
  def self.add_charge(id, params, env=nil, headers={})
@@ -86,14 +129,18 @@ module ChargeBee
86
129
  Request.send('post', uri_path("invoices",id.to_s,"add_addon_charge"), params, env, headers)
87
130
  end
88
131
 
89
- def self.collect(id, env=nil, headers={})
90
- Request.send('post', uri_path("invoices",id.to_s,"collect"), {}, env, headers)
132
+ def self.close(id, params={}, env=nil, headers={})
133
+ Request.send('post', uri_path("invoices",id.to_s,"close"), params, env, headers)
91
134
  end
92
135
 
93
136
  def self.collect_payment(id, params={}, env=nil, headers={})
94
137
  Request.send('post', uri_path("invoices",id.to_s,"collect_payment"), params, env, headers)
95
138
  end
96
139
 
140
+ def self.record_payment(id, params, env=nil, headers={})
141
+ Request.send('post', uri_path("invoices",id.to_s,"record_payment"), params, env, headers)
142
+ end
143
+
97
144
  def self.refund(id, params={}, env=nil, headers={})
98
145
  Request.send('post', uri_path("invoices",id.to_s,"refund"), params, env, headers)
99
146
  end
@@ -102,13 +149,29 @@ module ChargeBee
102
149
  Request.send('post', uri_path("invoices",id.to_s,"record_refund"), params, env, headers)
103
150
  end
104
151
 
152
+ def self.remove_payment(id, params, env=nil, headers={})
153
+ Request.send('post', uri_path("invoices",id.to_s,"remove_payment"), params, env, headers)
154
+ end
155
+
156
+ def self.remove_credit_note(id, params, env=nil, headers={})
157
+ Request.send('post', uri_path("invoices",id.to_s,"remove_credit_note"), params, env, headers)
158
+ end
159
+
105
160
  def self.void_invoice(id, params={}, env=nil, headers={})
106
161
  Request.send('post', uri_path("invoices",id.to_s,"void"), params, env, headers)
107
162
  end
108
163
 
164
+ def self.write_off(id, params={}, env=nil, headers={})
165
+ Request.send('post', uri_path("invoices",id.to_s,"write_off"), params, env, headers)
166
+ end
167
+
109
168
  def self.delete(id, params={}, env=nil, headers={})
110
169
  Request.send('post', uri_path("invoices",id.to_s,"delete"), params, env, headers)
111
170
  end
112
171
 
172
+ def self.update_details(id, params={}, env=nil, headers={})
173
+ Request.send('post', uri_path("invoices",id.to_s,"update_details"), params, env, headers)
174
+ end
175
+
113
176
  end # ~Invoice
114
177
  end # ~ChargeBee
@@ -0,0 +1,36 @@
1
+ module ChargeBee
2
+ class InvoiceEstimate < Model
3
+
4
+ class LineItem < Model
5
+ attr_accessor :id, :subscription_id, :date_from, :date_to, :unit_amount, :quantity, :amount, :pricing_model, :is_taxed, :tax_amount, :tax_rate, :discount_amount, :item_level_discount_amount, :description, :entity_type, :tax_exempt_reason, :entity_id, :customer_id
6
+ end
7
+
8
+ class Discount < Model
9
+ attr_accessor :amount, :description, :entity_type, :entity_id
10
+ end
11
+
12
+ class Tax < Model
13
+ attr_accessor :name, :amount, :description
14
+ end
15
+
16
+ class LineItemTax < Model
17
+ attr_accessor :line_item_id, :tax_name, :tax_rate, :is_partial_tax_applied, :is_non_compliance_tax, :taxable_amount, :tax_amount, :tax_juris_type, :tax_juris_name, :tax_juris_code
18
+ end
19
+
20
+ class LineItemTier < Model
21
+ attr_accessor :line_item_id, :starting_unit, :ending_unit, :quantity_used, :unit_amount
22
+ end
23
+
24
+ class LineItemDiscount < Model
25
+ attr_accessor :line_item_id, :discount_type, :coupon_id, :discount_amount
26
+ end
27
+
28
+ attr_accessor :recurring, :price_type, :currency_code, :sub_total, :total, :credits_applied,
29
+ :amount_paid, :amount_due, :line_items, :discounts, :taxes, :line_item_taxes, :line_item_tiers,
30
+ :line_item_discounts, :round_off_amount, :customer_id
31
+
32
+ # OPERATIONS
33
+ #-----------
34
+
35
+ end # ~InvoiceEstimate
36
+ end # ~ChargeBee
@@ -3,9 +3,10 @@ require 'uri'
3
3
  module ChargeBee
4
4
  class Model
5
5
 
6
- def initialize(values, sub_types={})
6
+ def initialize(values, sub_types={}, dependant_types={})
7
7
  @values = values
8
8
  @sub_types = sub_types
9
+ @dependant_types = dependant_types
9
10
  end
10
11
 
11
12
  def to_s(*args)
@@ -21,6 +22,8 @@ module ChargeBee
21
22
  values.each do |k, v|
22
23
  set_val = nil
23
24
  case v
25
+ when Hash && (@dependant_types[k] != nil)
26
+ next
24
27
  when Hash
25
28
  set_val = (@sub_types[k] != nil) ? @sub_types[k].construct(v) : v
26
29
  when Array
@@ -58,13 +61,41 @@ module ChargeBee
58
61
  return url
59
62
  end
60
63
 
61
- def self.construct(values, sub_types = {})
64
+ def self.construct(values, sub_types = {}, dependant_types = {})
62
65
  if(values != nil)
63
- obj = self.new(values, sub_types)
66
+ obj = self.new(values, sub_types, dependant_types)
64
67
  obj.load(values)
65
68
  obj
66
69
  end
67
70
  end
68
71
 
72
+ def init_dependant(obj, type, sub_types = {})
73
+ instance_eval do
74
+ if(obj[type] != nil)
75
+ case obj
76
+ when Hash
77
+ if(@dependant_types[type] != nil)
78
+ dependant_obj = @dependant_types[type].construct(obj[type], sub_types)
79
+ instance_variable_set("@#{type}", dependant_obj)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+
86
+ def init_dependant_list(obj, type, sub_types = {})
87
+ instance_eval do
88
+ if(obj[type] != nil)
89
+ case obj[type]
90
+ when Array
91
+ if(@dependant_types[type] != nil)
92
+ set_val = obj[type].map {|dt| @dependant_types[type].construct(dt, sub_types)}
93
+ instance_variable_set("@#{type}", set_val)
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+
69
100
  end
70
101
  end
@@ -1,8 +1,38 @@
1
1
  module ChargeBee
2
2
  class Order < Model
3
3
 
4
- attr_accessor :id, :invoice_id, :status, :reference_id, :fulfillment_status, :note, :tracking_id,
5
- :batch_id, :created_by, :created_at, :status_update_at
4
+ class OrderLineItem < Model
5
+ attr_accessor :id, :invoice_id, :invoice_line_item_id, :unit_price, :description, :amount, :fulfillment_quantity, :fulfillment_amount, :tax_amount, :amount_paid, :amount_adjusted, :refundable_credits_issued, :refundable_credits, :is_shippable, :sku, :status, :entity_type, :item_level_discount_amount, :discount_amount, :entity_id
6
+ end
7
+
8
+ class ShippingAddress < Model
9
+ attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
10
+ end
11
+
12
+ class BillingAddress < Model
13
+ attr_accessor :first_name, :last_name, :email, :company, :phone, :line1, :line2, :line3, :city, :state_code, :state, :country, :zip, :validation_status
14
+ end
15
+
16
+ class LineItemTax < Model
17
+ attr_accessor :line_item_id, :tax_name, :tax_rate, :is_partial_tax_applied, :is_non_compliance_tax, :taxable_amount, :tax_amount, :tax_juris_type, :tax_juris_name, :tax_juris_code
18
+ end
19
+
20
+ class LineItemDiscount < Model
21
+ attr_accessor :line_item_id, :discount_type, :coupon_id, :discount_amount
22
+ end
23
+
24
+ class LinkedCreditNote < Model
25
+ attr_accessor :amount, :type, :id, :status, :amount_adjusted, :amount_refunded
26
+ end
27
+
28
+ attr_accessor :id, :document_number, :invoice_id, :subscription_id, :customer_id, :status, :cancellation_reason,
29
+ :payment_status, :order_type, :price_type, :reference_id, :fulfillment_status, :order_date,
30
+ :shipping_date, :note, :tracking_id, :batch_id, :created_by, :shipment_carrier, :invoice_round_off_amount,
31
+ :tax, :amount_paid, :amount_adjusted, :refundable_credits_issued, :refundable_credits, :rounding_adjustement,
32
+ :paid_on, :shipping_cut_off_date, :created_at, :status_update_at, :delivered_at, :shipped_at,
33
+ :resource_version, :updated_at, :cancelled_at, :order_line_items, :shipping_address, :billing_address,
34
+ :discount, :sub_total, :total, :line_item_taxes, :line_item_discounts, :linked_credit_notes,
35
+ :deleted, :currency_code, :is_gifted, :gift_note, :gift_id
6
36
 
7
37
  # OPERATIONS
8
38
  #-----------
@@ -15,12 +45,28 @@ module ChargeBee
15
45
  Request.send('post', uri_path("orders",id.to_s), params, env, headers)
16
46
  end
17
47
 
48
+ def self.assign_order_number(id, env=nil, headers={})
49
+ Request.send('post', uri_path("orders",id.to_s,"assign_order_number"), {}, env, headers)
50
+ end
51
+
52
+ def self.cancel(id, params, env=nil, headers={})
53
+ Request.send('post', uri_path("orders",id.to_s,"cancel"), params, env, headers)
54
+ end
55
+
56
+ def self.create_refundable_credit_note(id, params, env=nil, headers={})
57
+ Request.send('post', uri_path("orders",id.to_s,"create_refundable_credit_note"), params, env, headers)
58
+ end
59
+
60
+ def self.reopen(id, params={}, env=nil, headers={})
61
+ Request.send('post', uri_path("orders",id.to_s,"reopen"), params, env, headers)
62
+ end
63
+
18
64
  def self.retrieve(id, env=nil, headers={})
19
65
  Request.send('get', uri_path("orders",id.to_s), {}, env, headers)
20
66
  end
21
67
 
22
68
  def self.list(params={}, env=nil, headers={})
23
- Request.send('get', uri_path("orders"), params, env, headers)
69
+ Request.send_list_request('get', uri_path("orders"), params, env, headers)
24
70
  end
25
71
 
26
72
  def self.orders_for_invoice(id, params={}, env=nil, headers={})
@@ -0,0 +1,84 @@
1
+ module ChargeBee
2
+ class PaymentSource < Model
3
+
4
+ class Card < Model
5
+ attr_accessor :first_name, :last_name, :iin, :last4, :brand, :funding_type, :expiry_month, :expiry_year, :billing_addr1, :billing_addr2, :billing_city, :billing_state_code, :billing_state, :billing_country, :billing_zip, :masked_number
6
+ end
7
+
8
+ class BankAccount < Model
9
+ attr_accessor :last4, :name_on_account, :bank_name, :mandate_id, :account_type, :echeck_type, :account_holder_type
10
+ end
11
+
12
+ class AmazonPayment < Model
13
+ attr_accessor :email, :agreement_id
14
+ end
15
+
16
+ class Paypal < Model
17
+ attr_accessor :email, :agreement_id
18
+ end
19
+
20
+ attr_accessor :id, :resource_version, :updated_at, :created_at, :customer_id, :type, :reference_id,
21
+ :status, :gateway, :gateway_account_id, :ip_address, :issuing_country, :card, :bank_account,
22
+ :amazon_payment, :paypal, :deleted
23
+
24
+ # OPERATIONS
25
+ #-----------
26
+
27
+ def self.create_using_temp_token(params, env=nil, headers={})
28
+ Request.send('post', uri_path("payment_sources","create_using_temp_token"), params, env, headers)
29
+ end
30
+
31
+ def self.create_using_permanent_token(params, env=nil, headers={})
32
+ Request.send('post', uri_path("payment_sources","create_using_permanent_token"), params, env, headers)
33
+ end
34
+
35
+ def self.create_using_token(params, env=nil, headers={})
36
+ Request.send('post', uri_path("payment_sources","create_using_token"), params, env, headers)
37
+ end
38
+
39
+ def self.create_using_payment_intent(params, env=nil, headers={})
40
+ Request.send('post', uri_path("payment_sources","create_using_payment_intent"), params, env, headers)
41
+ end
42
+
43
+ def self.create_card(params, env=nil, headers={})
44
+ Request.send('post', uri_path("payment_sources","create_card"), params, env, headers)
45
+ end
46
+
47
+ def self.create_bank_account(params, env=nil, headers={})
48
+ Request.send('post', uri_path("payment_sources","create_bank_account"), params, env, headers)
49
+ end
50
+
51
+ def self.update_card(id, params={}, env=nil, headers={})
52
+ Request.send('post', uri_path("payment_sources",id.to_s,"update_card"), params, env, headers)
53
+ end
54
+
55
+ def self.verify_bank_account(id, params, env=nil, headers={})
56
+ Request.send('post', uri_path("payment_sources",id.to_s,"verify_bank_account"), params, env, headers)
57
+ end
58
+
59
+ def self.retrieve(id, env=nil, headers={})
60
+ Request.send('get', uri_path("payment_sources",id.to_s), {}, env, headers)
61
+ end
62
+
63
+ def self.list(params={}, env=nil, headers={})
64
+ Request.send_list_request('get', uri_path("payment_sources"), params, env, headers)
65
+ end
66
+
67
+ def self.switch_gateway_account(id, params, env=nil, headers={})
68
+ Request.send('post', uri_path("payment_sources",id.to_s,"switch_gateway_account"), params, env, headers)
69
+ end
70
+
71
+ def self.export_payment_source(id, params, env=nil, headers={})
72
+ Request.send('post', uri_path("payment_sources",id.to_s,"export_payment_source"), params, env, headers)
73
+ end
74
+
75
+ def self.delete(id, env=nil, headers={})
76
+ Request.send('post', uri_path("payment_sources",id.to_s,"delete"), {}, env, headers)
77
+ end
78
+
79
+ def self.delete_local(id, env=nil, headers={})
80
+ Request.send('post', uri_path("payment_sources",id.to_s,"delete_local"), {}, env, headers)
81
+ end
82
+
83
+ end # ~PaymentSource
84
+ end # ~ChargeBee