killbill-client 2.2.3 → 2.3.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +12 -12
  3. data/lib/killbill_client/models/account.rb +44 -42
  4. data/lib/killbill_client/models/bulk_subscription.rb +1 -1
  5. data/lib/killbill_client/models/bundle.rb +18 -6
  6. data/lib/killbill_client/models/catalog.rb +77 -8
  7. data/lib/killbill_client/models/export.rb +1 -1
  8. data/lib/killbill_client/models/gen/blocking_state_attributes.rb +3 -3
  9. data/lib/killbill_client/models/gen/credit_attributes.rb +1 -0
  10. data/lib/killbill_client/models/gen/invoice_item_attributes.rb +2 -0
  11. data/lib/killbill_client/models/gen/node_command_attributes.rb +1 -1
  12. data/lib/killbill_client/models/gen/overdue_state_attributes.rb +3 -3
  13. data/lib/killbill_client/models/gen/overdue_state_config_attributes.rb +2 -2
  14. data/lib/killbill_client/models/gen/require_gen.rb +53 -54
  15. data/lib/killbill_client/models/gen/stack_trace_element_attributes.rb +1 -1
  16. data/lib/killbill_client/models/gen/{tenant_key_attributes.rb → tenant_key_value_attributes.rb} +1 -1
  17. data/lib/killbill_client/models/helpers/custom_field_helper.rb +21 -0
  18. data/lib/killbill_client/models/helpers/tag_helper.rb +2 -4
  19. data/lib/killbill_client/models/invoice.rb +63 -61
  20. data/lib/killbill_client/models/invoice_item.rb +1 -3
  21. data/lib/killbill_client/models/invoice_payment.rb +18 -3
  22. data/lib/killbill_client/models/nodes_info.rb +1 -1
  23. data/lib/killbill_client/models/overdue.rb +33 -13
  24. data/lib/killbill_client/models/payment_method.rb +1 -1
  25. data/lib/killbill_client/models/resource.rb +3 -1
  26. data/lib/killbill_client/models/subscription.rb +19 -17
  27. data/lib/killbill_client/models/tenant.rb +2 -2
  28. data/lib/killbill_client/models/transaction.rb +2 -0
  29. data/lib/killbill_client/version.rb +2 -2
  30. data/spec/killbill_client/remote/api_spec.rb +1 -1
  31. data/spec/killbill_client/remote/model_spec.rb +6 -6
  32. metadata +3 -3
@@ -67,7 +67,7 @@ module KillBillClient
67
67
  return res if res
68
68
 
69
69
  node_command = KillBillClient::Model::NodeCommandAttributes.new
70
- node_command.system_command_type = true
70
+ node_command.is_system_command_type = true
71
71
  node_command.node_command_type = node_command_type
72
72
  node_command.node_command_properties = []
73
73
  node_command.node_command_properties << {:key => 'pluginKey', :value => plugin_key} if plugin_key
@@ -8,24 +8,47 @@ module KillBillClient
8
8
 
9
9
  class << self
10
10
 
11
- def get_tenant_overdue_config(format, options = {})
11
+ def get_tenant_overdue_config_xml(options = {})
12
12
 
13
13
  require_multi_tenant_options!(options, "Retrieving an overdue config is only supported in multi-tenant mode")
14
14
 
15
- get KILLBILL_API_OVERDUE_PREFIX,
15
+ get "#{KILLBILL_API_OVERDUE_PREFIX}/xml",
16
16
  {},
17
17
  {
18
- :head => {'Accept' => "application/#{format}"},
19
- :content_type => "application/#{format}",
18
+ :head => {'Accept' => "text/xml"}
20
19
  }.merge(options)
21
20
  end
22
21
 
23
- def upload_tenant_overdue_config_xml(overdue_config_xml, user = nil, reason = nil, comment = nil, options = {})
24
- upload_tenant_overdue_config('xml', overdue_config_xml, user, reason, comment, options)
22
+ def get_tenant_overdue_config_json(options = {})
23
+
24
+ require_multi_tenant_options!(options, "Retrieving an overdue config is only supported in multi-tenant mode")
25
+
26
+ get KILLBILL_API_OVERDUE_PREFIX,
27
+ {},
28
+ {
29
+ :head => {'Accept' => "application/json"}
30
+ }.merge(options)
25
31
  end
26
32
 
33
+ def upload_tenant_overdue_config_xml(body, user = nil, reason = nil, comment = nil, options = {})
27
34
 
28
- def upload_tenant_overdue_config(format, body, user = nil, reason = nil, comment = nil, options = {})
35
+ require_multi_tenant_options!(options, "Uploading an overdue config is only supported in multi-tenant mode")
36
+
37
+ post "#{KILLBILL_API_OVERDUE_PREFIX}/xml",
38
+ body,
39
+ {
40
+ },
41
+ {
42
+ :head => {'Accept' => 'text/xml'},
43
+ :content_type => 'text/xml',
44
+ :user => user,
45
+ :reason => reason,
46
+ :comment => comment,
47
+ }.merge(options)
48
+ get_tenant_overdue_config_xml(options)
49
+ end
50
+
51
+ def upload_tenant_overdue_config_json(body, user = nil, reason = nil, comment = nil, options = {})
29
52
 
30
53
  require_multi_tenant_options!(options, "Uploading an overdue config is only supported in multi-tenant mode")
31
54
 
@@ -34,20 +57,17 @@ module KillBillClient
34
57
  {
35
58
  },
36
59
  {
37
- :head => {'Accept' => "application/#{format}"},
38
- :content_type => "application/#{format}",
60
+ :head => {'Accept' => 'application/json'},
61
+ :content_type => 'application/json',
39
62
  :user => user,
40
63
  :reason => reason,
41
64
  :comment => comment,
42
65
  }.merge(options)
43
- get_tenant_overdue_config(format, options)
66
+ get_tenant_overdue_config_json(options)
44
67
  end
45
68
 
46
69
  end
47
70
 
48
- def upload_tenant_overdue_config_json(user = nil, reason = nil, comment = nil, options = {})
49
- self.class.upload_tenant_overdue_config('json', to_json, user, reason, comment, options)
50
- end
51
71
  end
52
72
  end
53
73
  end
@@ -83,7 +83,7 @@ module KillBillClient
83
83
  end
84
84
 
85
85
  def refresh(account_id, user = nil, reason = nil, comment = nil, options = {})
86
- post "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods/refresh",
86
+ put "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods/refresh",
87
87
  nil,
88
88
  {},
89
89
  {
@@ -75,7 +75,9 @@ module KillBillClient
75
75
  response.body
76
76
  when %r{text/plain}
77
77
  response.body
78
- when %r{application/xml}
78
+ when %r{application/octet-stream}
79
+ response.body
80
+ when %r{text/xml}
79
81
  if response['location']
80
82
  response['location']
81
83
  else
@@ -53,7 +53,7 @@ module KillBillClient
53
53
  # @ call_completion : whether the call should wait for invoice/payment to be completed before calls return
54
54
  #
55
55
  def change_plan(input, user = nil, reason = nil, comment = nil,
56
- requested_date = nil, billing_policy = nil, call_completion = false, options = {})
56
+ requested_date = nil, billing_policy = nil, target_phase_type = nil, call_completion = false, options = {})
57
57
 
58
58
  params = {}
59
59
  params[:callCompletion] = call_completion
@@ -63,15 +63,17 @@ module KillBillClient
63
63
  # Make sure account_id is set
64
64
  input[:accountId] = @account_id
65
65
  input[:productCategory] = @product_category
66
+ input[:phaseType] = target_phase_type
66
67
 
67
- return self.class.put "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{@subscription_id}",
68
- input.to_json,
69
- params,
70
- {
71
- :user => user,
72
- :reason => reason,
73
- :comment => comment,
74
- }.merge(options)
68
+ self.class.put "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{@subscription_id}",
69
+ input.to_json,
70
+ params,
71
+ {
72
+ :user => user,
73
+ :reason => reason,
74
+ :comment => comment,
75
+ }.merge(options)
76
+ self.class.find_by_id(@subscription_id, options)
75
77
  end
76
78
 
77
79
  #
@@ -135,20 +137,20 @@ module KillBillClient
135
137
  #
136
138
  # Block a Subscription
137
139
  #
138
- def set_blocking_state(state_name, service, block_change, block_entitlement, block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {})
140
+ def set_blocking_state(state_name, service, is_block_change, is_block_entitlement, is_block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {})
139
141
 
140
142
  body = KillBillClient::Model::BlockingStateAttributes.new
141
143
  body.state_name = state_name
142
144
  body.service = service
143
- body.block_change = block_change
144
- body.block_entitlement = block_entitlement
145
- body.block_billing = block_billing
145
+ body.is_block_change = is_block_change
146
+ body.is_block_entitlement = is_block_entitlement
147
+ body.is_block_billing = is_block_billing
146
148
  body.type = "SUBSCRIPTION"
147
149
 
148
150
  params = {}
149
151
  params[:requestedDate] = requested_date unless requested_date.nil?
150
152
 
151
- self.class.put "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{subscription_id}/block",
153
+ self.class.post "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{subscription_id}/block",
152
154
  body.to_json,
153
155
  params,
154
156
  {
@@ -161,16 +163,16 @@ module KillBillClient
161
163
  #
162
164
  # Create an entitlement with addOn products
163
165
  #
164
- def create_entitlement_with_add_on(entitlements, requested_date, entitlement_date, billing_date, migrated = false, call_completion_sec = nil, user = nil, reason = nil, comment = nil, options = {})
166
+ def create_entitlement_with_add_on(entitlements, entitlement_date, billing_date, migrated = false, rename_key_if_exists_and_unused = true, call_completion_sec = nil, user = nil, reason = nil, comment = nil, options = {})
165
167
  params = {}
166
- params[:requestedDate] = requested_date if requested_date
167
168
  params[:entitlementDate] = entitlement_date if entitlement_date
168
169
  params[:billingDate] = billing_date if billing_date
169
170
  params[:migrated] = migrated
171
+ params[:renameKeyIfExistsAndUnused] = rename_key_if_exists_and_unused
170
172
  params[:callCompletion] = true unless call_completion_sec.nil?
171
173
  params[:callTimeoutSec] = call_completion_sec unless call_completion_sec.nil?
172
174
 
173
- self.class.post "#{KILLBILL_API_ENTITLEMENT_PREFIX}/createEntitlementWithAddOns",
175
+ self.class.post "#{KILLBILL_API_ENTITLEMENT_PREFIX}/createSubscriptionWithAddOns",
174
176
  entitlements.to_json,
175
177
  params,
176
178
  {
@@ -52,7 +52,7 @@ module KillBillClient
52
52
  {},
53
53
  {
54
54
  }.merge(options),
55
- KillBillClient::Model::TenantKeyAttributes
55
+ KillBillClient::Model::TenantKeyValueAttributes
56
56
  end
57
57
 
58
58
 
@@ -65,7 +65,7 @@ module KillBillClient
65
65
  {},
66
66
  {
67
67
  }.merge(options),
68
- KillBillClient::Model::TenantKeyAttributes
68
+ KillBillClient::Model::TenantKeyValueAttributes
69
69
  end
70
70
 
71
71
 
@@ -121,6 +121,7 @@ module KillBillClient
121
121
  :reason => reason,
122
122
  :comment => comment,
123
123
  }.merge(options)
124
+ KillBillClient::Model::Payment.find_by_id(payment_id, false, false, options)
124
125
  end
125
126
  end
126
127
 
@@ -220,6 +221,7 @@ module KillBillClient
220
221
  :reason => reason,
221
222
  :comment => comment
222
223
  }.merge(options)
224
+ KillBillClient::Model::Payment.find_by_id(payment_id, false, false, options)
223
225
  end
224
226
  end
225
227
 
@@ -1,8 +1,8 @@
1
1
  module KillBillClient
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 2
5
- PATCH = 3
4
+ MINOR = 3
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
@@ -24,7 +24,7 @@ describe KillBillClient::API do
24
24
  rescue KillBillClient::API::Conflict => e
25
25
  billing_exception = JSON.parse(e.response.body)
26
26
  expect(billing_exception['className']).to eq('org.killbill.billing.tenant.api.TenantApiException')
27
- expect(billing_exception['stackTrace'].size).to be >= 70
27
+ expect(billing_exception['stackTrace'].size).to be >= 71
28
28
  ensure
29
29
  KillBillClient.return_full_stacktraces = false
30
30
  end
@@ -156,7 +156,7 @@ describe KillBillClient::Model do
156
156
  invoice_item.amount = 123.98
157
157
 
158
158
  invoice_item = invoice_item.create false, true, 'KillBill Spec test'
159
- invoice = KillBillClient::Model::Invoice.find_by_id_or_number invoice_item.invoice_id
159
+ invoice = KillBillClient::Model::Invoice.find_by_id invoice_item.invoice_id
160
160
 
161
161
  expect(invoice.amount).to eq(123.98)
162
162
  expect(invoice.balance).to eq(0)
@@ -220,8 +220,8 @@ describe KillBillClient::Model do
220
220
  invoice_id = invoice.invoice_id
221
221
  invoice_number = invoice.invoice_number
222
222
 
223
- invoice_with_id = KillBillClient::Model::Invoice.find_by_id_or_number invoice_id
224
- invoice_with_number = KillBillClient::Model::Invoice.find_by_id_or_number invoice_number
223
+ invoice_with_id = KillBillClient::Model::Invoice.find_by_id invoice_id
224
+ invoice_with_number = KillBillClient::Model::Invoice.find_by_number invoice_number
225
225
 
226
226
  expect(invoice_with_id.invoice_id).to eq(invoice_with_number.invoice_id)
227
227
  expect(invoice_with_id.invoice_number).to eq(invoice_with_number.invoice_number)
@@ -229,7 +229,7 @@ describe KillBillClient::Model do
229
229
  # Create an external payment for each unpaid invoice
230
230
  invoice_payment = KillBillClient::Model::InvoicePayment.new
231
231
  invoice_payment.account_id = account.account_id
232
- invoice_payment.bulk_create true, 'KillBill Spec test'
232
+ invoice_payment.bulk_create true, nil, nil, 'KillBill Spec test'
233
233
 
234
234
  # Try to retrieve it
235
235
  payments = KillBillClient::Model::Payment.find_in_batches(0, search_limit)
@@ -286,7 +286,7 @@ describe KillBillClient::Model do
286
286
  expect(invoice_payment.credited_amount).to eq(0)
287
287
 
288
288
  # Refund the payment (with item adjustment)
289
- invoice_item = KillBillClient::Model::Invoice.find_by_id_or_number(invoice_number, true).items.first
289
+ invoice_item = KillBillClient::Model::Invoice.find_by_number(invoice_number, true).items.first
290
290
  item = KillBillClient::Model::InvoiceItem.new
291
291
  item.invoice_item_id = invoice_item.invoice_item_id
292
292
  item.amount = invoice_item.amount
@@ -308,7 +308,7 @@ describe KillBillClient::Model do
308
308
  expect { new_credit.create(true, 'KillBill Spec test') }.to raise_error(KillBillClient::API::BadRequest)
309
309
 
310
310
  # Verify the invoice item of the credit
311
- invoice = KillBillClient::Model::Invoice.find_by_id_or_number invoice_id
311
+ invoice = KillBillClient::Model::Invoice.find_by_id invoice_id
312
312
  expect(invoice.items).not_to be_empty
313
313
  item = invoice.items.last
314
314
  expect(item.invoice_id).to eq(invoice_id)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Killbill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-18 00:00:00.000000000 Z
11
+ date: 2018-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -141,7 +141,7 @@ files:
141
141
  - lib/killbill_client/models/gen/tag_attributes.rb
142
142
  - lib/killbill_client/models/gen/tag_definition_attributes.rb
143
143
  - lib/killbill_client/models/gen/tenant_attributes.rb
144
- - lib/killbill_client/models/gen/tenant_key_attributes.rb
144
+ - lib/killbill_client/models/gen/tenant_key_value_attributes.rb
145
145
  - lib/killbill_client/models/gen/tier_attributes.rb
146
146
  - lib/killbill_client/models/gen/tier_price_override_attributes.rb
147
147
  - lib/killbill_client/models/gen/tiered_block_attributes.rb