killbill 9.3.0 → 9.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +138 -0
  3. data/Gemfile.lock +1 -1
  4. data/Jarfile +10 -10
  5. data/Jarfile.lock +23 -23
  6. data/NEWS +9 -0
  7. data/lib/killbill.rb +1 -1
  8. data/lib/killbill/gen/api/account_user_api.rb +54 -0
  9. data/lib/killbill/gen/api/audit_log_with_history.rb +138 -0
  10. data/lib/killbill/gen/api/custom_field_user_api.rb +23 -0
  11. data/lib/killbill/gen/api/dry_run_arguments.rb +6 -25
  12. data/lib/killbill/gen/api/entitlement_api.rb +8 -26
  13. data/lib/killbill/gen/api/entitlement_specifier.rb +7 -1
  14. data/lib/killbill/gen/api/health_status.rb +78 -0
  15. data/lib/killbill/gen/api/healthcheck.rb +53 -0
  16. data/lib/killbill/gen/api/invoice_item.rb +13 -1
  17. data/lib/killbill/gen/api/invoice_item_formatter.rb +13 -1
  18. data/lib/killbill/gen/api/invoice_payment_api.rb +224 -30
  19. data/lib/killbill/gen/api/invoice_user_api.rb +145 -18
  20. data/lib/killbill/gen/api/osgi_killbill.rb +2 -2
  21. data/lib/killbill/gen/api/payment_api.rb +125 -0
  22. data/lib/killbill/gen/api/plugin_config.rb +19 -0
  23. data/lib/killbill/gen/api/require_gen.rb +4 -8
  24. data/lib/killbill/gen/api/security_api.rb +12 -8
  25. data/lib/killbill/gen/api/tag_user_api.rb +46 -0
  26. data/lib/killbill/gen/plugin-api/invoice_notification_metadata.rb +81 -0
  27. data/lib/killbill/gen/plugin-api/require_gen.rb +1 -0
  28. data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +16 -5
  29. data/lib/killbill/version.rb +1 -1
  30. data/spec/killbill/helpers/response_spec.rb +7 -0
  31. data/spec/killbill/helpers/test_response.rb +4 -0
  32. metadata +9 -36
  33. data/.travis.yml +0 -51
@@ -181,15 +181,19 @@ module Killbill
181
181
 
182
182
  # conversion for tenantContext [type = org.killbill.billing.util.callcontext.TenantContext]
183
183
  tenantContext = tenantContext.to_java unless tenantContext.nil?
184
- res = @real_java_api.get_user_roles(username, tenantContext)
185
- # conversion for res [type = java.util.List]
186
- tmp = []
187
- (res || []).each do |m|
188
- # conversion for m [type = java.lang.String]
189
- tmp << m
184
+ begin
185
+ res = @real_java_api.get_user_roles(username, tenantContext)
186
+ # conversion for res [type = java.util.List]
187
+ tmp = []
188
+ (res || []).each do |m|
189
+ # conversion for m [type = java.lang.String]
190
+ tmp << m
191
+ end
192
+ res = tmp
193
+ return res
194
+ rescue Java::org.killbill.billing.security.SecurityApiException => e
195
+ raise Killbill::Plugin::Model::SecurityApiException.new.to_ruby(e)
190
196
  end
191
- res = tmp
192
- return res
193
197
  end
194
198
 
195
199
  java_signature 'Java::void addRoleDefinition(Java::java.lang.String, Java::java.util.List, Java::org.killbill.billing.util.callcontext.CallContext)'
@@ -324,6 +324,52 @@ module Killbill
324
324
  res = tmp
325
325
  return res
326
326
  end
327
+
328
+ java_signature 'Java::java.util.List getTagAuditLogsWithHistoryForId(Java::java.util.UUID, Java::org.killbill.billing.util.api.AuditLevel, Java::org.killbill.billing.util.callcontext.TenantContext)'
329
+ def get_tag_audit_logs_with_history_for_id(tagId, auditLevel, context)
330
+
331
+ # conversion for tagId [type = java.util.UUID]
332
+ tagId = java.util.UUID.fromString(tagId.to_s) unless tagId.nil?
333
+
334
+ # conversion for auditLevel [type = org.killbill.billing.util.api.AuditLevel]
335
+ auditLevel = Java::org.killbill.billing.util.api.AuditLevel.value_of( auditLevel.to_s ) unless auditLevel.nil?
336
+
337
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
338
+ context = context.to_java unless context.nil?
339
+ res = @real_java_api.get_tag_audit_logs_with_history_for_id(tagId, auditLevel, context)
340
+ # conversion for res [type = java.util.List]
341
+ tmp = []
342
+ (res || []).each do |m|
343
+ # conversion for m [type = org.killbill.billing.util.audit.AuditLogWithHistory]
344
+ m = Killbill::Plugin::Model::AuditLogWithHistory.new.to_ruby(m) unless m.nil?
345
+ tmp << m
346
+ end
347
+ res = tmp
348
+ return res
349
+ end
350
+
351
+ java_signature 'Java::java.util.List getTagDefinitionAuditLogsWithHistoryForId(Java::java.util.UUID, Java::org.killbill.billing.util.api.AuditLevel, Java::org.killbill.billing.util.callcontext.TenantContext)'
352
+ def get_tag_definition_audit_logs_with_history_for_id(tagDefinitionId, auditLevel, context)
353
+
354
+ # conversion for tagDefinitionId [type = java.util.UUID]
355
+ tagDefinitionId = java.util.UUID.fromString(tagDefinitionId.to_s) unless tagDefinitionId.nil?
356
+
357
+ # conversion for auditLevel [type = org.killbill.billing.util.api.AuditLevel]
358
+ auditLevel = Java::org.killbill.billing.util.api.AuditLevel.value_of( auditLevel.to_s ) unless auditLevel.nil?
359
+
360
+ # conversion for context [type = org.killbill.billing.util.callcontext.TenantContext]
361
+ context = context.to_java unless context.nil?
362
+ res = @real_java_api.get_tag_definition_audit_logs_with_history_for_id(tagDefinitionId, auditLevel, context)
363
+ # conversion for res [type = java.util.List]
364
+ tmp = []
365
+ (res || []).each do |m|
366
+ # conversion for m [type = org.killbill.billing.util.audit.AuditLogWithHistory]
367
+ m = Killbill::Plugin::Model::AuditLogWithHistory.new.to_ruby(m) unless m.nil?
368
+ tmp << m
369
+ end
370
+ res = tmp
371
+ return res
372
+ end
327
373
  end
328
374
  end
329
375
  end
@@ -0,0 +1,81 @@
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 Killbill
29
+ module Plugin
30
+ module Model
31
+
32
+ class InvoiceNotificationMetadata
33
+
34
+
35
+ attr_accessor :target_date, :amount_owed, :currency
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ # conversion for target_date [type = org.joda.time.DateTime]
42
+ if !@target_date.nil?
43
+ @target_date = (@target_date.kind_of? Time) ? DateTime.parse(@target_date.to_s) : @target_date
44
+ @target_date = Java::org.joda.time.DateTime.new(@target_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
45
+ end
46
+
47
+ # conversion for amount_owed [type = java.math.BigDecimal]
48
+ if @amount_owed.nil?
49
+ @amount_owed = java.math.BigDecimal::ZERO
50
+ else
51
+ @amount_owed = java.math.BigDecimal.new(@amount_owed.to_s)
52
+ end
53
+
54
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
55
+ @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?
56
+ Java::org.killbill.billing.notification.plugin.api.InvoiceNotificationMetadata.new(@target_date, @amount_owed, @currency)
57
+ end
58
+
59
+ def to_ruby(j_obj)
60
+ # conversion for target_date [type = org.joda.time.DateTime]
61
+ @target_date = j_obj.target_date
62
+ if !@target_date.nil?
63
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
64
+ str = fmt.print(@target_date)
65
+ @target_date = DateTime.iso8601(str)
66
+ end
67
+
68
+ # conversion for amount_owed [type = java.math.BigDecimal]
69
+ @amount_owed = j_obj.amount_owed
70
+ @amount_owed = @amount_owed.nil? ? 0 : BigDecimal.new(@amount_owed.to_s)
71
+
72
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
73
+ @currency = j_obj.currency
74
+ @currency = @currency.to_s.to_sym unless @currency.nil?
75
+ self
76
+ end
77
+
78
+ end
79
+ end
80
+ end
81
+ end
@@ -31,6 +31,7 @@ require 'killbill/gen/plugin-api/payment_plugin_api_exception'
31
31
  require 'killbill/gen/plugin-api/blocking_state_metadata'
32
32
  require 'killbill/gen/plugin-api/broadcast_metadata'
33
33
  require 'killbill/gen/plugin-api/ext_bus_event'
34
+ require 'killbill/gen/plugin-api/invoice_notification_metadata'
34
35
  require 'killbill/gen/plugin-api/invoice_payment_metadata'
35
36
  require 'killbill/gen/plugin-api/notification_plugin_api'
36
37
  require 'killbill/gen/plugin-api/notification_plugin_api_retry_exception'
@@ -22,6 +22,7 @@ module Killbill
22
22
  # But regardless, for performance reasons, we want to set these timestamps ourselves
23
23
  # See ActiveRecord::Timestamp
24
24
  current_time = Time.now.utc
25
+ remove_sensitive_data_and_compact(extra_params)
25
26
  model.new({
26
27
  :api_call => api_call,
27
28
  :kb_account_id => kb_account_id,
@@ -43,7 +44,7 @@ module Killbill
43
44
  :success => response.success?,
44
45
  :created_at => current_time,
45
46
  :updated_at => current_time
46
- }.merge!(extra_params.compact)) # Don't override with nil values
47
+ }.merge!(extra_params))
47
48
  end
48
49
 
49
50
  def self.create_response_and_transaction(identifier, transaction_model, api_call, kb_account_id, kb_payment_id, kb_payment_transaction_id, transaction_type, payment_processor_account_id, kb_tenant_id, gw_response, amount_in_cents, currency, extra_params = {}, model = Response)
@@ -159,9 +160,9 @@ module Killbill
159
160
  def self.search_where_clause(t, search_key)
160
161
  # Exact matches only
161
162
  where_clause = t[:kb_payment_id].eq(search_key)
162
- .or(t[:kb_payment_transaction_id].eq(search_key))
163
- .or(t[:message].eq(search_key))
164
- .or(t[:authorization].eq(search_key))
163
+ .or(t[:kb_payment_transaction_id].eq(search_key))
164
+ .or(t[:message].eq(search_key))
165
+ .or(t[:authorization].eq(search_key))
165
166
 
166
167
  # Only search successful payments and refunds
167
168
  where_clause = where_clause.and(t[:success].eq(true))
@@ -207,6 +208,16 @@ module Killbill
207
208
  pagination
208
209
  end
209
210
 
211
+ def self.remove_sensitive_data_and_compact(extra_params)
212
+ extra_params.compact!
213
+ extra_params.delete_if { |k, _| sensitive_fields.include?(k) }
214
+ end
215
+
216
+ # Override in your plugin if needed
217
+ def self.sensitive_fields
218
+ []
219
+ end
220
+
210
221
  # Override in your plugin if needed
211
222
  def txn_id
212
223
  authorization
@@ -289,4 +300,4 @@ module Killbill
289
300
  end
290
301
  end
291
302
  end
292
- end
303
+ end
@@ -1,3 +1,3 @@
1
1
  module Killbill
2
- VERSION = '9.3.0'
2
+ VERSION = '9.3.1'
3
3
  end
@@ -135,6 +135,13 @@ describe Killbill::Plugin::ActiveMerchant::ActiveRecord::Response do
135
135
  ::Killbill::Test::TestResponse.from_kb_payment_id(::Killbill::Test::TestTransaction, kb_payment_id3, kb_tenant_id).size == 0
136
136
  end
137
137
 
138
+ it 'should filter out sensitive parameter if specified' do
139
+ extra_params = {:email => "test.test", :payer_id => "test"}
140
+ ::Killbill::Test::TestResponse.send(:remove_sensitive_data_and_compact, extra_params)
141
+ extra_params[:email].should be_nil
142
+ extra_params[:payer_id].should == "test"
143
+ end
144
+
138
145
  it 'should generate the right SQL query' do
139
146
  # Check count query (search query numeric)
140
147
  expected_query = "SELECT COUNT(DISTINCT #{q('test_responses')}.#{q('id')}) FROM #{q('test_responses')} WHERE (((#{q('test_responses')}.#{q('kb_payment_id')} = '1234' OR #{q('test_responses')}.#{q('kb_payment_transaction_id')} = '1234') OR #{q('test_responses')}.#{q('message')} = '1234') OR #{q('test_responses')}.#{q('authorization')} = '1234') AND #{q('test_responses')}.#{q('success')} = #{qtrue} AND #{q('test_responses')}.#{q('kb_tenant_id')} = '11-22-33'"
@@ -6,6 +6,10 @@ module Killbill #:nodoc:
6
6
 
7
7
  has_one :test_transaction
8
8
 
9
+ def self.sensitive_fields
10
+ [:email]
11
+ end
12
+
9
13
  end
10
14
  end
11
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.3.0
4
+ version: 9.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-21 00:00:00.000000000 Z
11
+ date: 2018-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -317,8 +317,8 @@ executables:
317
317
  extensions: []
318
318
  extra_rdoc_files: []
319
319
  files:
320
+ - ".circleci/config.yml"
320
321
  - ".gitignore"
321
- - ".travis.yml"
322
322
  - Gemfile
323
323
  - Gemfile.head
324
324
  - Gemfile.lock
@@ -376,6 +376,7 @@ files:
376
376
  - lib/killbill/gen/api/account_user_api.rb
377
377
  - lib/killbill/gen/api/admin_payment_api.rb
378
378
  - lib/killbill/gen/api/audit_log.rb
379
+ - lib/killbill/gen/api/audit_log_with_history.rb
379
380
  - lib/killbill/gen/api/audit_user_api.rb
380
381
  - lib/killbill/gen/api/base_entitlement_with_add_ons_specifier.rb
381
382
  - lib/killbill/gen/api/billing_exception_base.rb
@@ -420,6 +421,8 @@ files:
420
421
  - lib/killbill/gen/api/entity.rb
421
422
  - lib/killbill/gen/api/enumerator_iterator.rb
422
423
  - lib/killbill/gen/api/fixed.rb
424
+ - lib/killbill/gen/api/health_status.rb
425
+ - lib/killbill/gen/api/healthcheck.rb
423
426
  - lib/killbill/gen/api/illegal_plan_change.rb
424
427
  - lib/killbill/gen/api/immutable_account_data.rb
425
428
  - lib/killbill/gen/api/international_price.rb
@@ -472,6 +475,7 @@ files:
472
475
  - lib/killbill/gen/api/plan_phase_specifier.rb
473
476
  - lib/killbill/gen/api/plan_rules.rb
474
477
  - lib/killbill/gen/api/plan_specifier.rb
478
+ - lib/killbill/gen/api/plugin_config.rb
475
479
  - lib/killbill/gen/api/plugin_config_service_api.rb
476
480
  - lib/killbill/gen/api/plugin_info.rb
477
481
  - lib/killbill/gen/api/plugin_node_command_metadata.rb
@@ -533,6 +537,7 @@ files:
533
537
  - lib/killbill/gen/plugin-api/gateway_notification.rb
534
538
  - lib/killbill/gen/plugin-api/hosted_payment_page_form_descriptor.rb
535
539
  - lib/killbill/gen/plugin-api/invoice_context.rb
540
+ - lib/killbill/gen/plugin-api/invoice_notification_metadata.rb
536
541
  - lib/killbill/gen/plugin-api/invoice_payment_metadata.rb
537
542
  - lib/killbill/gen/plugin-api/invoice_plugin_api.rb
538
543
  - lib/killbill/gen/plugin-api/invoice_plugin_api_retry_exception.rb
@@ -649,36 +654,4 @@ rubygems_version: 2.4.8
649
654
  signing_key:
650
655
  specification_version: 4
651
656
  summary: Framework to write Kill Bill plugins in Ruby.
652
- test_files:
653
- - spec/killbill/base_plugin_spec.rb
654
- - spec/killbill/config_test.ru
655
- - spec/killbill/gen_conversions_spec.rb
656
- - spec/killbill/helpers/configuration_spec.rb
657
- - spec/killbill/helpers/connection_spec.rb
658
- - spec/killbill/helpers/killbill_spec_helper_spec.rb
659
- - spec/killbill/helpers/payment_method_spec.rb
660
- - spec/killbill/helpers/payment_plugin_spec.rb
661
- - spec/killbill/helpers/private_payment_plugin_spec.rb
662
- - spec/killbill/helpers/response_spec.rb
663
- - spec/killbill/helpers/streamy_result_set_spec.rb
664
- - spec/killbill/helpers/test_payment_method.rb
665
- - spec/killbill/helpers/test_response.rb
666
- - spec/killbill/helpers/test_schema.rb
667
- - spec/killbill/helpers/test_transaction.rb
668
- - spec/killbill/helpers/transaction_spec.rb
669
- - spec/killbill/helpers/utils_spec.rb
670
- - spec/killbill/invoice_plugin_api_spec.rb
671
- - spec/killbill/invoice_plugin_spec.rb
672
- - spec/killbill/invoice_test.rb
673
- - spec/killbill/killbill_integration_spec.rb
674
- - spec/killbill/killbill_logger_spec.rb
675
- - spec/killbill/killbillapi_spec.rb
676
- - spec/killbill/notification_plugin_api_spec.rb
677
- - spec/killbill/notification_plugin_spec.rb
678
- - spec/killbill/notification_test.rb
679
- - spec/killbill/payment_plugin_api_spec.rb
680
- - spec/killbill/payment_plugin_spec.rb
681
- - spec/killbill/payment_test.rb
682
- - spec/killbill/rack_handler_spec.rb
683
- - spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
684
- - spec/spec_helper.rb
657
+ test_files: []
@@ -1,51 +0,0 @@
1
- language: ruby
2
-
3
- sudo: false
4
- cache:
5
- bundler: true
6
- directories:
7
- - $HOME/.m2
8
-
9
- services:
10
- - mysql
11
- - postgresql
12
-
13
- before_script:
14
- - bundle exec jbundle install
15
- - mysql -uroot -e 'create database killbill_test;'
16
- - psql -c 'create database killbill_test;' -U postgres
17
-
18
- notifications:
19
- email:
20
- - kill-bill-commits@googlegroups.com
21
-
22
- env:
23
- global:
24
- - JRUBY_OPTS='-J-Xmx1024M'
25
- matrix:
26
- # Need MySQL 5.6 - see https://github.com/travis-ci/travis-ci/issues/1986
27
- #- AR_ADAPTER='mariadb' AR_USERNAME='root' AR_PASSWORD='' AR_DATABASE='killbill_test'
28
- - AR_ADAPTER='postgresql' AR_USERNAME='postgres' AR_DATABASE='killbill_test'
29
- - AR_ADAPTER='sqlite3' AR_DATABASE='test.db'
30
-
31
- rvm:
32
- - jruby-1.7.20
33
- - jruby-20mode # latest 1.7.x
34
- - jruby-head
35
-
36
- gemfile:
37
- - Gemfile
38
- - Gemfile.head
39
-
40
- jdk:
41
- - openjdk7
42
- - oraclejdk7
43
- - oraclejdk8
44
-
45
- matrix:
46
- allow_failures:
47
- - rvm: jruby-head
48
- - rvm: jruby-20mode # Gemfile.lock bug with --deployment?
49
- - jdk: oraclejdk8
50
- - gemfile: Gemfile.head
51
- fast_finish: true