killbill-client 0.8.0 → 0.8.1

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDZjN2ZkNDg3MzM2ZTU0NThjZDVmMzliZDJkMDIxNTQ3ZmNkNDk1OA==
4
+ NjJmNTA0NTAyODdjZWExOWQ5Yjg4YTE4ZmNlMTg1MzBjMTNjODhhYQ==
5
5
  data.tar.gz: !binary |-
6
- NzE5Y2Y5ZWU1YjZhZTBiMTUyMTMzMjRjOGFlMDkyNDQ2MzYwYWJjNA==
6
+ OGYzYzY1NzcyZjU3MjFmYzg4NmI2MWFiZDNhNWY2OWUwYjk3ZDMwOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTgxYmM0ZGMzNDkwNjQ1MzNhZTcyMTYzYTUxZjNmNDJkMjg3YWNmOGRmZjdl
10
- ODk5MTg3NTUwZTg0NGU3M2UzZDUzNTE5YWQxYWI1MmQwNDU4NjEzZGFkMDY0
11
- NzhmYjk1N2QxMDc2MDUzY2NjOGYwNTAyNmViN2ZkODRmMmU0MTE=
9
+ YzY4NzQwOTU5M2QwMTFjNmY4ZmJjNjlkZDJlY2I1MTQ4NGQ2NmYyNmJjMjE1
10
+ NTM4M2YwZTNkMjQzYzZmMTg5ZjJlNjBlZGFkMjJmMzA1MGIyOTRmOTE1ODIw
11
+ OGU2OWVmOTlhOGJhNzllOWEzODU3N2Y3ODg3ZjRjNmI2NThiNjU=
12
12
  data.tar.gz: !binary |-
13
- Mzc0OWI0NDYzZDc0OThiNzYzZjNlYjg5Y2JlMTlhNGVhZjQ3MTkwNGNmMWE2
14
- NDY5NzhiNjcwMDgwNDYwNzVmNjFmMWYyMTFiYjg1OWQ0OGZmZjhjYzQ2ZDAz
15
- Yjc1NTBkOTcwYzcxZTQ4OTQyNDNhZjM4NWE1NDYxODhjNTgwNzY=
13
+ YzU4OTI4NWVlYzllYmM1MWM3ODQ3MzAzZjBmNmVmZGYyMmY2MjRhOTZmNWM0
14
+ OTcwNDY0MWU0ZTA1NTA5MGNiNTE3MjY2ODgwMTk5YzRjZjc4MTA4Njk2OTcw
15
+ Mzc4NmM3NDhiZmFmYzcwZGZkODU2YmZhM2UwNDcwZTNjNjVmMDc=
@@ -0,0 +1,43 @@
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 InvoiceDryRunAttributes < Resource
31
+ attribute :dry_run_action
32
+ attribute :phase_type
33
+ attribute :product_name
34
+ attribute :product_category
35
+ attribute :billing_period
36
+ attribute :price_list_name
37
+ attribute :subscription_id
38
+ attribute :bundle_id
39
+ attribute :effective_date
40
+ attribute :billing_policy
41
+ end
42
+ end
43
+ end
@@ -45,6 +45,7 @@ require 'killbill_client/models/gen/hosted_payment_page_billing_address_attribut
45
45
  require 'killbill_client/models/gen/hosted_payment_page_customer_attributes'
46
46
  require 'killbill_client/models/gen/hosted_payment_page_fields_attributes'
47
47
  require 'killbill_client/models/gen/hosted_payment_page_form_descriptor_attributes'
48
+ require 'killbill_client/models/gen/invoice_dry_run_attributes'
48
49
  require 'killbill_client/models/gen/invoice_email_attributes'
49
50
  require 'killbill_client/models/gen/invoice_item_attributes'
50
51
  require 'killbill_client/models/gen/invoice_attributes'
@@ -2,6 +2,7 @@ module KillBillClient
2
2
  module Model
3
3
  class Invoice < InvoiceAttributes
4
4
  KILLBILL_API_INVOICES_PREFIX = "#{KILLBILL_API_PREFIX}/invoices"
5
+ KILLBILL_API_DRY_RUN_INVOICES_PREFIX = "#{KILLBILL_API_INVOICES_PREFIX}/dryRun"
5
6
 
6
7
  has_many :audit_logs, KillBillClient::Model::AuditLog
7
8
  has_many :items, KillBillClient::Model::InvoiceItem
@@ -45,13 +46,12 @@ module KillBillClient
45
46
  }.merge(options)
46
47
  end
47
48
 
48
- def trigger_invoice(account_id, target_date, dry_run, user = nil, reason = nil, comment = nil, options = {})
49
+ def trigger_invoice(account_id, target_date, user = nil, reason = nil, comment = nil, options = {})
49
50
  query_map = {:accountId => account_id}
50
51
  query_map[:targetDate] = target_date if !target_date.nil?
51
- query_map[:dryRun] = dry_run if !dry_run.nil?
52
52
 
53
53
  begin
54
- res = post "#{KILLBILL_API_INVOICES_PREFIX}",
54
+ res = post "#{KILLBILL_API_INVOICES_PREFIX}/",
55
55
  {},
56
56
  query_map,
57
57
  {
@@ -67,6 +67,125 @@ module KillBillClient
67
67
  # No invoice to generate : TODO parse json to verify this is indeed the case
68
68
  end
69
69
  end
70
+
71
+ def trigger_invoice_dry_run(account_id, target_date, options = {})
72
+ query_map = {:accountId => account_id}
73
+ query_map[:targetDate] = target_date if !target_date.nil?
74
+
75
+ begin
76
+ res = post "#{KILLBILL_API_DRY_RUN_INVOICES_PREFIX}",
77
+ {},
78
+ query_map,
79
+ {
80
+ :user => 'trigger_invoice_dry_run',
81
+ :reason => '',
82
+ :comment => '',
83
+ }.merge(options),
84
+ Invoice
85
+
86
+ res.refresh(options)
87
+
88
+ rescue KillBillClient::API::NotFound => e
89
+ nil
90
+ end
91
+ end
92
+
93
+
94
+ def create_subscription_dry_run(account_id, bundle_id, target_date, product_name, product_category,
95
+ billing_period, price_list_name, options = {})
96
+ query_map = {:accountId => account_id}
97
+ query_map[:targetDate] = target_date if !target_date.nil?
98
+
99
+ dry_run = InvoiceDryRunAttributes.new
100
+ dry_run.dry_run_action = 'START_BILLING'
101
+ dry_run.product_name = product_name
102
+ dry_run.product_category = product_category
103
+ dry_run.billing_period = billing_period
104
+ dry_run.price_list_name = price_list_name
105
+ dry_run.bundle_id = bundle_id
106
+
107
+ begin
108
+ res = post "#{KILLBILL_API_DRY_RUN_INVOICES_PREFIX}",
109
+ dry_run.to_json,
110
+ query_map,
111
+ {
112
+ :user => 'create_subscription_dry_run',
113
+ :reason => '',
114
+ :comment => '',
115
+ }.merge(options),
116
+ Invoice
117
+
118
+ res.refresh(options)
119
+ rescue KillBillClient::API::NotFound => e
120
+ nil
121
+ end
122
+ end
123
+
124
+ def change_plan_dry_run(account_id, bundle_id, subscription_id, target_date, product_name, product_category, billing_period, price_list_name,
125
+ effective_date, billing_policy, options = {})
126
+ query_map = {:accountId => account_id}
127
+ query_map[:targetDate] = target_date if !target_date.nil?
128
+
129
+ dry_run = InvoiceDryRunAttributes.new
130
+ dry_run.dry_run_action = 'CHANGE'
131
+ dry_run.product_name = product_name
132
+ dry_run.product_category = product_category
133
+ dry_run.billing_period = billing_period
134
+ dry_run.price_list_name = price_list_name
135
+ dry_run.effective_date = effective_date
136
+ dry_run.billing_policy = billing_policy
137
+ dry_run.bundle_id = bundle_id
138
+ dry_run.subscription_id = subscription_id
139
+
140
+ begin
141
+ res = post "#{KILLBILL_API_DRY_RUN_INVOICES_PREFIX}",
142
+ dry_run.to_json,
143
+ query_map,
144
+ {
145
+ :user => 'change_plan_dry_run',
146
+ :reason => '',
147
+ :comment => '',
148
+ }.merge(options),
149
+ Invoice
150
+
151
+ res.refresh(options)
152
+ rescue KillBillClient::API::NotFound => e
153
+ nil
154
+ end
155
+ end
156
+
157
+
158
+ def cancel_subscription_dry_run(account_id, bundle_id, subscription_id, target_date,
159
+ effective_date, billing_policy, options = {})
160
+ query_map = {:accountId => account_id}
161
+ query_map[:targetDate] = target_date if !target_date.nil?
162
+
163
+ dry_run = InvoiceDryRunAttributes.new
164
+ dry_run.dry_run_action = 'STOP_BILLING'
165
+ dry_run.effective_date = effective_date
166
+ dry_run.billing_policy = billing_policy
167
+ dry_run.bundle_id = bundle_id
168
+ dry_run.subscription_id = subscription_id
169
+
170
+
171
+ begin
172
+ res = post "#{KILLBILL_API_DRY_RUN_INVOICES_PREFIX}",
173
+ dry_run.to_json,
174
+ query_map,
175
+ {
176
+ :user => 'cancel_subscription_dry_run',
177
+ :reason => '',
178
+ :comment => '',
179
+ }.merge(options),
180
+ Invoice
181
+
182
+ res.refresh(options)
183
+
184
+ rescue KillBillClient::API::NotFound => e
185
+ nil
186
+ end
187
+ end
188
+
70
189
  end
71
190
 
72
191
  def payments(with_plugin_info = false, audit = 'NONE', options = {})
@@ -2,7 +2,7 @@ module KillBillClient
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 8
5
- PATCH = 0
5
+ PATCH = 1
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
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: 0.8.0
4
+ version: 0.8.1
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: 2014-09-27 00:00:00.000000000 Z
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -95,6 +95,7 @@ files:
95
95
  - lib/killbill_client/models/gen/hosted_payment_page_fields_attributes.rb
96
96
  - lib/killbill_client/models/gen/hosted_payment_page_form_descriptor_attributes.rb
97
97
  - lib/killbill_client/models/gen/invoice_attributes.rb
98
+ - lib/killbill_client/models/gen/invoice_dry_run_attributes.rb
98
99
  - lib/killbill_client/models/gen/invoice_email_attributes.rb
99
100
  - lib/killbill_client/models/gen/invoice_item_attributes.rb
100
101
  - lib/killbill_client/models/gen/invoice_payment_attributes.rb