chargebee 2.12.0 → 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
2
  SHA1:
3
- metadata.gz: cbe622f534d1cd172b212749959aced99a1d8665
4
- data.tar.gz: 2de898ac2c61e2aaec5f505d23a1914dffb493ea
3
+ metadata.gz: 84ddec3287c1f877d8c82aa863ddc577be16d9df
4
+ data.tar.gz: e2f4657d35d5a3273449f202ce60633e898e270b
5
5
  SHA512:
6
- metadata.gz: fa416ff2bc0c9adac99e093c279de72120ae2966198e97fbcbf884ed4b9cc5c962902098c5d7e99474adbfad737fba41c17eb1e385f664dffcf7e75a8ccd9f54
7
- data.tar.gz: 80f0bb873cb06d1fa17d9c6c29fea40da8468fc1d35097f797f96020fbfaad4e9c33c6d540cd676a1604665087e1c8c59f3801779216d1778d9f900f5f9d71ba
6
+ metadata.gz: 0172714c7ae6194e8e6215f3b50dcbee257c1a0f12dd87df8caca7ae83dc28c424f715dab3e44cdd5607ff62ae5cf3756c5d6222d150cef16ad4eb58a636618f
7
+ data.tar.gz: 15c633d1d3efd0f826dd1d45d0131b4541da62d56d47571300f393fd8f5392456d2d6d0f45d5f02aabbb0eeca0aaf133c419bacc1c786371a2a5c6ba3dcf3882
data/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
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
+
1
42
  ### v2.12.0 (2022-01-21)
2
43
  * * *
3
44
 
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.12.0'
8
- s.date = '2022-01-21'
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
 
@@ -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
  #-----------
@@ -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
 
@@ -6,8 +6,21 @@ module ChargeBee
6
6
  case value
7
7
  when Hash
8
8
  value.each do |k, v|
9
- if(v.kind_of? Hash or v.kind_of? Array)
9
+ if(v.kind_of? Hash)
10
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
11
24
  else
12
25
  key = "#{(prefix!=nil) ? prefix:''}#{(prefix!=nil) ? '['+k.to_s+']' : k}#{(idx != nil) ? '['+idx.to_s+']':''}"
13
26
  serialized.merge!({key => as_str(v)})
@@ -18,12 +31,12 @@ module ChargeBee
18
31
  serialized.merge!(serialize(v, prefix, i))
19
32
  end
20
33
  else
21
- if(idx != nil and prefix != nil)
34
+ if(idx != nil and prefix != nil)
22
35
  key = "#{prefix}[#{idx.to_s}]"
23
36
  serialized.merge!({key => as_str(value)})
24
- else
37
+ else
25
38
  raise ArgumentError.new("only hash or arrays are allowed as value")
26
- end
39
+ end
27
40
  end
28
41
  serialized
29
42
  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.12.0'
56
+ VERSION = '2.13.0'
57
57
 
58
58
  @@default_env = nil
59
59
  @@verify_ca_certs = true
@@ -48,6 +48,6 @@ describe ChargeBee::ListResult do
48
48
 
49
49
  it "returns list object, with next offset attribute" do
50
50
  list = ChargeBee::Request.send(:customer, "http://url.com", {:limit => 2})
51
- list.next_offset.should =~ ["1345724673000", "1510"]
51
+ expect(list.next_offset) =~ ["1345724673000", "1510"]
52
52
  end
53
53
  end
@@ -37,7 +37,7 @@ describe "chargebee" do
37
37
  "card[expiry_month]"=>"1",
38
38
  "card[expiry_year]"=>"2024",
39
39
  "card[cvv]"=>"007"}
40
- ChargeBee::Util.serialize(before).should eq(after)
40
+ expect(ChargeBee::Util.serialize(before)).to eq(after)
41
41
  end
42
42
 
43
43
  it "symbolize_keys should convert keys to symbols" do
@@ -51,38 +51,38 @@ describe "chargebee" do
51
51
  :plan_id => 'basic',
52
52
  :addons => [{ :id => 'ssl' }, {:id => 'sms', :quantity => '10'}],
53
53
  }
54
- ChargeBee::Util.symbolize_keys(before).should eq(after)
54
+ expect(ChargeBee::Util.symbolize_keys(before)).to eq(after)
55
55
  end
56
56
 
57
57
  it "should properly convert the response json into proper object" do
58
58
  @request.expects(:execute).once.returns(mock_response(simple_subscription))
59
59
  result = ChargeBee::Subscription.retrieve("simple_subscription")
60
60
  s = result.subscription
61
- s.id.should eq("simple_subscription")
62
- s.plan_id.should eq('basic')
61
+ expect(s.id).to eq("simple_subscription")
62
+ expect(s.plan_id).to eq('basic')
63
63
  c = result.customer
64
- c.first_name.should eq('simple')
65
- c.last_name.should eq('subscription')
64
+ expect(c.first_name).to eq('simple')
65
+ expect(c.last_name).to eq('subscription')
66
66
  end
67
67
 
68
68
  it "should properly convert the nested response json into proper object with sub types" do
69
69
  @request.expects(:execute).once.returns(mock_response(nested_subscription))
70
70
  result = ChargeBee::Subscription.retrieve("nested_subscription")
71
71
  s = result.subscription
72
- s.id.should eq("nested_subscription")
72
+ expect(s.id).to eq("nested_subscription")
73
73
  a = s.addons
74
- a.length.should eq(2)
75
- a[0].id.should eq("monitor")
76
- a[0].quantity.should eq("10")
77
- a[1].id.should eq("ssl")
74
+ expect(a.length).to eq(2)
75
+ expect(a[0].id).to eq("monitor")
76
+ expect(a[0].quantity).to eq("10")
77
+ expect(a[1].id).to eq("ssl")
78
78
  end
79
79
 
80
80
  it "should properly convert the list response json into proper result object" do
81
81
  @request.expects(:execute).once.returns(mock_response(list_subscriptions))
82
82
  result = ChargeBee::Subscription.list({:limit => 2})
83
- result.length.should eq(2)
83
+ expect(result.length).to eq(2)
84
84
  result.each do |i|
85
- i.subscription.id.should eq('sample_subscription')
85
+ expect(i.subscription.id).to eq('sample_subscription')
86
86
  end
87
87
  end
88
88
 
@@ -91,8 +91,8 @@ describe "chargebee" do
91
91
  result = ChargeBee::Event.retrieve("sample_event")
92
92
  event = result.event
93
93
  s = event.content.subscription
94
- event.id.should eq('ev_KyVqDX__dev__NTgtUgx1')
95
- s.id.should eq('sample_subscription')
94
+ expect(event.id).to eq('ev_KyVqDX__dev__NTgtUgx1')
95
+ expect(s.id).to eq('sample_subscription')
96
96
  end
97
97
 
98
98
  end
data/spec/errors_spec.rb CHANGED
@@ -16,7 +16,7 @@ describe 'ChargeBee::InvalidRequestError' do
16
16
 
17
17
  it "provide message from error api response" do
18
18
  error = ChargeBee::InvalidRequestError.new(400, invalid_request_json)
19
- error.message.should eq 'id: The value chargebee_account is already present.'
19
+ expect(error.message).to eq 'id: The value chargebee_account is already present.'
20
20
  end
21
21
 
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chargebee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajaraman S
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-21 00:00:00.000000000 Z
12
+ date: 2022-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_pure