killbill-client 1.12.1 → 2.0.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: e6023e6dc3700baf51b54eb966013c0097df4bb6
4
- data.tar.gz: 273deea1e796f0f63b06d1d911e58494e4d51b7f
3
+ metadata.gz: '08ccf5da38d550a6f93402e34d3519f31c85297a'
4
+ data.tar.gz: 8f3b236f0f4ce4b6f60f19b399efca3ec6d55eaa
5
5
  SHA512:
6
- metadata.gz: 9a484124e71caf99ea3afb36f83cc8ccbd6c75d5f94f67646c9b6fb0fd4bc817257b99a47e3e19e735d758aed9440ecd3f60962e0810a0f49288d471faa58bce
7
- data.tar.gz: 9934d9680adeed6c8d8c7777e908da473de810f3f9721951ee5201ad226abde89dd5c22de62629099d059e51cf7ae6f8657c057e656e6ef07183df8bf63908d3
6
+ metadata.gz: '0618d5fa43a3842a594ae3b8c5bdb5959c2a939906ba223eeb46f6f8c976fca3928cf42c6bc314f92232c79df670c2e61eb1a4d3cab80b6a8cecf373aa343475'
7
+ data.tar.gz: cdd4d1676c59da0d90c1a0f9e7cb0c649cb868d7d0fd58bdcd2194ed9f8d97ba4decf532f6b998931ea9502be9bb19d9c97766d26c438746db4fe41f95330d36
data/README.md CHANGED
@@ -10,6 +10,7 @@ Kill Bill compatibility
10
10
  | -------------: | ----------------: |
11
11
  | 0.x.y | 0.16.z |
12
12
  | 1.x.y | 0.18.z |
13
+ | 2.x.y | 0.19.z |
13
14
 
14
15
  Installation
15
16
  ------------
@@ -79,6 +79,18 @@ module KillBillClient
79
79
  :comment => comment,
80
80
  }.merge(options)
81
81
  end
82
+
83
+ def delete_catalog(user = nil, reason = nil, comment = nil, options = {})
84
+
85
+ delete "#{KILLBILL_API_CATALOG_PREFIX}",
86
+ {},
87
+ {},
88
+ {
89
+ :user => user,
90
+ :reason => reason,
91
+ :comment => comment,
92
+ }.merge(options)
93
+ end
82
94
  end
83
95
  end
84
96
  end
@@ -38,6 +38,7 @@ module KillBillClient
38
38
  attribute :parent_account_id
39
39
  attribute :is_payment_delegated_to_parent
40
40
  attribute :payment_method_id
41
+ attribute :reference_time
41
42
  attribute :time_zone
42
43
  attribute :address1
43
44
  attribute :address2
@@ -0,0 +1,37 @@
1
+ #############################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # Copyright 2014 Groupon, Inc. #
5
+ # Copyright 2014 The Billing Project, LLC #
6
+ # #
7
+ # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
+ # (the "License"); you may not use this file except in compliance with the #
9
+ # License. You may obtain a copy of the License at: #
10
+ # #
11
+ # http://www.apache.org/licenses/LICENSE-2.0 #
12
+ # #
13
+ # Unless required by applicable law or agreed to in writing, software #
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
+ # License for the specific language governing permissions and limitations #
17
+ # under the License. #
18
+ # #
19
+ #############################################################################################
20
+
21
+
22
+ #
23
+ # DO NOT EDIT!!!
24
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
+ #
26
+
27
+
28
+ module KillBillClient
29
+ module Model
30
+ class BlockPriceOverrideAttributes < Resource
31
+ attribute :unit_name
32
+ attribute :size
33
+ attribute :price
34
+ attribute :max
35
+ end
36
+ end
37
+ end
@@ -31,6 +31,7 @@ module KillBillClient
31
31
  attribute :name
32
32
  attribute :effective_date
33
33
  attribute :currencies
34
+ attribute :units
34
35
  attribute :products
35
36
  attribute :price_lists
36
37
  end
@@ -43,6 +43,8 @@ module KillBillClient
43
43
  attribute :credits
44
44
  attribute :items
45
45
  attribute :is_parent_invoice
46
+ attribute :parent_invoice_id
47
+ attribute :parent_account_id
46
48
  attribute :audit_logs
47
49
  end
48
50
  end
@@ -38,6 +38,9 @@ module KillBillClient
38
38
  attribute :plan_name
39
39
  attribute :phase_name
40
40
  attribute :usage_name
41
+ attribute :pretty_plan_name
42
+ attribute :pretty_phase_name
43
+ attribute :pretty_usage_name
41
44
  attribute :item_type
42
45
  attribute :description
43
46
  attribute :start_date
@@ -32,6 +32,7 @@ module KillBillClient
32
32
  attribute :account_id
33
33
  attribute :object_type
34
34
  attribute :object_id
35
+ attribute :meta_data
35
36
  end
36
37
  end
37
38
  end
@@ -33,6 +33,7 @@ module KillBillClient
33
33
  attribute :phase_type
34
34
  attribute :fixed_price
35
35
  attribute :recurring_price
36
+ attribute :usage_overrides
36
37
  end
37
38
  end
38
39
  end
@@ -29,6 +29,7 @@ module KillBillClient
29
29
  module Model
30
30
  class PlanAttributes < Resource
31
31
  attribute :name
32
+ attribute :pretty_name
32
33
  attribute :billing_period
33
34
  attribute :phases
34
35
  end
@@ -30,6 +30,7 @@ module KillBillClient
30
30
  class ProductAttributes < Resource
31
31
  attribute :type
32
32
  attribute :name
33
+ attribute :pretty_name
33
34
  attribute :plans
34
35
  attribute :included
35
36
  attribute :available
@@ -33,9 +33,11 @@ require 'killbill_client/models/gen/audit_log_attributes'
33
33
  require 'killbill_client/models/gen/stack_trace_element_attributes'
34
34
  require 'killbill_client/models/gen/billing_exception_attributes'
35
35
  require 'killbill_client/models/gen/blocking_state_attributes'
36
+ require 'killbill_client/models/gen/block_price_override_attributes'
36
37
  require 'killbill_client/models/gen/bulk_base_subscription_and_add_ons_attributes'
37
38
  require 'killbill_client/models/gen/bundle_attributes'
38
39
  require 'killbill_client/models/gen/bundle_timeline_attributes'
40
+ require 'killbill_client/models/gen/unit_attributes'
39
41
  require 'killbill_client/models/gen/product_attributes'
40
42
  require 'killbill_client/models/gen/plan_attributes'
41
43
  require 'killbill_client/models/gen/tiered_block_attributes'
@@ -97,4 +99,6 @@ require 'killbill_client/models/gen/tag_definition_attributes'
97
99
  require 'killbill_client/models/gen/tag_attributes'
98
100
  require 'killbill_client/models/gen/tenant_attributes'
99
101
  require 'killbill_client/models/gen/tenant_key_attributes'
102
+ require 'killbill_client/models/gen/tier_price_override_attributes'
103
+ require 'killbill_client/models/gen/usage_price_override_attributes'
100
104
  require 'killbill_client/models/gen/user_roles_attributes'
@@ -0,0 +1,34 @@
1
+ #############################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # Copyright 2014 Groupon, Inc. #
5
+ # Copyright 2014 The Billing Project, LLC #
6
+ # #
7
+ # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
+ # (the "License"); you may not use this file except in compliance with the #
9
+ # License. You may obtain a copy of the License at: #
10
+ # #
11
+ # http://www.apache.org/licenses/LICENSE-2.0 #
12
+ # #
13
+ # Unless required by applicable law or agreed to in writing, software #
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
+ # License for the specific language governing permissions and limitations #
17
+ # under the License. #
18
+ # #
19
+ #############################################################################################
20
+
21
+
22
+ #
23
+ # DO NOT EDIT!!!
24
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
+ #
26
+
27
+
28
+ module KillBillClient
29
+ module Model
30
+ class TierPriceOverrideAttributes < Resource
31
+ attribute :block_price_overrides
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ #############################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # Copyright 2014 Groupon, Inc. #
5
+ # Copyright 2014 The Billing Project, LLC #
6
+ # #
7
+ # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
+ # (the "License"); you may not use this file except in compliance with the #
9
+ # License. You may obtain a copy of the License at: #
10
+ # #
11
+ # http://www.apache.org/licenses/LICENSE-2.0 #
12
+ # #
13
+ # Unless required by applicable law or agreed to in writing, software #
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
+ # License for the specific language governing permissions and limitations #
17
+ # under the License. #
18
+ # #
19
+ #############################################################################################
20
+
21
+
22
+ #
23
+ # DO NOT EDIT!!!
24
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
+ #
26
+
27
+
28
+ module KillBillClient
29
+ module Model
30
+ class UnitAttributes < Resource
31
+ attribute :name
32
+ attribute :pretty_name
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,38 @@
1
+ #############################################################################################
2
+ # #
3
+ # Copyright 2010-2013 Ning, Inc. #
4
+ # Copyright 2014 Groupon, Inc. #
5
+ # Copyright 2014 The Billing Project, LLC #
6
+ # #
7
+ # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
+ # (the "License"); you may not use this file except in compliance with the #
9
+ # License. You may obtain a copy of the License at: #
10
+ # #
11
+ # http://www.apache.org/licenses/LICENSE-2.0 #
12
+ # #
13
+ # Unless required by applicable law or agreed to in writing, software #
14
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
+ # License for the specific language governing permissions and limitations #
17
+ # under the License. #
18
+ # #
19
+ #############################################################################################
20
+
21
+
22
+ #
23
+ # DO NOT EDIT!!!
24
+ # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
+ #
26
+
27
+
28
+ module KillBillClient
29
+ module Model
30
+ class UsagePriceOverrideAttributes < Resource
31
+ attribute :usage_name
32
+ attribute :usage_type
33
+ attribute :billing_mode
34
+ attribute :tier_block_policy
35
+ attribute :tier_price_overrides
36
+ end
37
+ end
38
+ end
@@ -29,7 +29,11 @@ module KillBillClient
29
29
  end
30
30
 
31
31
  def set_tags(tag_definition_ids, user = nil, reason = nil, comment = nil, options = {})
32
- current_tag_definition_ids = tags(false, 'NONE', options).map { |tag| tag.tag_definition_id }
32
+ begin
33
+ current_tag_definition_ids = tags(false, 'NONE', options).map { |tag| tag.tag_definition_id }
34
+ rescue KillBillClient::API::NotFound
35
+ current_tag_definition_ids = []
36
+ end
33
37
 
34
38
  tags_to_remove = current_tag_definition_ids - tag_definition_ids
35
39
  tags_to_add = tag_definition_ids - current_tag_definition_ids
@@ -2,8 +2,43 @@ module KillBillClient
2
2
  module Model
3
3
  class InvoiceItem < InvoiceItemAttributes
4
4
 
5
+ KILLBILL_API_INVOICE_ITEMS_PREFIX = "#{KILLBILL_API_PREFIX}/invoiceItems"
6
+
7
+ include KillBillClient::Model::TagHelper
8
+ include KillBillClient::Model::CustomFieldHelper
9
+
10
+ has_custom_fields KILLBILL_API_INVOICE_ITEMS_PREFIX, :invoice_item_id
11
+ has_tags KILLBILL_API_INVOICE_ITEMS_PREFIX, :invoice_item_id
12
+
5
13
  has_many :audit_logs, KillBillClient::Model::AuditLog
6
14
 
15
+ def tags(included_deleted = false, audit = 'NONE', options = {})
16
+ params = {}
17
+ params[:accountId] = account_id
18
+ params[:includedDeleted] = included_deleted if included_deleted
19
+ params[:audit] = audit
20
+ self.class.get "#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags",
21
+ params,
22
+ options,
23
+ Tag
24
+ end
25
+
26
+ def add_tags_from_definition_ids(tag_definition_ids, user, reason, comment, options)
27
+
28
+ created_tag = self.class.post "#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags",
29
+ {},
30
+ {
31
+ :tagList => tag_definition_ids.join(',')
32
+ },
33
+ {
34
+ :user => user,
35
+ :reason => reason,
36
+ :comment => comment,
37
+ }.merge(options),
38
+ Tag
39
+ tags(false, 'NONE', options) unless created_tag.nil?
40
+ end
41
+
7
42
  def create(auto_commit = false, user = nil, reason = nil, comment = nil, options = {})
8
43
  created_invoice_item = self.class.post "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/charges/#{account_id}",
9
44
  [to_hash].to_json,
@@ -1,8 +1,8 @@
1
1
  module KillBillClient
2
2
  module Version
3
- MAJOR = 1
4
- MINOR = 12
5
- PATCH = 1
3
+ MAJOR = 2
4
+ MINOR = 0
5
+ PATCH = 0
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
@@ -147,6 +147,28 @@ describe KillBillClient::Model do
147
147
 
148
148
  invoice.commit 'KillBill Spec test'
149
149
 
150
+ # Add/Remove a invoice item tag
151
+ expect(invoice_item.tags.size).to eq(0)
152
+ invoice_item.add_tag('TEST', 'KillBill Spec test')
153
+ tags = invoice_item.tags
154
+ expect(tags.size).to eq(1)
155
+ expect(tags.first.tag_definition_name).to eq('TEST')
156
+ invoice_item.remove_tag('TEST', 'KillBill Spec test')
157
+ expect(invoice_item.tags.size).to eq(0)
158
+
159
+ # Add/Remove a invoice item custom field
160
+ expect(invoice_item.custom_fields.size).to eq(0)
161
+ custom_field = KillBillClient::Model::CustomField.new
162
+ custom_field.name = Time.now.to_i.to_s
163
+ custom_field.value = Time.now.to_i.to_s
164
+ invoice_item.add_custom_field(custom_field, 'KillBill Spec test')
165
+ custom_fields = invoice_item.custom_fields
166
+ expect(custom_fields.size).to eq(1)
167
+ expect(custom_fields.first.name).to eq(custom_field.name)
168
+ expect(custom_fields.first.value).to eq(custom_field.value)
169
+ invoice_item.remove_custom_field(custom_fields.first.custom_field_id, 'KillBill Spec test')
170
+ expect(invoice_item.custom_fields.size).to eq(0)
171
+
150
172
  # Check the account balance (need to wait a bit for the payment to happen)
151
173
  begin
152
174
  retries ||= 0
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: 1.12.1
4
+ version: 2.0.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-01-19 00:00:00.000000000 Z
11
+ date: 2018-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -80,6 +80,7 @@ files:
80
80
  - lib/killbill_client/models/gen/admin_payment_attributes.rb
81
81
  - lib/killbill_client/models/gen/audit_log_attributes.rb
82
82
  - lib/killbill_client/models/gen/billing_exception_attributes.rb
83
+ - lib/killbill_client/models/gen/block_price_override_attributes.rb
83
84
  - lib/killbill_client/models/gen/blocking_state_attributes.rb
84
85
  - lib/killbill_client/models/gen/bulk_base_subscription_and_add_ons_attributes.rb
85
86
  - lib/killbill_client/models/gen/bundle_attributes.rb
@@ -143,9 +144,12 @@ files:
143
144
  - lib/killbill_client/models/gen/tenant_attributes.rb
144
145
  - lib/killbill_client/models/gen/tenant_key_attributes.rb
145
146
  - lib/killbill_client/models/gen/tier_attributes.rb
147
+ - lib/killbill_client/models/gen/tier_price_override_attributes.rb
146
148
  - lib/killbill_client/models/gen/tiered_block_attributes.rb
149
+ - lib/killbill_client/models/gen/unit_attributes.rb
147
150
  - lib/killbill_client/models/gen/unit_usage_record_attributes.rb
148
151
  - lib/killbill_client/models/gen/usage_attributes.rb
152
+ - lib/killbill_client/models/gen/usage_price_override_attributes.rb
149
153
  - lib/killbill_client/models/gen/usage_record_attributes.rb
150
154
  - lib/killbill_client/models/gen/user_roles_attributes.rb
151
155
  - lib/killbill_client/models/helpers/custom_field_helper.rb