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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +12 -12
- data/lib/killbill_client/models/account.rb +44 -42
- data/lib/killbill_client/models/bulk_subscription.rb +1 -1
- data/lib/killbill_client/models/bundle.rb +18 -6
- data/lib/killbill_client/models/catalog.rb +77 -8
- data/lib/killbill_client/models/export.rb +1 -1
- data/lib/killbill_client/models/gen/blocking_state_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/credit_attributes.rb +1 -0
- data/lib/killbill_client/models/gen/invoice_item_attributes.rb +2 -0
- data/lib/killbill_client/models/gen/node_command_attributes.rb +1 -1
- data/lib/killbill_client/models/gen/overdue_state_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/overdue_state_config_attributes.rb +2 -2
- data/lib/killbill_client/models/gen/require_gen.rb +53 -54
- data/lib/killbill_client/models/gen/stack_trace_element_attributes.rb +1 -1
- data/lib/killbill_client/models/gen/{tenant_key_attributes.rb → tenant_key_value_attributes.rb} +1 -1
- data/lib/killbill_client/models/helpers/custom_field_helper.rb +21 -0
- data/lib/killbill_client/models/helpers/tag_helper.rb +2 -4
- data/lib/killbill_client/models/invoice.rb +63 -61
- data/lib/killbill_client/models/invoice_item.rb +1 -3
- data/lib/killbill_client/models/invoice_payment.rb +18 -3
- data/lib/killbill_client/models/nodes_info.rb +1 -1
- data/lib/killbill_client/models/overdue.rb +33 -13
- data/lib/killbill_client/models/payment_method.rb +1 -1
- data/lib/killbill_client/models/resource.rb +3 -1
- data/lib/killbill_client/models/subscription.rb +19 -17
- data/lib/killbill_client/models/tenant.rb +2 -2
- data/lib/killbill_client/models/transaction.rb +2 -0
- data/lib/killbill_client/version.rb +2 -2
- data/spec/killbill_client/remote/api_spec.rb +1 -1
- data/spec/killbill_client/remote/model_spec.rb +6 -6
- 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.
|
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
|
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' => "
|
19
|
-
:content_type => "application/#{format}",
|
18
|
+
:head => {'Accept' => "text/xml"}
|
20
19
|
}.merge(options)
|
21
20
|
end
|
22
21
|
|
23
|
-
def
|
24
|
-
|
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
|
-
|
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' =>
|
38
|
-
:content_type =>
|
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
|
-
|
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
|
-
|
86
|
+
put "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/paymentMethods/refresh",
|
87
87
|
nil,
|
88
88
|
{},
|
89
89
|
{
|
@@ -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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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,
|
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.
|
144
|
-
body.
|
145
|
-
body.
|
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.
|
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,
|
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}/
|
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::
|
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::
|
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
|
|
@@ -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 >=
|
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.
|
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.
|
224
|
-
invoice_with_number = KillBillClient::Model::Invoice.
|
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.
|
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.
|
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.
|
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-
|
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/
|
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
|