chargebee 2.6.4 → 2.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1524 -1488
- data/LICENSE +24 -24
- data/README.rdoc +41 -41
- data/chargebee.gemspec +4 -3
- data/lib/chargebee.rb +85 -85
- data/lib/chargebee/environment.rb +28 -28
- data/lib/chargebee/errors.rb +43 -43
- data/lib/chargebee/models/addon.rb +45 -45
- data/lib/chargebee/models/address.rb +18 -18
- data/lib/chargebee/models/card.rb +32 -32
- data/lib/chargebee/models/comment.rb +25 -25
- data/lib/chargebee/models/contact.rb +10 -10
- data/lib/chargebee/models/coupon.rb +40 -40
- data/lib/chargebee/models/coupon_code.rb +25 -25
- data/lib/chargebee/models/coupon_set.rb +37 -37
- data/lib/chargebee/models/credit_note.rb +77 -77
- data/lib/chargebee/models/credit_note_estimate.rb +35 -35
- data/lib/chargebee/models/customer.rb +137 -120
- data/lib/chargebee/models/download.rb +9 -9
- data/lib/chargebee/models/estimate.rb +46 -46
- data/lib/chargebee/models/event.rb +45 -45
- data/lib/chargebee/models/export.rb +86 -86
- data/lib/chargebee/models/gift.rb +42 -42
- data/lib/chargebee/models/hierarchy.rb +10 -0
- data/lib/chargebee/models/hosted_page.rb +77 -77
- data/lib/chargebee/models/invoice.rb +172 -172
- data/lib/chargebee/models/invoice_estimate.rb +35 -35
- data/lib/chargebee/models/model.rb +101 -101
- data/lib/chargebee/models/order.rb +76 -76
- data/lib/chargebee/models/payment_source.rb +79 -71
- data/lib/chargebee/models/plan.rb +60 -59
- data/lib/chargebee/models/portal_session.rb +30 -30
- data/lib/chargebee/models/promotional_credit.rb +30 -30
- data/lib/chargebee/models/quote.rb +72 -72
- data/lib/chargebee/models/resource_migration.rb +13 -13
- data/lib/chargebee/models/site_migration_detail.rb +14 -14
- data/lib/chargebee/models/subscription.rb +137 -137
- data/lib/chargebee/models/subscription_estimate.rb +13 -13
- data/lib/chargebee/models/third_party_payment_method.rb +9 -9
- data/lib/chargebee/models/time_machine.rb +46 -46
- data/lib/chargebee/models/token.rb +11 -0
- data/lib/chargebee/models/transaction.rb +62 -62
- data/lib/chargebee/models/unbilled_charge.rb +31 -31
- data/lib/chargebee/models/virtual_bank_account.rb +30 -26
- data/lib/chargebee/request.rb +27 -27
- data/lib/chargebee/rest.rb +92 -92
- data/lib/chargebee/result.rb +255 -240
- data/spec/errors_spec.rb +23 -23
- data/spec/sample_response.rb +73 -73
- metadata +5 -4
- data/lib/chargebee/.DS_Store +0 -0
@@ -1,36 +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
|
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, :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
|
31
|
-
|
32
|
-
# OPERATIONS
|
33
|
-
#-----------
|
34
|
-
|
35
|
-
end # ~InvoiceEstimate
|
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
|
31
|
+
|
32
|
+
# OPERATIONS
|
33
|
+
#-----------
|
34
|
+
|
35
|
+
end # ~InvoiceEstimate
|
36
36
|
end # ~ChargeBee
|
@@ -1,101 +1,101 @@
|
|
1
|
-
require 'uri'
|
2
|
-
|
3
|
-
module ChargeBee
|
4
|
-
class Model
|
5
|
-
|
6
|
-
def initialize(values, sub_types={}, dependant_types={})
|
7
|
-
@values = values
|
8
|
-
@sub_types = sub_types
|
9
|
-
@dependant_types = dependant_types
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_s(*args)
|
13
|
-
JSON.pretty_generate(@values)
|
14
|
-
end
|
15
|
-
|
16
|
-
def inspect()
|
17
|
-
"#<#{self.class}:0x#{self.object_id.to_s(16)} > JSON: " + JSON.pretty_generate(@values)
|
18
|
-
end
|
19
|
-
|
20
|
-
def load(values)
|
21
|
-
instance_eval do
|
22
|
-
values.each do |k, v|
|
23
|
-
set_val = nil
|
24
|
-
case v
|
25
|
-
when Hash && (@dependant_types[k] != nil)
|
26
|
-
next
|
27
|
-
when Hash
|
28
|
-
set_val = (@sub_types[k] != nil) ? @sub_types[k].construct(v) : v
|
29
|
-
when Array
|
30
|
-
if(@sub_types[k] != nil)
|
31
|
-
set_val = v.map { |item| @sub_types[k].construct(item)}
|
32
|
-
else
|
33
|
-
set_val = v
|
34
|
-
end
|
35
|
-
else
|
36
|
-
set_val = v
|
37
|
-
end
|
38
|
-
instance_variable_set("@#{k}", set_val)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def method_missing(m, *args, &block)
|
44
|
-
if(@values.has_key?(m))
|
45
|
-
return @values[m]
|
46
|
-
elsif(m[0,3] == "cf_") # All the custom fields start with prefix cf_.
|
47
|
-
return nil
|
48
|
-
end
|
49
|
-
puts "There's no method called #{m} #{args} here -- please try again."
|
50
|
-
puts @values
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.uri_path(*paths)
|
54
|
-
url = ""
|
55
|
-
for path in paths
|
56
|
-
if(path.nil? || path.strip.length < 1)
|
57
|
-
raise "Id is empty or nil"
|
58
|
-
end
|
59
|
-
url = "#{url}/#{URI.encode(path.strip)}"
|
60
|
-
end
|
61
|
-
return url
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.construct(values, sub_types = {}, dependant_types = {})
|
65
|
-
if(values != nil)
|
66
|
-
obj = self.new(values, sub_types, dependant_types)
|
67
|
-
obj.load(values)
|
68
|
-
obj
|
69
|
-
end
|
70
|
-
end
|
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
|
-
|
100
|
-
end
|
101
|
-
end
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module ChargeBee
|
4
|
+
class Model
|
5
|
+
|
6
|
+
def initialize(values, sub_types={}, dependant_types={})
|
7
|
+
@values = values
|
8
|
+
@sub_types = sub_types
|
9
|
+
@dependant_types = dependant_types
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s(*args)
|
13
|
+
JSON.pretty_generate(@values)
|
14
|
+
end
|
15
|
+
|
16
|
+
def inspect()
|
17
|
+
"#<#{self.class}:0x#{self.object_id.to_s(16)} > JSON: " + JSON.pretty_generate(@values)
|
18
|
+
end
|
19
|
+
|
20
|
+
def load(values)
|
21
|
+
instance_eval do
|
22
|
+
values.each do |k, v|
|
23
|
+
set_val = nil
|
24
|
+
case v
|
25
|
+
when Hash && (@dependant_types[k] != nil)
|
26
|
+
next
|
27
|
+
when Hash
|
28
|
+
set_val = (@sub_types[k] != nil) ? @sub_types[k].construct(v) : v
|
29
|
+
when Array
|
30
|
+
if(@sub_types[k] != nil)
|
31
|
+
set_val = v.map { |item| @sub_types[k].construct(item)}
|
32
|
+
else
|
33
|
+
set_val = v
|
34
|
+
end
|
35
|
+
else
|
36
|
+
set_val = v
|
37
|
+
end
|
38
|
+
instance_variable_set("@#{k}", set_val)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def method_missing(m, *args, &block)
|
44
|
+
if(@values.has_key?(m))
|
45
|
+
return @values[m]
|
46
|
+
elsif(m[0,3] == "cf_") # All the custom fields start with prefix cf_.
|
47
|
+
return nil
|
48
|
+
end
|
49
|
+
puts "There's no method called #{m} #{args} here -- please try again."
|
50
|
+
puts @values
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.uri_path(*paths)
|
54
|
+
url = ""
|
55
|
+
for path in paths
|
56
|
+
if(path.nil? || path.strip.length < 1)
|
57
|
+
raise "Id is empty or nil"
|
58
|
+
end
|
59
|
+
url = "#{url}/#{URI.encode(path.strip)}"
|
60
|
+
end
|
61
|
+
return url
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.construct(values, sub_types = {}, dependant_types = {})
|
65
|
+
if(values != nil)
|
66
|
+
obj = self.new(values, sub_types, dependant_types)
|
67
|
+
obj.load(values)
|
68
|
+
obj
|
69
|
+
end
|
70
|
+
end
|
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
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -1,77 +1,77 @@
|
|
1
|
-
module ChargeBee
|
2
|
-
class Order < Model
|
3
|
-
|
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, :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
|
36
|
-
|
37
|
-
# OPERATIONS
|
38
|
-
#-----------
|
39
|
-
|
40
|
-
def self.create(params, env=nil, headers={})
|
41
|
-
Request.send('post', uri_path("orders"), params, env, headers)
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.update(id, params={}, env=nil, headers={})
|
45
|
-
Request.send('post', uri_path("orders",id.to_s), params, env, headers)
|
46
|
-
end
|
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
|
-
|
64
|
-
def self.retrieve(id, env=nil, headers={})
|
65
|
-
Request.send('get', uri_path("orders",id.to_s), {}, env, headers)
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.list(params={}, env=nil, headers={})
|
69
|
-
Request.send_list_request('get', uri_path("orders"), params, env, headers)
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.orders_for_invoice(id, params={}, env=nil, headers={})
|
73
|
-
Request.send('get', uri_path("invoices",id.to_s,"orders"), params, env, headers)
|
74
|
-
end
|
75
|
-
|
76
|
-
end # ~Order
|
1
|
+
module ChargeBee
|
2
|
+
class Order < Model
|
3
|
+
|
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
|
36
|
+
|
37
|
+
# OPERATIONS
|
38
|
+
#-----------
|
39
|
+
|
40
|
+
def self.create(params, env=nil, headers={})
|
41
|
+
Request.send('post', uri_path("orders"), params, env, headers)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.update(id, params={}, env=nil, headers={})
|
45
|
+
Request.send('post', uri_path("orders",id.to_s), params, env, headers)
|
46
|
+
end
|
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
|
+
|
64
|
+
def self.retrieve(id, env=nil, headers={})
|
65
|
+
Request.send('get', uri_path("orders",id.to_s), {}, env, headers)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.list(params={}, env=nil, headers={})
|
69
|
+
Request.send_list_request('get', uri_path("orders"), params, env, headers)
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.orders_for_invoice(id, params={}, env=nil, headers={})
|
73
|
+
Request.send('get', uri_path("invoices",id.to_s,"orders"), params, env, headers)
|
74
|
+
end
|
75
|
+
|
76
|
+
end # ~Order
|
77
77
|
end # ~ChargeBee
|
@@ -1,72 +1,80 @@
|
|
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.
|
36
|
-
Request.send('post', uri_path("payment_sources","
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.
|
40
|
-
Request.send('post', uri_path("payment_sources","
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.
|
44
|
-
Request.send('post', uri_path("payment_sources",
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.
|
48
|
-
Request.send('post', uri_path("payment_sources",id.to_s,"
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.
|
52
|
-
Request.send('
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.
|
56
|
-
Request.
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.
|
60
|
-
Request.
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.
|
64
|
-
Request.send('post', uri_path("payment_sources",id.to_s,"
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.
|
68
|
-
Request.send('post', uri_path("payment_sources",id.to_s,"
|
69
|
-
end
|
70
|
-
|
71
|
-
|
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_card(params, env=nil, headers={})
|
40
|
+
Request.send('post', uri_path("payment_sources","create_card"), params, env, headers)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.create_bank_account(params, env=nil, headers={})
|
44
|
+
Request.send('post', uri_path("payment_sources","create_bank_account"), params, env, headers)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.update_card(id, params={}, env=nil, headers={})
|
48
|
+
Request.send('post', uri_path("payment_sources",id.to_s,"update_card"), params, env, headers)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.verify_bank_account(id, params, env=nil, headers={})
|
52
|
+
Request.send('post', uri_path("payment_sources",id.to_s,"verify_bank_account"), params, env, headers)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.retrieve(id, env=nil, headers={})
|
56
|
+
Request.send('get', uri_path("payment_sources",id.to_s), {}, env, headers)
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.list(params={}, env=nil, headers={})
|
60
|
+
Request.send_list_request('get', uri_path("payment_sources"), params, env, headers)
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.switch_gateway_account(id, params, env=nil, headers={})
|
64
|
+
Request.send('post', uri_path("payment_sources",id.to_s,"switch_gateway_account"), params, env, headers)
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.export_payment_source(id, params, env=nil, headers={})
|
68
|
+
Request.send('post', uri_path("payment_sources",id.to_s,"export_payment_source"), params, env, headers)
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.delete(id, env=nil, headers={})
|
72
|
+
Request.send('post', uri_path("payment_sources",id.to_s,"delete"), {}, env, headers)
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.delete_local(id, env=nil, headers={})
|
76
|
+
Request.send('post', uri_path("payment_sources",id.to_s,"delete_local"), {}, env, headers)
|
77
|
+
end
|
78
|
+
|
79
|
+
end # ~PaymentSource
|
72
80
|
end # ~ChargeBee
|