chargebee 2.11.2 → 2.13.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -45,7 +45,7 @@ module ChargeBee
45
45
 
46
46
  def payment_source()
47
47
  payment_source = get(:payment_source, PaymentSource,
48
- {:card => PaymentSource::Card, :bank_account => PaymentSource::BankAccount, :amazon_payment => PaymentSource::AmazonPayment, :paypal => PaymentSource::Paypal});
48
+ {:card => PaymentSource::Card, :bank_account => PaymentSource::BankAccount, :amazon_payment => PaymentSource::AmazonPayment, :upi => PaymentSource::Upi, :paypal => PaymentSource::Paypal, :mandates => PaymentSource::Mandate});
49
49
  return payment_source;
50
50
  end
51
51
 
@@ -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
 
@@ -1,56 +1,69 @@
1
- module ChargeBee
2
- module Util
3
-
4
- def self.serialize(value, prefix = nil, idx = nil)
5
- serialized = {}
6
- case value
7
- when Hash
8
- value.each do |k, v|
9
- if(v.kind_of? Hash or v.kind_of? Array)
10
- serialized.merge!(serialize(v, k))
11
- else
12
- key = "#{(prefix!=nil) ? prefix:''}#{(prefix!=nil) ? '['+k.to_s+']' : k}#{(idx != nil) ? '['+idx.to_s+']':''}"
13
- serialized.merge!({key => as_str(v)})
14
- end
15
- end
16
- when Array
17
- value.each_with_index do |v, i|
18
- serialized.merge!(serialize(v, prefix, i))
19
- end
20
- else
21
- if(idx != nil and prefix != nil)
22
- key = "#{prefix}[#{idx.to_s}]"
23
- serialized.merge!({key => as_str(value)})
24
- else
25
- raise ArgumentError.new("only hash or arrays are allowed as value")
26
- end
27
- end
28
- serialized
29
- end
30
-
31
- def self.symbolize_keys(object)
32
- case object
33
- when Hash
34
- new = {}
35
- object.each do |key, value|
36
- key = (key.to_sym rescue key) || key
37
- new[key] = symbolize_keys(value)
38
- end
39
- new
40
- when Array
41
- object.map { |value| symbolize_keys(value) }
42
- else
43
- object
44
- end
45
- end
46
-
47
- def self.as_str(value)
48
- if(value == nil)
49
- return ''
50
- else
51
- return value.to_s
52
- end
53
- end
54
-
55
- end
56
- end
1
+ module ChargeBee
2
+ module Util
3
+
4
+ def self.serialize(value, prefix = nil, idx = nil)
5
+ serialized = {}
6
+ case value
7
+ when Hash
8
+ value.each do |k, v|
9
+ if(v.kind_of? Hash)
10
+ serialized.merge!(serialize(v, k))
11
+ elsif(v.kind_of? Array)
12
+ arrayContainsValue = false
13
+ v.each_with_index do |v1, i1|
14
+ if(v1.kind_of? Hash)
15
+ serialized.merge!(serialize(v1, k, i1))
16
+ else
17
+ arrayContainsValue = true
18
+ end
19
+ end
20
+ if(arrayContainsValue == true)
21
+ key = "#{(prefix!=nil) ? prefix:''}#{(prefix!=nil) ? '['+k.to_s+']' : k}#{(idx != nil) ? '['+idx.to_s+']':''}"
22
+ serialized.merge!({key => as_str(v)})
23
+ end
24
+ else
25
+ key = "#{(prefix!=nil) ? prefix:''}#{(prefix!=nil) ? '['+k.to_s+']' : k}#{(idx != nil) ? '['+idx.to_s+']':''}"
26
+ serialized.merge!({key => as_str(v)})
27
+ end
28
+ end
29
+ when Array
30
+ value.each_with_index do |v, i|
31
+ serialized.merge!(serialize(v, prefix, i))
32
+ end
33
+ else
34
+ if(idx != nil and prefix != nil)
35
+ key = "#{prefix}[#{idx.to_s}]"
36
+ serialized.merge!({key => as_str(value)})
37
+ else
38
+ raise ArgumentError.new("only hash or arrays are allowed as value")
39
+ end
40
+ end
41
+ serialized
42
+ end
43
+
44
+ def self.symbolize_keys(object)
45
+ case object
46
+ when Hash
47
+ new = {}
48
+ object.each do |key, value|
49
+ key = (key.to_sym rescue key) || key
50
+ new[key] = symbolize_keys(value)
51
+ end
52
+ new
53
+ when Array
54
+ object.map { |value| symbolize_keys(value) }
55
+ else
56
+ object
57
+ end
58
+ end
59
+
60
+ def self.as_str(value)
61
+ if(value == nil)
62
+ return ''
63
+ else
64
+ return value.to_s
65
+ end
66
+ end
67
+
68
+ end
69
+ end
data/lib/chargebee.rb CHANGED
@@ -53,7 +53,7 @@ require File.dirname(__FILE__) + '/chargebee/models/usage.rb'
53
53
 
54
54
  module ChargeBee
55
55
 
56
- VERSION = '2.11.2'
56
+ VERSION = '2.13.1'
57
57
 
58
58
  @@default_env = nil
59
59
  @@verify_ca_certs = true