killbill 8.2.0 → 8.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -0
  3. data/Gemfile.lock +8 -6
  4. data/Jarfile +10 -10
  5. data/Jarfile.lock +23 -23
  6. data/NEWS +7 -0
  7. data/README.md +10 -15
  8. data/generators/active_merchant/templates/spec/spec_helper.rb +9 -5
  9. data/killbill.gemspec +1 -0
  10. data/lib/killbill/gen/api/account.rb +7 -1
  11. data/lib/killbill/gen/api/account_data.rb +7 -1
  12. data/lib/killbill/gen/api/base_entitlement_with_add_ons_specifier.rb +117 -0
  13. data/lib/killbill/gen/api/catalog_user_api.rb +14 -0
  14. data/lib/killbill/gen/api/entitlement_api.rb +15 -25
  15. data/lib/killbill/gen/api/mutable_account_data.rb +7 -1
  16. data/lib/killbill/gen/api/mutable_static_catalog.rb +10 -10
  17. data/lib/killbill/gen/api/payment_api.rb +44 -0
  18. data/lib/killbill/gen/api/price_list.rb +5 -5
  19. data/lib/killbill/gen/api/product.rb +11 -11
  20. data/lib/killbill/gen/api/require_gen.rb +1 -0
  21. data/lib/killbill/gen/api/simple_plan_descriptor.rb +28 -3
  22. data/lib/killbill/gen/api/static_catalog.rb +10 -10
  23. data/lib/killbill/gen/api/tenant_user_api.rb +32 -0
  24. data/lib/killbill/gen/plugin-api/payment_metadata.rb +102 -0
  25. data/lib/killbill/gen/plugin-api/require_gen.rb +3 -7
  26. data/lib/killbill/gen/plugin-api/subscription_metadata.rb +56 -0
  27. data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +0 -1
  28. data/lib/killbill/helpers/active_merchant/payment_plugin.rb +6 -1
  29. data/lib/killbill/migration.rb +13 -2
  30. data/lib/killbill/version.rb +1 -1
  31. data/spec/killbill/helpers/payment_method_spec.rb +8 -8
  32. data/spec/killbill/helpers/payment_plugin_spec.rb +13 -0
  33. data/spec/killbill/helpers/response_spec.rb +4 -4
  34. data/spec/killbill/killbill_integration_spec.rb +3 -1
  35. data/spec/spec_helper.rb +1 -1
  36. metadata +19 -2
@@ -0,0 +1,102 @@
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 PaymentMetadata
33
+
34
+
35
+ attr_accessor :payment_transaction_id, :amount, :currency, :status, :transaction_type, :effective_date
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ # conversion for payment_transaction_id [type = java.util.UUID]
42
+ @payment_transaction_id = java.util.UUID.fromString(@payment_transaction_id.to_s) unless @payment_transaction_id.nil?
43
+
44
+ # conversion for amount [type = java.math.BigDecimal]
45
+ if @amount.nil?
46
+ @amount = java.math.BigDecimal::ZERO
47
+ else
48
+ @amount = java.math.BigDecimal.new(@amount.to_s)
49
+ end
50
+
51
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
52
+ @currency = Java::org.killbill.billing.catalog.api.Currency.value_of( @currency.to_s ) unless @currency.nil?
53
+
54
+ # conversion for status [type = org.killbill.billing.payment.api.TransactionStatus]
55
+ @status = Java::org.killbill.billing.payment.api.TransactionStatus.value_of( @status.to_s ) unless @status.nil?
56
+
57
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
58
+ @transaction_type = Java::org.killbill.billing.payment.api.TransactionType.value_of( @transaction_type.to_s ) unless @transaction_type.nil?
59
+
60
+ # conversion for effective_date [type = org.joda.time.DateTime]
61
+ if !@effective_date.nil?
62
+ @effective_date = (@effective_date.kind_of? Time) ? DateTime.parse(@effective_date.to_s) : @effective_date
63
+ @effective_date = Java::org.joda.time.DateTime.new(@effective_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
64
+ end
65
+ Java::org.killbill.billing.notification.plugin.api.PaymentMetadata.new(@payment_transaction_id, @amount, @currency, @status, @transaction_type, @effective_date)
66
+ end
67
+
68
+ def to_ruby(j_obj)
69
+ # conversion for payment_transaction_id [type = java.util.UUID]
70
+ @payment_transaction_id = j_obj.payment_transaction_id
71
+ @payment_transaction_id = @payment_transaction_id.nil? ? nil : @payment_transaction_id.to_s
72
+
73
+ # conversion for amount [type = java.math.BigDecimal]
74
+ @amount = j_obj.amount
75
+ @amount = @amount.nil? ? 0 : BigDecimal.new(@amount.to_s)
76
+
77
+ # conversion for currency [type = org.killbill.billing.catalog.api.Currency]
78
+ @currency = j_obj.currency
79
+ @currency = @currency.to_s.to_sym unless @currency.nil?
80
+
81
+ # conversion for status [type = org.killbill.billing.payment.api.TransactionStatus]
82
+ @status = j_obj.status
83
+ @status = @status.to_s.to_sym unless @status.nil?
84
+
85
+ # conversion for transaction_type [type = org.killbill.billing.payment.api.TransactionType]
86
+ @transaction_type = j_obj.transaction_type
87
+ @transaction_type = @transaction_type.to_s.to_sym unless @transaction_type.nil?
88
+
89
+ # conversion for effective_date [type = org.joda.time.DateTime]
90
+ @effective_date = j_obj.effective_date
91
+ if !@effective_date.nil?
92
+ fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
93
+ str = fmt.print(@effective_date)
94
+ @effective_date = DateTime.iso8601(str)
95
+ end
96
+ self
97
+ end
98
+
99
+ end
100
+ end
101
+ end
102
+ end
@@ -32,8 +32,9 @@ 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
34
  require 'killbill/gen/plugin-api/notification_plugin_api'
35
+ require 'killbill/gen/plugin-api/payment_metadata'
36
+ require 'killbill/gen/plugin-api/subscription_metadata'
35
37
  require 'killbill/gen/plugin-api/invoice_plugin_api'
36
- require 'killbill/gen/plugin-api/currency_plugin_api'
37
38
  require 'killbill/gen/plugin-api/control_result'
38
39
  require 'killbill/gen/plugin-api/on_failure_payment_control_result'
39
40
  require 'killbill/gen/plugin-api/on_success_payment_control_result'
@@ -44,12 +45,7 @@ require 'killbill/gen/plugin-api/prior_payment_control_result'
44
45
  require 'killbill/gen/plugin-api/catalog_plugin_api'
45
46
  require 'killbill/gen/plugin-api/standalone_plugin_catalog'
46
47
  require 'killbill/gen/plugin-api/versioned_plugin_catalog'
47
- require 'killbill/gen/plugin-api/entitlement_context'
48
- require 'killbill/gen/plugin-api/entitlement_plugin_api'
49
- require 'killbill/gen/plugin-api/entitlement_plugin_api_exception'
50
- require 'killbill/gen/plugin-api/on_failure_entitlement_result'
51
- require 'killbill/gen/plugin-api/on_success_entitlement_result'
52
- require 'killbill/gen/plugin-api/prior_entitlement_result'
48
+ require 'killbill/gen/plugin-api/currency_plugin_api'
53
49
  require 'killbill/gen/plugin-api/gateway_notification'
54
50
  require 'killbill/gen/plugin-api/hosted_payment_page_form_descriptor'
55
51
  require 'killbill/gen/plugin-api/payment_transaction_info_plugin'
@@ -0,0 +1,56 @@
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 SubscriptionMetadata
33
+
34
+
35
+ attr_accessor :action_type
36
+
37
+ def initialize()
38
+ end
39
+
40
+ def to_java()
41
+ # conversion for action_type [type = org.killbill.billing.notification.plugin.api.ActionType]
42
+ @action_type = Java::org.killbill.billing.notification.plugin.api.ActionType.value_of( @action_type.to_s ) unless @action_type.nil?
43
+ Java::org.killbill.billing.notification.plugin.api.SubscriptionMetadata.new(@action_type)
44
+ end
45
+
46
+ def to_ruby(j_obj)
47
+ # conversion for action_type [type = org.killbill.billing.notification.plugin.api.ActionType]
48
+ @action_type = j_obj.action_type
49
+ @action_type = @action_type.to_s.to_sym unless @action_type.nil?
50
+ self
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+ end
@@ -162,7 +162,6 @@ module Killbill
162
162
  .or(t[:kb_payment_transaction_id].eq(search_key))
163
163
  .or(t[:message].eq(search_key))
164
164
  .or(t[:authorization].eq(search_key))
165
- .or(t[:fraud_review].eq(search_key))
166
165
 
167
166
  # Only search successful payments and refunds
168
167
  where_clause = where_clause.and(t[:success].eq(true))
@@ -86,7 +86,12 @@ module Killbill
86
86
 
87
87
  # Go to the gateway - while some gateways implementations are smart and have void support 'auth_reversal' and 'void' (e.g. Litle),
88
88
  # others (e.g. CyberSource) implement different methods
89
- linked_transaction.transaction_type == 'AUTHORIZE' && gateway.respond_to?(:auth_reversal) ? gateway.auth_reversal(linked_transaction.amount_in_cents, authorization, options) : gateway.void(authorization, options)
89
+ if linked_transaction.transaction_type == 'AUTHORIZE' && gateway.respond_to?(:auth_reversal)
90
+ options[:currency] ||= linked_transaction.currency
91
+ gateway.auth_reversal(linked_transaction.amount_in_cents, authorization, options)
92
+ else
93
+ gateway.void(authorization, options)
94
+ end
90
95
  end
91
96
 
92
97
  linked_transaction_proc = Proc.new do |amount_in_cents, options|
@@ -3,8 +3,19 @@ require 'logger'
3
3
  require 'active_record'
4
4
  require 'arjdbc'
5
5
 
6
- require 'jdbc/mariadb'
7
- Jdbc::MariaDB.load_driver
6
+ begin
7
+ require 'jdbc/mariadb'
8
+ Jdbc::MariaDB.load_driver
9
+ rescue LoadError
10
+ # ignored
11
+ end
12
+
13
+ begin
14
+ require 'jdbc/postgres'
15
+ Jdbc::Postgres.load_driver
16
+ rescue LoadError
17
+ # ignored
18
+ end
8
19
 
9
20
  module Killbill
10
21
  class Migration
@@ -1,3 +1,3 @@
1
1
  module Killbill
2
- VERSION = '8.2.0'
2
+ VERSION = '8.3.0'
3
3
  end
@@ -182,22 +182,22 @@ describe Killbill::Plugin::ActiveMerchant::ActiveRecord::PaymentMethod do
182
182
 
183
183
  it 'should generate the right SQL query' do
184
184
  # Check count query (search query numeric)
185
- expected_query = "SELECT COUNT(DISTINCT #{q('test_payment_methods')}.#{q('id')}) FROM #{q('test_payment_methods')} WHERE ((((((((((((((#{q('test_payment_methods')}.#{q('kb_account_id')} = '1234' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = '1234') OR #{q('test_payment_methods')}.#{q('token')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_type')} = '1234') OR #{q('test_payment_methods')}.#{q('state')} = '1234') OR #{q('test_payment_methods')}.#{q('zip')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_first_name')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('cc_last_name')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('address1')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('address2')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('city')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('country')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('cc_exp_month')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_exp_year')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_last_4')} = '1234') AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33'"
185
+ expected_query = /SELECT COUNT\(DISTINCT #{q('test_payment_methods')}.#{q('id')}\) FROM #{q('test_payment_methods')} WHERE \(\(\(\(\(\(\(\(\(\(\(\(\(\(#{q('test_payment_methods')}.#{q('kb_account_id')} = '1234' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = '1234'\) OR #{q('test_payment_methods')}.#{q('token')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_type')} = '1234'\) OR #{q('test_payment_methods')}.#{q('state')} = '1234'\) OR #{q('test_payment_methods')}.#{q('zip')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_first_name')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('cc_last_name')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('address1')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('address2')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('city')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('country')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('cc_exp_month')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_exp_year')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_last_4')} = '1234'\) AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33'/
186
186
  # Note that Kill Bill will pass a String, even for numeric types
187
- ::Killbill::Test::TestPaymentMethod.search_query('1234', '11-22-33').to_sql.should == expected_query
187
+ ::Killbill::Test::TestPaymentMethod.search_query('1234', '11-22-33').to_sql.should match(expected_query)
188
188
 
189
189
  # Check query with results (search query numeric)
190
- expected_query = "SELECT DISTINCT #{q('test_payment_methods')}.* FROM #{q('test_payment_methods')} WHERE ((((((((((((((#{q('test_payment_methods')}.#{q('kb_account_id')} = '1234' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = '1234') OR #{q('test_payment_methods')}.#{q('token')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_type')} = '1234') OR #{q('test_payment_methods')}.#{q('state')} = '1234') OR #{q('test_payment_methods')}.#{q('zip')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_first_name')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('cc_last_name')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('address1')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('address2')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('city')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('country')} LIKE '%1234%') OR #{q('test_payment_methods')}.#{q('cc_exp_month')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_exp_year')} = '1234') OR #{q('test_payment_methods')}.#{q('cc_last_4')} = '1234') AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33' ORDER BY #{q('test_payment_methods')}.#{q('id')} LIMIT 10 OFFSET 0"
190
+ expected_query = /SELECT DISTINCT #{q('test_payment_methods')}.* FROM #{q('test_payment_methods')} WHERE \(\(\(\(\(\(\(\(\(\(\(\(\(\(#{q('test_payment_methods')}.#{q('kb_account_id')} = '1234' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = '1234'\) OR #{q('test_payment_methods')}.#{q('token')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_type')} = '1234'\) OR #{q('test_payment_methods')}.#{q('state')} = '1234'\) OR #{q('test_payment_methods')}.#{q('zip')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_first_name')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('cc_last_name')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('address1')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('address2')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('city')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('country')} I?LIKE '%1234%'\) OR #{q('test_payment_methods')}.#{q('cc_exp_month')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_exp_year')} = '1234'\) OR #{q('test_payment_methods')}.#{q('cc_last_4')} = '1234'\) AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33' ORDER BY #{q('test_payment_methods')}.#{q('id')} LIMIT 10 OFFSET 0/
191
191
  # Note that Kill Bill will pass a String, even for numeric types
192
- ::Killbill::Test::TestPaymentMethod.search_query('1234', '11-22-33', 0, 10).to_sql.should == expected_query
192
+ ::Killbill::Test::TestPaymentMethod.search_query('1234', '11-22-33', 0, 10).to_sql.should match(expected_query)
193
193
 
194
194
  # Check count query (search query string)
195
- expected_query = "SELECT COUNT(DISTINCT #{q('test_payment_methods')}.#{q('id')}) FROM #{q('test_payment_methods')} WHERE (((((((((((#{q('test_payment_methods')}.#{q('kb_account_id')} = 'XXX' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = 'XXX') OR #{q('test_payment_methods')}.#{q('token')} = 'XXX') OR #{q('test_payment_methods')}.#{q('cc_type')} = 'XXX') OR #{q('test_payment_methods')}.#{q('state')} = 'XXX') OR #{q('test_payment_methods')}.#{q('zip')} = 'XXX') OR #{q('test_payment_methods')}.#{q('cc_first_name')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('cc_last_name')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('address1')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('address2')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('city')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('country')} LIKE '%XXX%') AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33'"
196
- ::Killbill::Test::TestPaymentMethod.search_query('XXX', '11-22-33').to_sql.should == expected_query
195
+ expected_query = /SELECT COUNT\(DISTINCT #{q('test_payment_methods')}.#{q('id')}\) FROM #{q('test_payment_methods')} WHERE \(\(\(\(\(\(\(\(\(\(\(#{q('test_payment_methods')}.#{q('kb_account_id')} = 'XXX' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('token')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('cc_type')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('state')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('zip')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('cc_first_name')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('cc_last_name')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('address1')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('address2')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('city')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('country')} I?LIKE '%XXX%'\) AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33'/
196
+ ::Killbill::Test::TestPaymentMethod.search_query('XXX', '11-22-33').to_sql.should match(expected_query)
197
197
 
198
198
  # Check query with results (search query string)
199
- expected_query = "SELECT DISTINCT #{q('test_payment_methods')}.* FROM #{q('test_payment_methods')} WHERE (((((((((((#{q('test_payment_methods')}.#{q('kb_account_id')} = 'XXX' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = 'XXX') OR #{q('test_payment_methods')}.#{q('token')} = 'XXX') OR #{q('test_payment_methods')}.#{q('cc_type')} = 'XXX') OR #{q('test_payment_methods')}.#{q('state')} = 'XXX') OR #{q('test_payment_methods')}.#{q('zip')} = 'XXX') OR #{q('test_payment_methods')}.#{q('cc_first_name')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('cc_last_name')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('address1')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('address2')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('city')} LIKE '%XXX%') OR #{q('test_payment_methods')}.#{q('country')} LIKE '%XXX%') AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33' ORDER BY #{q('test_payment_methods')}.#{q('id')} LIMIT 10 OFFSET 0"
200
- ::Killbill::Test::TestPaymentMethod.search_query('XXX', '11-22-33', 0, 10).to_sql.should == expected_query
199
+ expected_query = /SELECT DISTINCT #{q('test_payment_methods')}.* FROM #{q('test_payment_methods')} WHERE \(\(\(\(\(\(\(\(\(\(\(#{q('test_payment_methods')}.#{q('kb_account_id')} = 'XXX' OR #{q('test_payment_methods')}.#{q('kb_payment_method_id')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('token')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('cc_type')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('state')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('zip')} = 'XXX'\) OR #{q('test_payment_methods')}.#{q('cc_first_name')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('cc_last_name')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('address1')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('address2')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('city')} I?LIKE '%XXX%'\) OR #{q('test_payment_methods')}.#{q('country')} I?LIKE '%XXX%'\) AND #{q('test_payment_methods')}.#{q('kb_tenant_id')} = '11-22-33' ORDER BY #{q('test_payment_methods')}.#{q('id')} LIMIT 10 OFFSET 0/
200
+ ::Killbill::Test::TestPaymentMethod.search_query('XXX', '11-22-33', 0, 10).to_sql.should match(expected_query)
201
201
  end
202
202
 
203
203
  it 'should search all fields' do
@@ -531,6 +531,19 @@ describe Killbill::Plugin::ActiveMerchant::PaymentPlugin do
531
531
  ptip.gateway_error_code.should == ek.to_s
532
532
  end
533
533
  end
534
+
535
+ it 'returns UNDEFINED for HTTP code >= 300' do
536
+ msg = 'Proxy Error'
537
+ gateway.next_exception = ::ActiveMerchant::ResponseError.new(OpenStruct.new(:code => 502, :message => msg))
538
+
539
+ # Verify the purchase call for the Kill Bill payment state machine and the get_payment_info call for the Janitor
540
+ ptip = trigger_purchase
541
+ verify_purchase_status(ptip, :UNDEFINED)
542
+
543
+ # Check debugging fields
544
+ ptip.gateway_error.ends_with?(msg).should be_true
545
+ ptip.gateway_error_code.should == 'ActiveMerchant::ResponseError'
546
+ end
534
547
  end
535
548
 
536
549
  private
@@ -137,21 +137,21 @@ describe Killbill::Plugin::ActiveMerchant::ActiveRecord::Response do
137
137
 
138
138
  it 'should generate the right SQL query' do
139
139
  # Check count query (search query numeric)
140
- 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') OR #{q('test_responses')}.#{q('fraud_review')} = '1234') AND #{q('test_responses')}.#{q('success')} = #{qtrue} AND #{q('test_responses')}.#{q('kb_tenant_id')} = '11-22-33'"
140
+ 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'"
141
141
  # Note that Kill Bill will pass a String, even for numeric types
142
142
  ::Killbill::Test::TestResponse.search_query('1234', '11-22-33').to_sql.should == expected_query
143
143
 
144
144
  # Check query with results (search query numeric)
145
- expected_query = "SELECT DISTINCT #{q('test_responses')}.* 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') OR #{q('test_responses')}.#{q('fraud_review')} = '1234') AND #{q('test_responses')}.#{q('success')} = #{qtrue} AND #{q('test_responses')}.#{q('kb_tenant_id')} = '11-22-33' ORDER BY #{q('test_responses')}.#{q('id')} LIMIT 10 OFFSET 0"
145
+ expected_query = "SELECT DISTINCT #{q('test_responses')}.* 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' ORDER BY #{q('test_responses')}.#{q('id')} LIMIT 10 OFFSET 0"
146
146
  # Note that Kill Bill will pass a String, even for numeric types
147
147
  ::Killbill::Test::TestResponse.search_query('1234', '11-22-33', 0, 10).to_sql.should == expected_query
148
148
 
149
149
  # Check count query (search query string)
150
- expected_query = "SELECT COUNT(DISTINCT #{q('test_responses')}.#{q('id')}) FROM #{q('test_responses')} WHERE ((((#{q('test_responses')}.#{q('kb_payment_id')} = 'XXX' OR #{q('test_responses')}.#{q('kb_payment_transaction_id')} = 'XXX') OR #{q('test_responses')}.#{q('message')} = 'XXX') OR #{q('test_responses')}.#{q('authorization')} = 'XXX') OR #{q('test_responses')}.#{q('fraud_review')} = 'XXX') AND #{q('test_responses')}.#{q('success')} = #{qtrue} AND #{q('test_responses')}.#{q('kb_tenant_id')} = '11-22-33'"
150
+ expected_query = "SELECT COUNT(DISTINCT #{q('test_responses')}.#{q('id')}) FROM #{q('test_responses')} WHERE (((#{q('test_responses')}.#{q('kb_payment_id')} = 'XXX' OR #{q('test_responses')}.#{q('kb_payment_transaction_id')} = 'XXX') OR #{q('test_responses')}.#{q('message')} = 'XXX') OR #{q('test_responses')}.#{q('authorization')} = 'XXX') AND #{q('test_responses')}.#{q('success')} = #{qtrue} AND #{q('test_responses')}.#{q('kb_tenant_id')} = '11-22-33'"
151
151
  ::Killbill::Test::TestResponse.search_query('XXX', '11-22-33').to_sql.should == expected_query
152
152
 
153
153
  # Check query with results (search query string)
154
- expected_query = "SELECT DISTINCT #{q('test_responses')}.* FROM #{q('test_responses')} WHERE ((((#{q('test_responses')}.#{q('kb_payment_id')} = 'XXX' OR #{q('test_responses')}.#{q('kb_payment_transaction_id')} = 'XXX') OR #{q('test_responses')}.#{q('message')} = 'XXX') OR #{q('test_responses')}.#{q('authorization')} = 'XXX') OR #{q('test_responses')}.#{q('fraud_review')} = 'XXX') AND #{q('test_responses')}.#{q('success')} = #{qtrue} AND #{q('test_responses')}.#{q('kb_tenant_id')} = '11-22-33' ORDER BY #{q('test_responses')}.#{q('id')} LIMIT 10 OFFSET 0"
154
+ expected_query = "SELECT DISTINCT #{q('test_responses')}.* FROM #{q('test_responses')} WHERE (((#{q('test_responses')}.#{q('kb_payment_id')} = 'XXX' OR #{q('test_responses')}.#{q('kb_payment_transaction_id')} = 'XXX') OR #{q('test_responses')}.#{q('message')} = 'XXX') OR #{q('test_responses')}.#{q('authorization')} = 'XXX') AND #{q('test_responses')}.#{q('success')} = #{qtrue} AND #{q('test_responses')}.#{q('kb_tenant_id')} = '11-22-33' ORDER BY #{q('test_responses')}.#{q('id')} LIMIT 10 OFFSET 0"
155
155
  ::Killbill::Test::TestResponse.search_query('XXX', '11-22-33', 0, 10).to_sql.should == expected_query
156
156
  end
157
157
 
@@ -27,7 +27,8 @@ describe Killbill::Plugin do
27
27
  'stateOrProvince',
28
28
  'country',
29
29
  'postalCode',
30
- 'phone')
30
+ 'phone',
31
+ 'notes')
31
32
  account = @account_user_api.getAccountByKey('externalKey', nil)
32
33
  account.external_key.should == 'externalKey'
33
34
  account.email.should == 'email'
@@ -45,6 +46,7 @@ describe Killbill::Plugin do
45
46
  account.country.should == 'country'
46
47
  account.postal_code.should == 'postalCode'
47
48
  account.phone.should == 'phone'
49
+ account.notes.should == 'notes'
48
50
  end
49
51
  end
50
52
 
data/spec/spec_helper.rb CHANGED
@@ -80,7 +80,7 @@ module Killbill
80
80
  require File.expand_path(File.dirname(__FILE__) + '/killbill/helpers/test_schema.rb')
81
81
 
82
82
  # Required to have MySQL store milliseconds
83
- Time::DATE_FORMATS.merge!({ db: '%Y-%m-%d %H:%M:%S.%3N' })
83
+ Time::DATE_FORMATS.merge!({ db: '%Y-%m-%d %H:%M:%S.%3N' }) if %w(mariadb mysql).include?(ENV['AR_ADAPTER'])
84
84
  end
85
85
  end
86
86
  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: 8.2.0
4
+ version: 8.3.0
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: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -136,6 +136,20 @@ dependencies:
136
136
  version: 1.1.8
137
137
  prerelease: false
138
138
  type: :development
139
+ - !ruby/object:Gem::Dependency
140
+ name: jdbc-postgres
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: '9.4'
146
+ requirement: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ~>
149
+ - !ruby/object:Gem::Version
150
+ version: '9.4'
151
+ prerelease: false
152
+ type: :development
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: actionpack
141
155
  version_requirements: !ruby/object:Gem::Requirement
@@ -363,6 +377,7 @@ files:
363
377
  - lib/killbill/gen/api/admin_payment_api.rb
364
378
  - lib/killbill/gen/api/audit_log.rb
365
379
  - lib/killbill/gen/api/audit_user_api.rb
380
+ - lib/killbill/gen/api/base_entitlement_with_add_ons_specifier.rb
366
381
  - lib/killbill/gen/api/billing_exception_base.rb
367
382
  - lib/killbill/gen/api/block.rb
368
383
  - lib/killbill/gen/api/blockable.rb
@@ -516,6 +531,7 @@ files:
516
531
  - lib/killbill/gen/plugin-api/payment_control_api_exception.rb
517
532
  - lib/killbill/gen/plugin-api/payment_control_context.rb
518
533
  - lib/killbill/gen/plugin-api/payment_control_plugin_api.rb
534
+ - lib/killbill/gen/plugin-api/payment_metadata.rb
519
535
  - lib/killbill/gen/plugin-api/payment_method_info_plugin.rb
520
536
  - lib/killbill/gen/plugin-api/payment_plugin_api.rb
521
537
  - lib/killbill/gen/plugin-api/payment_plugin_api_exception.rb
@@ -524,6 +540,7 @@ files:
524
540
  - lib/killbill/gen/plugin-api/prior_payment_control_result.rb
525
541
  - lib/killbill/gen/plugin-api/require_gen.rb
526
542
  - lib/killbill/gen/plugin-api/standalone_plugin_catalog.rb
543
+ - lib/killbill/gen/plugin-api/subscription_metadata.rb
527
544
  - lib/killbill/gen/plugin-api/versioned_plugin_catalog.rb
528
545
  - lib/killbill/helpers/active_merchant.rb
529
546
  - lib/killbill/helpers/active_merchant/active_record.rb