killbill-client 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +371 -0
- data/lib/killbill_client/models/account.rb +74 -0
- data/lib/killbill_client/models/catalog.rb +9 -0
- data/lib/killbill_client/models/credit.rb +18 -9
- data/lib/killbill_client/models/invoice.rb +42 -3
- data/lib/killbill_client/models/invoice_item.rb +0 -27
- data/lib/killbill_client/models/invoice_payment.rb +36 -0
- data/lib/killbill_client/models/payment.rb +2 -0
- data/lib/killbill_client/models/subscription.rb +47 -0
- data/lib/killbill_client/models/transaction.rb +42 -0
- data/lib/killbill_client/version.rb +1 -1
- data/spec/killbill_client/remote/model_spec.rb +23 -12
- data/spec/killbill_client/resource_spec.rb +5 -0
- metadata +12 -33
- data/.travis-install-dependencies.sh +0 -81
- data/.travis.yml +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fa87a6246a9c682976375f3e29fb18c0eeef1c3
|
4
|
+
data.tar.gz: f3aaea13d0f68ffbc516b7213d7de4053a56228f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e38d75f004f707a4684213ecc3b52da47913754beecffca0f009a633cbbfcbdabcb0d14d6c5076cf6a7124f3f938684e820cc6c7122ed6d5313a8815bfa77c5c
|
7
|
+
data.tar.gz: c186cfce4f402bbfbfdd78917aeda1b0761d28874f32dbbe96f48b15d27cd3ef9918edcf262eaa8ab55003edf9f6110f60b51f58450fdbc3f8c9c3099472b022
|
@@ -0,0 +1,371 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
working_directory: ~/repo
|
3
|
+
environment:
|
4
|
+
JRUBY_OPTS: --2.0 -J-Xmx1024M
|
5
|
+
|
6
|
+
version: 2
|
7
|
+
jobs:
|
8
|
+
build-jruby-1.7.26:
|
9
|
+
<<: *defaults
|
10
|
+
docker:
|
11
|
+
- image: killbill/kbbuild:0.2.0
|
12
|
+
steps:
|
13
|
+
- checkout
|
14
|
+
- restore_cache:
|
15
|
+
key: v1-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
16
|
+
- run:
|
17
|
+
name: Install gem dependencies
|
18
|
+
command: |
|
19
|
+
bundle install --jobs=4 --retry=3 --path=vendor/bundle
|
20
|
+
- save_cache:
|
21
|
+
paths:
|
22
|
+
- Gemfile.lock
|
23
|
+
- .bundle
|
24
|
+
- vendor/bundle
|
25
|
+
key: v1-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
26
|
+
|
27
|
+
test-mysql-jruby-1.7.26:
|
28
|
+
<<: *defaults
|
29
|
+
docker:
|
30
|
+
- image: killbill/kbbuild:0.2.0
|
31
|
+
- image: killbill/killbill:0.19.2
|
32
|
+
- image: killbill/mariadb:0.19
|
33
|
+
environment:
|
34
|
+
- MYSQL_ROOT_PASSWORD=root
|
35
|
+
steps:
|
36
|
+
- checkout
|
37
|
+
- restore_cache:
|
38
|
+
key: v1-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
39
|
+
- run:
|
40
|
+
name: Setup DDL
|
41
|
+
command: |
|
42
|
+
set +e
|
43
|
+
count=0
|
44
|
+
until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
|
45
|
+
if [[ "$count" == "25" ]]; then
|
46
|
+
exit 1
|
47
|
+
fi
|
48
|
+
(( count++ ))
|
49
|
+
printf '.'
|
50
|
+
sleep 5
|
51
|
+
done
|
52
|
+
set -e
|
53
|
+
- run:
|
54
|
+
name: Setup Kill Bill
|
55
|
+
command: |
|
56
|
+
set +e
|
57
|
+
count=0
|
58
|
+
until $(curl --output /dev/null --silent --fail http://127.0.0.1:8080/1.0/healthcheck); do
|
59
|
+
if [[ "$count" == "25" ]]; then
|
60
|
+
exit 1
|
61
|
+
fi
|
62
|
+
(( count++ ))
|
63
|
+
|
64
|
+
printf '.'
|
65
|
+
sleep 5
|
66
|
+
done
|
67
|
+
set -e
|
68
|
+
curl -v \
|
69
|
+
-X POST \
|
70
|
+
-u admin:password \
|
71
|
+
-H 'Content-Type: application/json' \
|
72
|
+
-H 'X-Killbill-CreatedBy: CircleCI' \
|
73
|
+
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
|
74
|
+
"http://127.0.0.1:8080/1.0/kb/tenants?useGlobalDefault=true"
|
75
|
+
- run:
|
76
|
+
name: Run tests
|
77
|
+
command: |
|
78
|
+
mkdir /tmp/test-results
|
79
|
+
bundle exec rspec --format documentation \
|
80
|
+
--out /tmp/test-results/rspec.txt \
|
81
|
+
$(circleci tests glob "spec/**/*_spec.rb")
|
82
|
+
- store_test_results:
|
83
|
+
path: /tmp/test-results
|
84
|
+
- store_artifacts:
|
85
|
+
path: /tmp/test-results
|
86
|
+
destination: test-results
|
87
|
+
|
88
|
+
build-ruby-2.2.2:
|
89
|
+
<<: *defaults
|
90
|
+
docker:
|
91
|
+
- image: killbill/kbbuild:0.2.0
|
92
|
+
steps:
|
93
|
+
- checkout
|
94
|
+
- restore_cache:
|
95
|
+
key: v1-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
96
|
+
- run:
|
97
|
+
name: Install gem dependencies
|
98
|
+
command: |
|
99
|
+
source /usr/share/rvm/scripts/rvm
|
100
|
+
rvm use ruby-2.2.2
|
101
|
+
bundle install --jobs=4 --retry=3 --path=vendor/bundle
|
102
|
+
- save_cache:
|
103
|
+
paths:
|
104
|
+
- Gemfile.lock
|
105
|
+
- .bundle
|
106
|
+
- vendor/bundle
|
107
|
+
key: v1-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
108
|
+
|
109
|
+
test-mysql-ruby-2.2.2:
|
110
|
+
<<: *defaults
|
111
|
+
docker:
|
112
|
+
- image: killbill/kbbuild:0.2.0
|
113
|
+
- image: killbill/killbill:0.19.2
|
114
|
+
- image: killbill/mariadb:0.19
|
115
|
+
environment:
|
116
|
+
- MYSQL_ROOT_PASSWORD=root
|
117
|
+
steps:
|
118
|
+
- checkout
|
119
|
+
- restore_cache:
|
120
|
+
key: v1-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
121
|
+
- run:
|
122
|
+
name: Setup DDL
|
123
|
+
command: |
|
124
|
+
set +e
|
125
|
+
count=0
|
126
|
+
until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
|
127
|
+
if [[ "$count" == "25" ]]; then
|
128
|
+
exit 1
|
129
|
+
fi
|
130
|
+
(( count++ ))
|
131
|
+
printf '.'
|
132
|
+
sleep 5
|
133
|
+
done
|
134
|
+
set -e
|
135
|
+
- run:
|
136
|
+
name: Setup Kill Bill
|
137
|
+
command: |
|
138
|
+
set +e
|
139
|
+
count=0
|
140
|
+
until $(curl --output /dev/null --silent --fail http://127.0.0.1:8080/1.0/healthcheck); do
|
141
|
+
if [[ "$count" == "25" ]]; then
|
142
|
+
exit 1
|
143
|
+
fi
|
144
|
+
(( count++ ))
|
145
|
+
|
146
|
+
printf '.'
|
147
|
+
sleep 5
|
148
|
+
done
|
149
|
+
set -e
|
150
|
+
curl -v \
|
151
|
+
-X POST \
|
152
|
+
-u admin:password \
|
153
|
+
-H 'Content-Type: application/json' \
|
154
|
+
-H 'X-Killbill-CreatedBy: CircleCI' \
|
155
|
+
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
|
156
|
+
"http://127.0.0.1:8080/1.0/kb/tenants?useGlobalDefault=true"
|
157
|
+
- run:
|
158
|
+
name: Run tests
|
159
|
+
command: |
|
160
|
+
mkdir /tmp/test-results
|
161
|
+
source /usr/share/rvm/scripts/rvm
|
162
|
+
rvm use ruby-2.2.2
|
163
|
+
bundle exec rspec --format documentation \
|
164
|
+
--out /tmp/test-results/rspec.txt \
|
165
|
+
$(circleci tests glob "spec/**/*_spec.rb")
|
166
|
+
- store_test_results:
|
167
|
+
path: /tmp/test-results
|
168
|
+
- store_artifacts:
|
169
|
+
path: /tmp/test-results
|
170
|
+
destination: test-results
|
171
|
+
|
172
|
+
build-ruby-2.4.2:
|
173
|
+
<<: *defaults
|
174
|
+
docker:
|
175
|
+
- image: killbill/kbbuild:0.2.0
|
176
|
+
steps:
|
177
|
+
- checkout
|
178
|
+
- restore_cache:
|
179
|
+
key: v1-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
180
|
+
- run:
|
181
|
+
name: Install gem dependencies
|
182
|
+
command: |
|
183
|
+
source /usr/share/rvm/scripts/rvm
|
184
|
+
rvm use ruby-2.4.2
|
185
|
+
bundle install --jobs=4 --retry=3 --path=vendor/bundle
|
186
|
+
- save_cache:
|
187
|
+
paths:
|
188
|
+
- Gemfile.lock
|
189
|
+
- .bundle
|
190
|
+
- vendor/bundle
|
191
|
+
key: v1-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
192
|
+
|
193
|
+
test-mysql-ruby-2.4.2:
|
194
|
+
<<: *defaults
|
195
|
+
docker:
|
196
|
+
- image: killbill/kbbuild:0.2.0
|
197
|
+
- image: killbill/killbill:0.19.2
|
198
|
+
- image: killbill/mariadb:0.19
|
199
|
+
environment:
|
200
|
+
- MYSQL_ROOT_PASSWORD=root
|
201
|
+
steps:
|
202
|
+
- checkout
|
203
|
+
- restore_cache:
|
204
|
+
key: v1-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
205
|
+
- run:
|
206
|
+
name: Setup DDL
|
207
|
+
command: |
|
208
|
+
set +e
|
209
|
+
count=0
|
210
|
+
until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
|
211
|
+
if [[ "$count" == "25" ]]; then
|
212
|
+
exit 1
|
213
|
+
fi
|
214
|
+
(( count++ ))
|
215
|
+
printf '.'
|
216
|
+
sleep 5
|
217
|
+
done
|
218
|
+
set -e
|
219
|
+
- run:
|
220
|
+
name: Setup Kill Bill
|
221
|
+
command: |
|
222
|
+
set +e
|
223
|
+
count=0
|
224
|
+
until $(curl --output /dev/null --silent --fail http://127.0.0.1:8080/1.0/healthcheck); do
|
225
|
+
if [[ "$count" == "25" ]]; then
|
226
|
+
exit 1
|
227
|
+
fi
|
228
|
+
(( count++ ))
|
229
|
+
|
230
|
+
printf '.'
|
231
|
+
sleep 5
|
232
|
+
done
|
233
|
+
set -e
|
234
|
+
curl -v \
|
235
|
+
-X POST \
|
236
|
+
-u admin:password \
|
237
|
+
-H 'Content-Type: application/json' \
|
238
|
+
-H 'X-Killbill-CreatedBy: CircleCI' \
|
239
|
+
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
|
240
|
+
"http://127.0.0.1:8080/1.0/kb/tenants?useGlobalDefault=true"
|
241
|
+
- run:
|
242
|
+
name: Run tests
|
243
|
+
command: |
|
244
|
+
mkdir /tmp/test-results
|
245
|
+
source /usr/share/rvm/scripts/rvm
|
246
|
+
rvm use ruby-2.4.2
|
247
|
+
bundle exec rspec --format documentation \
|
248
|
+
--out /tmp/test-results/rspec.txt \
|
249
|
+
$(circleci tests glob "spec/**/*_spec.rb")
|
250
|
+
- store_test_results:
|
251
|
+
path: /tmp/test-results
|
252
|
+
- store_artifacts:
|
253
|
+
path: /tmp/test-results
|
254
|
+
destination: test-results
|
255
|
+
|
256
|
+
build-jruby-9.1.14.0:
|
257
|
+
<<: *defaults
|
258
|
+
docker:
|
259
|
+
- image: killbill/kbbuild:0.2.0
|
260
|
+
steps:
|
261
|
+
- checkout
|
262
|
+
- restore_cache:
|
263
|
+
key: v1-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
264
|
+
- run:
|
265
|
+
name: Install gem dependencies
|
266
|
+
command: |
|
267
|
+
source /usr/share/rvm/scripts/rvm
|
268
|
+
rvm use jruby-9.1.14.0
|
269
|
+
bundle install --jobs=4 --retry=3 --path=vendor/bundle
|
270
|
+
- save_cache:
|
271
|
+
paths:
|
272
|
+
- Gemfile.lock
|
273
|
+
- .bundle
|
274
|
+
- vendor/bundle
|
275
|
+
key: v1-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
276
|
+
|
277
|
+
test-mysql-jruby-9.1.14.0:
|
278
|
+
<<: *defaults
|
279
|
+
docker:
|
280
|
+
- image: killbill/kbbuild:0.2.0
|
281
|
+
- image: killbill/killbill:0.19.2
|
282
|
+
- image: killbill/mariadb:0.19
|
283
|
+
environment:
|
284
|
+
- MYSQL_ROOT_PASSWORD=root
|
285
|
+
steps:
|
286
|
+
- checkout
|
287
|
+
- restore_cache:
|
288
|
+
key: v1-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
|
289
|
+
- run:
|
290
|
+
name: Setup DDL
|
291
|
+
command: |
|
292
|
+
set +e
|
293
|
+
count=0
|
294
|
+
until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
|
295
|
+
if [[ "$count" == "25" ]]; then
|
296
|
+
exit 1
|
297
|
+
fi
|
298
|
+
(( count++ ))
|
299
|
+
printf '.'
|
300
|
+
sleep 5
|
301
|
+
done
|
302
|
+
set -e
|
303
|
+
- run:
|
304
|
+
name: Setup Kill Bill
|
305
|
+
command: |
|
306
|
+
set +e
|
307
|
+
count=0
|
308
|
+
until $(curl --output /dev/null --silent --fail http://127.0.0.1:8080/1.0/healthcheck); do
|
309
|
+
if [[ "$count" == "25" ]]; then
|
310
|
+
exit 1
|
311
|
+
fi
|
312
|
+
(( count++ ))
|
313
|
+
|
314
|
+
printf '.'
|
315
|
+
sleep 5
|
316
|
+
done
|
317
|
+
set -e
|
318
|
+
curl -v \
|
319
|
+
-X POST \
|
320
|
+
-u admin:password \
|
321
|
+
-H 'Content-Type: application/json' \
|
322
|
+
-H 'X-Killbill-CreatedBy: CircleCI' \
|
323
|
+
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
|
324
|
+
"http://127.0.0.1:8080/1.0/kb/tenants?useGlobalDefault=true"
|
325
|
+
- run:
|
326
|
+
name: Run tests
|
327
|
+
command: |
|
328
|
+
mkdir /tmp/test-results
|
329
|
+
source /usr/share/rvm/scripts/rvm
|
330
|
+
rvm use jruby-9.1.14.0
|
331
|
+
bundle exec rspec --format documentation \
|
332
|
+
--out /tmp/test-results/rspec.txt \
|
333
|
+
$(circleci tests glob "spec/**/*_spec.rb")
|
334
|
+
- store_test_results:
|
335
|
+
path: /tmp/test-results
|
336
|
+
- store_artifacts:
|
337
|
+
path: /tmp/test-results
|
338
|
+
destination: test-results
|
339
|
+
workflows:
|
340
|
+
version: 2
|
341
|
+
build-and-test:
|
342
|
+
jobs:
|
343
|
+
# Kill Bill plugins
|
344
|
+
- build-jruby-1.7.26
|
345
|
+
# Self-contained KPM
|
346
|
+
- build-ruby-2.2.2:
|
347
|
+
requires:
|
348
|
+
- build-jruby-1.7.26
|
349
|
+
# Kaui and other gems
|
350
|
+
- build-ruby-2.4.2:
|
351
|
+
requires:
|
352
|
+
- build-jruby-1.7.26
|
353
|
+
# Self-contained Kaui
|
354
|
+
- build-jruby-9.1.14.0:
|
355
|
+
requires:
|
356
|
+
- build-jruby-1.7.26
|
357
|
+
- test-mysql-jruby-1.7.26:
|
358
|
+
requires:
|
359
|
+
- build-jruby-1.7.26
|
360
|
+
- test-mysql-ruby-2.2.2:
|
361
|
+
requires:
|
362
|
+
- build-ruby-2.2.2
|
363
|
+
- test-mysql-jruby-1.7.26
|
364
|
+
- test-mysql-ruby-2.4.2:
|
365
|
+
requires:
|
366
|
+
- build-ruby-2.4.2
|
367
|
+
- test-mysql-jruby-1.7.26
|
368
|
+
- test-mysql-jruby-9.1.14.0:
|
369
|
+
requires:
|
370
|
+
- build-jruby-9.1.14.0
|
371
|
+
- test-mysql-jruby-1.7.26
|
@@ -140,6 +140,16 @@ module KillBillClient
|
|
140
140
|
Invoice
|
141
141
|
end
|
142
142
|
|
143
|
+
def migration_invoices(with_items=false, options = {})
|
144
|
+
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoices",
|
145
|
+
{
|
146
|
+
:withMigrationInvoices => true,
|
147
|
+
:withItems => with_items
|
148
|
+
},
|
149
|
+
options,
|
150
|
+
Invoice
|
151
|
+
end
|
152
|
+
|
143
153
|
def payments(options = {})
|
144
154
|
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments",
|
145
155
|
{},
|
@@ -265,6 +275,13 @@ module KillBillClient
|
|
265
275
|
AccountEmailAttributes
|
266
276
|
end
|
267
277
|
|
278
|
+
def email_notifications(options = {})
|
279
|
+
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emailNotifications",
|
280
|
+
{},
|
281
|
+
options,
|
282
|
+
InvoiceEmailAttributes
|
283
|
+
end
|
284
|
+
|
268
285
|
def update_email_notifications(user = nil, reason = nil, comment = nil, options = {})
|
269
286
|
self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emailNotifications",
|
270
287
|
to_json,
|
@@ -297,6 +314,63 @@ module KillBillClient
|
|
297
314
|
options,
|
298
315
|
CustomField
|
299
316
|
end
|
317
|
+
|
318
|
+
def blocking_states(blocking_state_types, blocking_state_svcs, audit = 'NONE', options = {})
|
319
|
+
params = {}
|
320
|
+
params[:blockingStateTypes] = blocking_state_types if blocking_state_types
|
321
|
+
params[:blockingStateSvcs] = blocking_state_svcs if blocking_state_svcs
|
322
|
+
params[:audit] = audit
|
323
|
+
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/block",
|
324
|
+
params,
|
325
|
+
options,
|
326
|
+
BlockingStateAttributes
|
327
|
+
|
328
|
+
end
|
329
|
+
|
330
|
+
def set_blocking_state(state_name, service, block_change, block_entitlement, block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {})
|
331
|
+
|
332
|
+
params = {}
|
333
|
+
params[:requestedDate] = requested_date if requested_date
|
334
|
+
|
335
|
+
body = KillBillClient::Model::BlockingStateAttributes.new
|
336
|
+
body.state_name = state_name
|
337
|
+
body.service = service
|
338
|
+
body.block_change = block_change
|
339
|
+
body.block_entitlement = block_entitlement
|
340
|
+
body.block_billing = block_billing
|
341
|
+
|
342
|
+
self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/block",
|
343
|
+
body.to_json,
|
344
|
+
params,
|
345
|
+
{
|
346
|
+
:user => user,
|
347
|
+
:reason => reason,
|
348
|
+
:comment => comment,
|
349
|
+
}.merge(options)
|
350
|
+
blocking_states(nil, nil, 'NONE', options)
|
351
|
+
end
|
352
|
+
|
353
|
+
def cba_rebalancing(user = nil, reason = nil, comment = nil, options = {})
|
354
|
+
self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/cbaRebalancing",
|
355
|
+
{},
|
356
|
+
{},
|
357
|
+
{
|
358
|
+
:user => user,
|
359
|
+
:reason => reason,
|
360
|
+
:comment => comment,
|
361
|
+
}.merge(options)
|
362
|
+
end
|
363
|
+
|
364
|
+
def invoice_payments(audit='NONE', with_plugin_info = false, with_attempts = false, options = {})
|
365
|
+
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoicePayments",
|
366
|
+
{
|
367
|
+
:audit => audit,
|
368
|
+
:withPluginInfo => with_plugin_info,
|
369
|
+
:withAttempts => with_attempts
|
370
|
+
},
|
371
|
+
options,
|
372
|
+
InvoicePayment
|
373
|
+
end
|
300
374
|
end
|
301
375
|
end
|
302
376
|
end
|
@@ -29,6 +29,15 @@ module KillBillClient
|
|
29
29
|
PlanDetail
|
30
30
|
end
|
31
31
|
|
32
|
+
def get_tenant_catalog_versions(options = {})
|
33
|
+
|
34
|
+
require_multi_tenant_options!(options, "Retrieving catalog versions is only supported in multi-tenant mode")
|
35
|
+
|
36
|
+
get "#{KILLBILL_API_CATALOG_PREFIX}/versions",
|
37
|
+
{},
|
38
|
+
options
|
39
|
+
end
|
40
|
+
|
32
41
|
def get_tenant_catalog(format, requested_date=nil, options = {})
|
33
42
|
|
34
43
|
require_multi_tenant_options!(options, "Retrieving a catalog is only supported in multi-tenant mode")
|
@@ -4,17 +4,26 @@ module KillBillClient
|
|
4
4
|
KILLBILL_API_CREDITS_PREFIX = "#{KILLBILL_API_PREFIX}/credits"
|
5
5
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
6
6
|
|
7
|
+
class << self
|
8
|
+
def find_by_id(credit_id, options = {})
|
9
|
+
get "#{KILLBILL_API_CREDITS_PREFIX}/#{credit_id}",
|
10
|
+
{},
|
11
|
+
options,
|
12
|
+
CreditAttributes
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
7
16
|
def create(auto_commit = false, user = nil, reason = nil, comment = nil, options = {})
|
8
17
|
created_credit = self.class.post KILLBILL_API_CREDITS_PREFIX,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
to_json,
|
19
|
+
{
|
20
|
+
:autoCommit => auto_commit
|
21
|
+
},
|
22
|
+
{
|
23
|
+
:user => user,
|
24
|
+
:reason => reason,
|
25
|
+
:comment => comment,
|
26
|
+
}.merge(options)
|
18
27
|
created_credit.refresh(options)
|
19
28
|
end
|
20
29
|
|
@@ -3,6 +3,7 @@ module KillBillClient
|
|
3
3
|
class Invoice < InvoiceAttributes
|
4
4
|
|
5
5
|
include KillBillClient::Model::CustomFieldHelper
|
6
|
+
include KillBillClient::Model::TagHelper
|
6
7
|
|
7
8
|
KILLBILL_API_INVOICES_PREFIX = "#{KILLBILL_API_PREFIX}/invoices"
|
8
9
|
KILLBILL_API_DRY_RUN_INVOICES_PREFIX = "#{KILLBILL_API_INVOICES_PREFIX}/dryRun"
|
@@ -12,6 +13,7 @@ module KillBillClient
|
|
12
13
|
has_many :credits, KillBillClient::Model::Credit
|
13
14
|
|
14
15
|
has_custom_fields KILLBILL_API_INVOICES_PREFIX, :invoice_id
|
16
|
+
has_tags KILLBILL_API_INVOICES_PREFIX, :invoice_id
|
15
17
|
|
16
18
|
class << self
|
17
19
|
def find_by_id_or_number(id_or_number, with_items = true, audit = "NONE", options = {})
|
@@ -99,7 +101,7 @@ module KillBillClient
|
|
99
101
|
|
100
102
|
|
101
103
|
def create_subscription_dry_run(account_id, bundle_id, target_date, product_name, product_category,
|
102
|
-
|
104
|
+
billing_period, price_list_name, options = {})
|
103
105
|
query_map = {:accountId => account_id}
|
104
106
|
query_map[:targetDate] = target_date if !target_date.nil?
|
105
107
|
|
@@ -130,7 +132,7 @@ module KillBillClient
|
|
130
132
|
end
|
131
133
|
|
132
134
|
def change_plan_dry_run(account_id, bundle_id, subscription_id, target_date, product_name, product_category, billing_period, price_list_name,
|
133
|
-
|
135
|
+
effective_date, billing_policy, options = {})
|
134
136
|
query_map = {:accountId => account_id}
|
135
137
|
query_map[:targetDate] = target_date if !target_date.nil?
|
136
138
|
|
@@ -165,7 +167,7 @@ module KillBillClient
|
|
165
167
|
|
166
168
|
|
167
169
|
def cancel_subscription_dry_run(account_id, bundle_id, subscription_id, target_date,
|
168
|
-
|
170
|
+
effective_date, billing_policy, options = {})
|
169
171
|
query_map = {:accountId => account_id}
|
170
172
|
query_map[:targetDate] = target_date if !target_date.nil?
|
171
173
|
|
@@ -295,7 +297,19 @@ module KillBillClient
|
|
295
297
|
get_catalog_translation(locale, options)
|
296
298
|
end
|
297
299
|
|
300
|
+
def create_migration_invoice(account_id, invoices, target_date, user = nil, reason = nil, comment = nil, options = {})
|
298
301
|
|
302
|
+
params = {}
|
303
|
+
params[:targetDate] = target_date
|
304
|
+
post "#{KILLBILL_API_INVOICES_PREFIX}/migration/#{account_id}",
|
305
|
+
invoices.to_json,
|
306
|
+
params,
|
307
|
+
{
|
308
|
+
:user => user,
|
309
|
+
:reason => reason,
|
310
|
+
:comment => comment,
|
311
|
+
}.merge(options)
|
312
|
+
end
|
299
313
|
|
300
314
|
end
|
301
315
|
|
@@ -312,6 +326,19 @@ module KillBillClient
|
|
312
326
|
|
313
327
|
end
|
314
328
|
|
329
|
+
def void(user = nil, reason = nil, comment = nil, options = {})
|
330
|
+
|
331
|
+
self.class.put "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/#{invoice_id}/voidInvoice",
|
332
|
+
nil,
|
333
|
+
{},
|
334
|
+
{
|
335
|
+
:user => user,
|
336
|
+
:reason => reason,
|
337
|
+
:comment => comment,
|
338
|
+
}.merge(options)
|
339
|
+
|
340
|
+
end
|
341
|
+
|
315
342
|
def payments(with_plugin_info = false, with_attempts = false, audit = 'NONE', options = {})
|
316
343
|
self.class.get "#{KILLBILL_API_INVOICES_PREFIX}/#{invoice_id}/payments",
|
317
344
|
{
|
@@ -322,6 +349,18 @@ module KillBillClient
|
|
322
349
|
options,
|
323
350
|
InvoicePayment
|
324
351
|
end
|
352
|
+
|
353
|
+
def trigger_email_notifications(user = nil, reason = nil, comment = nil, options = {})
|
354
|
+
self.class.post "#{KILLBILL_API_INVOICES_PREFIX}/#{invoice_id}/emailNotifications",
|
355
|
+
{},
|
356
|
+
{},
|
357
|
+
{
|
358
|
+
:user => user,
|
359
|
+
:reason => reason,
|
360
|
+
:comment => comment,
|
361
|
+
}.merge(options)
|
362
|
+
end
|
363
|
+
|
325
364
|
end
|
326
365
|
end
|
327
366
|
end
|
@@ -12,33 +12,6 @@ module KillBillClient
|
|
12
12
|
|
13
13
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
14
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
|
-
|
42
15
|
def create(auto_commit = false, user = nil, reason = nil, comment = nil, options = {})
|
43
16
|
created_invoice_item = self.class.post "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/charges/#{account_id}",
|
44
17
|
[to_hash].to_json,
|
@@ -3,6 +3,7 @@ module KillBillClient
|
|
3
3
|
class InvoicePayment < InvoicePaymentAttributes
|
4
4
|
|
5
5
|
include KillBillClient::Model::CustomFieldHelper
|
6
|
+
include KillBillClient::Model::TagHelper
|
6
7
|
|
7
8
|
KILLBILL_API_INVOICE_PAYMENTS_PREFIX = "#{KILLBILL_API_PREFIX}/invoicePayments"
|
8
9
|
|
@@ -11,6 +12,7 @@ module KillBillClient
|
|
11
12
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
12
13
|
|
13
14
|
has_custom_fields KILLBILL_API_INVOICE_PAYMENTS_PREFIX, :payment_id
|
15
|
+
has_tags KILLBILL_API_INVOICE_PAYMENTS_PREFIX, :payment_id
|
14
16
|
|
15
17
|
class << self
|
16
18
|
def find_by_id(payment_id, with_plugin_info = false, with_attempts = false, options = {})
|
@@ -39,6 +41,39 @@ module KillBillClient
|
|
39
41
|
|
40
42
|
invoice_payment.refresh(options)
|
41
43
|
end
|
44
|
+
|
45
|
+
def chargeback(payment_id, amount, currency, effective_date = nil, user = nil, reason = nil, comment = nil, options = {})
|
46
|
+
payload = InvoicePaymentTransactionAttributes.new
|
47
|
+
payload.amount = amount
|
48
|
+
payload.currency = currency
|
49
|
+
payload.effective_date = effective_date
|
50
|
+
|
51
|
+
invoice_payment = post "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}/chargebacks",
|
52
|
+
payload.to_json,
|
53
|
+
{},
|
54
|
+
{
|
55
|
+
:user => user,
|
56
|
+
:reason => reason,
|
57
|
+
:comment => comment,
|
58
|
+
}.merge(options)
|
59
|
+
invoice_payment.refresh(options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def chargeback_reversal(payment_id, transaction_external_key, effective_date = nil, user = nil, reason = nil, comment = nil, options = {})
|
63
|
+
payload = InvoicePaymentTransactionAttributes.new
|
64
|
+
payload.transaction_external_key = transaction_external_key
|
65
|
+
payload.effective_date = effective_date
|
66
|
+
|
67
|
+
invoice_payment = post "#{KILLBILL_API_INVOICE_PAYMENTS_PREFIX}/#{payment_id}/chargebackReversals",
|
68
|
+
payload.to_json,
|
69
|
+
{},
|
70
|
+
{
|
71
|
+
:user => user,
|
72
|
+
:reason => reason,
|
73
|
+
:comment => comment,
|
74
|
+
}.merge(options)
|
75
|
+
invoice_payment.refresh(options)
|
76
|
+
end
|
42
77
|
end
|
43
78
|
|
44
79
|
def create(external_payment = false, user = nil, reason = nil, comment = nil, options = {})
|
@@ -69,6 +104,7 @@ module KillBillClient
|
|
69
104
|
:comment => comment,
|
70
105
|
}.merge(options)
|
71
106
|
end
|
107
|
+
|
72
108
|
end
|
73
109
|
end
|
74
110
|
end
|
@@ -3,6 +3,7 @@ module KillBillClient
|
|
3
3
|
class Payment < PaymentAttributes
|
4
4
|
|
5
5
|
include KillBillClient::Model::CustomFieldHelper
|
6
|
+
include KillBillClient::Model::TagHelper
|
6
7
|
|
7
8
|
KILLBILL_API_PAYMENTS_PREFIX = "#{KILLBILL_API_PREFIX}/payments"
|
8
9
|
|
@@ -11,6 +12,7 @@ module KillBillClient
|
|
11
12
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
12
13
|
|
13
14
|
has_custom_fields KILLBILL_API_PAYMENTS_PREFIX, :payment_id
|
15
|
+
has_tags KILLBILL_API_PAYMENTS_PREFIX, :payment_id
|
14
16
|
|
15
17
|
class << self
|
16
18
|
def find_by_id(payment_id, with_plugin_info = false, with_attempts = false, options = {})
|
@@ -132,6 +132,53 @@ module KillBillClient
|
|
132
132
|
end
|
133
133
|
|
134
134
|
|
135
|
+
#
|
136
|
+
# Block a Subscription
|
137
|
+
#
|
138
|
+
def set_blocking_state(state_name, service, block_change, block_entitlement, block_billing, requested_date = nil, user = nil, reason = nil, comment = nil, options = {})
|
139
|
+
|
140
|
+
body = KillBillClient::Model::BlockingStateAttributes.new
|
141
|
+
body.state_name = state_name
|
142
|
+
body.service = service
|
143
|
+
body.block_change = block_change
|
144
|
+
body.block_entitlement = block_entitlement
|
145
|
+
body.block_billing = block_billing
|
146
|
+
body.type = "SUBSCRIPTION"
|
147
|
+
|
148
|
+
params = {}
|
149
|
+
params[:requestedDate] = requested_date unless requested_date.nil?
|
150
|
+
|
151
|
+
self.class.put "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{subscription_id}/block",
|
152
|
+
body.to_json,
|
153
|
+
params,
|
154
|
+
{
|
155
|
+
:user => user,
|
156
|
+
:reason => reason,
|
157
|
+
:comment => comment,
|
158
|
+
}.merge(options)
|
159
|
+
end
|
160
|
+
|
161
|
+
#
|
162
|
+
# Create an entitlement with addOn products
|
163
|
+
#
|
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 = {})
|
165
|
+
params = {}
|
166
|
+
params[:requestedDate] = requested_date if requested_date
|
167
|
+
params[:entitlementDate] = entitlement_date if entitlement_date
|
168
|
+
params[:billingDate] = billing_date if billing_date
|
169
|
+
params[:migrated] = migrated
|
170
|
+
params[:callCompletion] = true unless call_completion_sec.nil?
|
171
|
+
params[:callTimeoutSec] = call_completion_sec unless call_completion_sec.nil?
|
172
|
+
|
173
|
+
self.class.post "#{KILLBILL_API_ENTITLEMENT_PREFIX}/createEntitlementWithAddOns",
|
174
|
+
entitlements.to_json,
|
175
|
+
params,
|
176
|
+
{
|
177
|
+
:user => user,
|
178
|
+
:reason => reason,
|
179
|
+
:comment => comment,
|
180
|
+
}.merge(options)
|
181
|
+
end
|
135
182
|
end
|
136
183
|
end
|
137
184
|
end
|
@@ -92,6 +92,20 @@ module KillBillClient
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
def refund_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil)
|
96
|
+
follow_location = delete_follow_location(options)
|
97
|
+
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
|
98
|
+
self.class.post "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/refunds",
|
99
|
+
to_json,
|
100
|
+
{},
|
101
|
+
{
|
102
|
+
:user => user,
|
103
|
+
:reason => reason,
|
104
|
+
:comment => comment,
|
105
|
+
}.merge(options)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
95
109
|
def void(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil)
|
96
110
|
follow_location = delete_follow_location(options)
|
97
111
|
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
|
@@ -138,6 +152,34 @@ module KillBillClient
|
|
138
152
|
}.merge(options)
|
139
153
|
end
|
140
154
|
|
155
|
+
def chargeback_by_external_key(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil)
|
156
|
+
follow_location = delete_follow_location(options)
|
157
|
+
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
|
158
|
+
self.class.post "#{follow_up_path(payment_id)}/chargebacks",
|
159
|
+
to_json,
|
160
|
+
{},
|
161
|
+
{
|
162
|
+
:user => user,
|
163
|
+
:reason => reason,
|
164
|
+
:comment => comment,
|
165
|
+
}.merge(options)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def chargeback_reversals(user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil)
|
170
|
+
follow_location = delete_follow_location(options)
|
171
|
+
refresh_payment_with_failure_handling(follow_location, refresh_options || options) do
|
172
|
+
self.class.post "#{follow_up_path(payment_id)}/chargebackReversals",
|
173
|
+
to_json,
|
174
|
+
{},
|
175
|
+
{
|
176
|
+
:user => user,
|
177
|
+
:reason => reason,
|
178
|
+
:comment => comment,
|
179
|
+
}.merge(options)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
141
183
|
private
|
142
184
|
|
143
185
|
|
@@ -1,11 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe KillBillClient::Model do
|
4
|
+
before do
|
5
|
+
KillBillClient.api_key = Time.now.to_i.to_s + rand(100).to_s
|
6
|
+
KillBillClient.api_secret = KillBillClient.api_key
|
7
|
+
|
8
|
+
tenant = KillBillClient::Model::Tenant.new
|
9
|
+
tenant.api_key = KillBillClient.api_key
|
10
|
+
tenant.api_secret = KillBillClient.api_secret
|
11
|
+
tenant.create(true, 'KillBill Spec test')
|
12
|
+
end
|
13
|
+
|
4
14
|
it 'should manipulate accounts', :integration => true do
|
5
15
|
# In case the remote server has lots of data
|
6
16
|
search_limit = 100000
|
7
17
|
|
8
|
-
external_key =
|
18
|
+
external_key = SecureRandom.uuid.to_s
|
9
19
|
|
10
20
|
account = KillBillClient::Model::Account.new
|
11
21
|
account.name = 'KillBillClient'
|
@@ -84,8 +94,8 @@ describe KillBillClient::Model do
|
|
84
94
|
# Add/Remove a custom field
|
85
95
|
expect(account.custom_fields.size).to eq(0)
|
86
96
|
custom_field = KillBillClient::Model::CustomField.new
|
87
|
-
custom_field.name =
|
88
|
-
custom_field.value =
|
97
|
+
custom_field.name = SecureRandom.uuid.to_s
|
98
|
+
custom_field.value = SecureRandom.uuid.to_s
|
89
99
|
account.add_custom_field(custom_field, 'KillBill Spec test')
|
90
100
|
custom_fields = account.custom_fields
|
91
101
|
expect(custom_fields.size).to eq(1)
|
@@ -175,8 +185,8 @@ describe KillBillClient::Model do
|
|
175
185
|
sleep(1) if retries > 0
|
176
186
|
account = KillBillClient::Model::Account.find_by_id account.account_id, true
|
177
187
|
expect(account.account_balance).to eq(0)
|
178
|
-
rescue => e
|
179
|
-
if (retries += 1) <
|
188
|
+
rescue Exception => e
|
189
|
+
if (retries += 1) < 15
|
180
190
|
retry
|
181
191
|
else
|
182
192
|
raise e
|
@@ -243,8 +253,8 @@ describe KillBillClient::Model do
|
|
243
253
|
# Add/Remove an invoice payment custom field
|
244
254
|
expect(invoice_payment.custom_fields.size).to eq(0)
|
245
255
|
custom_field = KillBillClient::Model::CustomField.new
|
246
|
-
custom_field.name =
|
247
|
-
custom_field.value =
|
256
|
+
custom_field.name = SecureRandom.uuid.to_s
|
257
|
+
custom_field.value = SecureRandom.uuid.to_s
|
248
258
|
invoice_payment.add_custom_field(custom_field, 'KillBill Spec test')
|
249
259
|
custom_fields = invoice_payment.custom_fields
|
250
260
|
expect(custom_fields.size).to eq(1)
|
@@ -289,7 +299,7 @@ describe KillBillClient::Model do
|
|
289
299
|
new_credit.effective_date = "2013-09-30"
|
290
300
|
new_credit.account_id = account.account_id
|
291
301
|
|
292
|
-
expect { new_credit.create 'KillBill Spec test'
|
302
|
+
expect { new_credit.create(true, 'KillBill Spec test') }.to raise_error(KillBillClient::API::BadRequest)
|
293
303
|
|
294
304
|
# Verify the invoice item of the credit
|
295
305
|
invoice = KillBillClient::Model::Invoice.find_by_id_or_number invoice_id
|
@@ -302,7 +312,7 @@ describe KillBillClient::Model do
|
|
302
312
|
# Create a subscription
|
303
313
|
sub = KillBillClient::Model::Subscription.new
|
304
314
|
sub.account_id = account.account_id
|
305
|
-
sub.external_key =
|
315
|
+
sub.external_key = SecureRandom.uuid.to_s
|
306
316
|
sub.product_name = 'Sports'
|
307
317
|
sub.product_category = 'BASE'
|
308
318
|
sub.billing_period = 'MONTHLY'
|
@@ -336,12 +346,13 @@ describe KillBillClient::Model do
|
|
336
346
|
expect(KillBillClient::Model::TagDefinition.all.size).to be > 0
|
337
347
|
expect(KillBillClient::Model::TagDefinition.find_by_name('TEST').is_control_tag).to be_truthy
|
338
348
|
|
339
|
-
tag_definition_name =
|
349
|
+
tag_definition_name = SecureRandom.uuid.to_s[0..9]
|
340
350
|
expect(KillBillClient::Model::TagDefinition.find_by_name(tag_definition_name)).to be_nil
|
341
351
|
|
342
352
|
tag_definition = KillBillClient::Model::TagDefinition.new
|
343
353
|
tag_definition.name = tag_definition_name
|
344
354
|
tag_definition.description = 'Tag for unit test'
|
355
|
+
tag_definition.applicable_object_types = [:ACCOUNT]
|
345
356
|
expect(tag_definition.create('KillBill Spec test').id).not_to be_nil
|
346
357
|
|
347
358
|
found_tag_definition = KillBillClient::Model::TagDefinition.find_by_name(tag_definition_name)
|
@@ -351,8 +362,8 @@ describe KillBillClient::Model do
|
|
351
362
|
end
|
352
363
|
|
353
364
|
it 'should manipulate tenants', :integration => true do
|
354
|
-
api_key =
|
355
|
-
api_secret =
|
365
|
+
api_key = SecureRandom.uuid.to_s + rand(100).to_s
|
366
|
+
api_secret = api_key
|
356
367
|
|
357
368
|
tenant = KillBillClient::Model::Tenant.new
|
358
369
|
tenant.api_key = api_key
|
@@ -16,6 +16,11 @@ describe KillBillClient::Model::Resource do
|
|
16
16
|
expect(payment2.purchased_amount).to eq(12.42)
|
17
17
|
end
|
18
18
|
|
19
|
+
before do
|
20
|
+
KillBillClient.api_key = nil
|
21
|
+
KillBillClient.api_secret = nil
|
22
|
+
end
|
23
|
+
|
19
24
|
describe '#require_multi_tenant_options!' do
|
20
25
|
let(:message) { 'nothing' }
|
21
26
|
|
metadata
CHANGED
@@ -1,36 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Killbill core team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
15
|
-
requirements:
|
16
|
-
- - ">="
|
17
|
-
- !ruby/object:Gem::Version
|
18
|
-
version: 1.2.0
|
19
|
-
- - "<"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.0
|
22
|
-
name: json
|
23
|
-
prerelease: false
|
24
|
-
type: :runtime
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.2.0
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 2.0.0
|
33
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
34
15
|
requirement: !ruby/object:Gem::Requirement
|
35
16
|
requirements:
|
36
17
|
- - ">="
|
@@ -39,9 +20,8 @@ dependencies:
|
|
39
20
|
- - "<"
|
40
21
|
- !ruby/object:Gem::Version
|
41
22
|
version: 11.0.0
|
42
|
-
name: rake
|
43
|
-
prerelease: false
|
44
23
|
type: :development
|
24
|
+
prerelease: false
|
45
25
|
version_requirements: !ruby/object:Gem::Requirement
|
46
26
|
requirements:
|
47
27
|
- - ">="
|
@@ -51,14 +31,14 @@ dependencies:
|
|
51
31
|
- !ruby/object:Gem::Version
|
52
32
|
version: 11.0.0
|
53
33
|
- !ruby/object:Gem::Dependency
|
34
|
+
name: rspec
|
54
35
|
requirement: !ruby/object:Gem::Requirement
|
55
36
|
requirements:
|
56
37
|
- - "~>"
|
57
38
|
- !ruby/object:Gem::Version
|
58
39
|
version: '3.4'
|
59
|
-
name: rspec
|
60
|
-
prerelease: false
|
61
40
|
type: :development
|
41
|
+
prerelease: false
|
62
42
|
version_requirements: !ruby/object:Gem::Requirement
|
63
43
|
requirements:
|
64
44
|
- - "~>"
|
@@ -70,9 +50,8 @@ executables: []
|
|
70
50
|
extensions: []
|
71
51
|
extra_rdoc_files: []
|
72
52
|
files:
|
53
|
+
- ".circleci/config.yml"
|
73
54
|
- ".gitignore"
|
74
|
-
- ".travis-install-dependencies.sh"
|
75
|
-
- ".travis.yml"
|
76
55
|
- Gemfile
|
77
56
|
- README.md
|
78
57
|
- Rakefile
|
@@ -218,7 +197,7 @@ homepage: http://www.killbilling.org
|
|
218
197
|
licenses:
|
219
198
|
- Apache License (2.0)
|
220
199
|
metadata: {}
|
221
|
-
post_install_message:
|
200
|
+
post_install_message:
|
222
201
|
rdoc_options:
|
223
202
|
- "--exclude"
|
224
203
|
- "."
|
@@ -235,9 +214,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
214
|
- !ruby/object:Gem::Version
|
236
215
|
version: '0'
|
237
216
|
requirements: []
|
238
|
-
rubyforge_project:
|
239
|
-
rubygems_version: 2.
|
240
|
-
signing_key:
|
217
|
+
rubyforge_project:
|
218
|
+
rubygems_version: 2.6.13
|
219
|
+
signing_key:
|
241
220
|
specification_version: 4
|
242
221
|
summary: Kill Bill client library.
|
243
222
|
test_files: []
|
@@ -1,81 +0,0 @@
|
|
1
|
-
#!/usr/bin/env sh
|
2
|
-
|
3
|
-
travis_retry() {
|
4
|
-
local result=0
|
5
|
-
local count=1
|
6
|
-
while [ $count -le 3 ]; do
|
7
|
-
[ $result -ne 0 ] && {
|
8
|
-
echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2
|
9
|
-
}
|
10
|
-
"$@" && { result=0 && break; } || result=$?
|
11
|
-
count=$(($count + 1))
|
12
|
-
sleep 1
|
13
|
-
done
|
14
|
-
[ $count -gt 3 ] && {
|
15
|
-
echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2
|
16
|
-
}
|
17
|
-
return $result
|
18
|
-
}
|
19
|
-
|
20
|
-
sudo sysctl -w net.ipv4.tcp_fin_timeout=15
|
21
|
-
sudo sysctl -w net.ipv4.tcp_tw_reuse=1
|
22
|
-
|
23
|
-
if [ "$DB_ADAPTER" = 'mysql2' ] || [ "$DB_ADAPTER" = 'mariadb' ]; then
|
24
|
-
mysql -u $DB_USER -e 'create database killbill;'
|
25
|
-
curl 'http://docs.killbill.io/0.18/ddl.sql' | mysql -u $DB_USER killbill
|
26
|
-
elif [ "$DB_ADAPTER" = 'postgresql' ]; then
|
27
|
-
psql -U $DB_USER -c 'create database killbill;'
|
28
|
-
curl 'https://raw.githubusercontent.com/killbill/killbill/master/util/src/main/resources/org/killbill/billing/util/ddl-postgresql.sql' | psql -U $DB_USER killbill
|
29
|
-
curl 'https://raw.githubusercontent.com/killbill/killbill/master/util/src/main/resources/org/killbill/billing/util/ddl-postgresql.sql' | psql -U $DB_USER kaui_test
|
30
|
-
curl 'http://docs.killbill.io/0.18/ddl.sql' | psql -U $DB_USER killbill
|
31
|
-
fi
|
32
|
-
|
33
|
-
travis_retry curl -L -O https://search.maven.org/remotecontent?filepath=org/kill-bill/billing/installer/kpm/0.6.0/kpm-0.6.0-linux-x86_64.tar.gz
|
34
|
-
tar zxf kpm-0.6.0-linux-x86_64.tar.gz
|
35
|
-
kpm-0.6.0-linux-x86_64/kpm install
|
36
|
-
|
37
|
-
if [ "$DB_ADAPTER" = 'mysql2' ] || [ "$DB_ADAPTER" = 'mariadb' ]; then
|
38
|
-
cat<<EOS >> conf/catalina.properties
|
39
|
-
org.killbill.dao.url=jdbc:mysql://127.0.0.1:$DB_PORT/killbill
|
40
|
-
org.killbill.billing.osgi.dao.url=jdbc:mysql://127.0.0.1:$DB_PORT/killbill
|
41
|
-
EOS
|
42
|
-
elif [ "$DB_ADAPTER" = 'postgresql' ]; then
|
43
|
-
cat<<EOS >> conf/catalina.properties
|
44
|
-
org.killbill.dao.url=jdbc:postgresql://127.0.0.1:$DB_PORT/killbill
|
45
|
-
org.killbill.billing.osgi.dao.url=jdbc:postgresql://127.0.0.1:$DB_PORT/killbill
|
46
|
-
EOS
|
47
|
-
fi
|
48
|
-
|
49
|
-
cat<<EOS >> conf/catalina.properties
|
50
|
-
org.killbill.dao.user=$DB_USER
|
51
|
-
org.killbill.dao.password=
|
52
|
-
org.killbill.billing.osgi.dao.user=$DB_USER
|
53
|
-
org.killbill.billing.osgi.dao.password=
|
54
|
-
org.killbill.catalog.uri=SpyCarAdvanced.xml
|
55
|
-
org.killbill.server.test.mode=true
|
56
|
-
EOS
|
57
|
-
|
58
|
-
./bin/catalina.sh start
|
59
|
-
|
60
|
-
TIME_LIMIT=$(( $(date +%s) + 120 ))
|
61
|
-
RET=0
|
62
|
-
while [ $RET != 201 -a $(date +%s) -lt $TIME_LIMIT ] ; do
|
63
|
-
RET=$(curl -s \
|
64
|
-
-o /dev/null \
|
65
|
-
-w "%{http_code}" \
|
66
|
-
-X POST \
|
67
|
-
-u 'admin:password' \
|
68
|
-
-H 'Content-Type:application/json' \
|
69
|
-
-H 'X-Killbill-CreatedBy:admin' \
|
70
|
-
-d '{"apiKey":"bob", "apiSecret":"lazar"}' \
|
71
|
-
"http://127.0.0.1:8080/1.0/kb/tenants?useGlobalDefault=true")
|
72
|
-
tail -50 logs/catalina.out
|
73
|
-
sleep 5
|
74
|
-
done
|
75
|
-
|
76
|
-
# For Travis debugging
|
77
|
-
echo "*** conf/catalina.properties"
|
78
|
-
cat conf/catalina.properties
|
79
|
-
|
80
|
-
echo "*** logs/catalina.out"
|
81
|
-
tail -50 logs/catalina.out
|
data/.travis.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
sudo: required
|
4
|
-
cache: bundler
|
5
|
-
|
6
|
-
services:
|
7
|
-
- mysql
|
8
|
-
|
9
|
-
dist: trusty
|
10
|
-
|
11
|
-
before_install:
|
12
|
-
- jdk_switcher use openjdk8
|
13
|
-
- gem update --system
|
14
|
-
- gem update bundler
|
15
|
-
- ./.travis-install-dependencies.sh
|
16
|
-
|
17
|
-
before_script:
|
18
|
-
- jdk_switcher use $JDK
|
19
|
-
|
20
|
-
script: 'bundle exec rake test:spec test:remote:spec'
|
21
|
-
|
22
|
-
notifications:
|
23
|
-
email:
|
24
|
-
- kill-bill-commits@googlegroups.com
|
25
|
-
|
26
|
-
env:
|
27
|
-
global:
|
28
|
-
- DB_ADAPTER=mariadb DB_USER='root' DB_PORT=3306 JRUBY_OPTS='-J-Xmx1024m --debug -J-Djava.security.egd=file:/dev/./urandom'
|
29
|
-
|
30
|
-
matrix:
|
31
|
-
include:
|
32
|
-
# Legacy environments
|
33
|
-
- rvm: ree-1.8.7-2011.12
|
34
|
-
- rvm: 1.8.7
|
35
|
-
- rvm: 1.9.3
|
36
|
-
# KPM
|
37
|
-
- rvm: 2.2.2
|
38
|
-
# Kaui
|
39
|
-
- rvm: 2.4.2
|
40
|
-
# Kaui standalone
|
41
|
-
- rvm: jruby-9.1.14.0
|
42
|
-
# Plugins
|
43
|
-
- rvm: jruby-1.7.26
|
44
|
-
fast_finish: true
|