killbill 7.0.5 → 7.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/Gemfile.lock +3 -1
- data/NEWS +4 -0
- data/README.md +1 -0
- data/generators/active_merchant/templates/spec/spec_helper.rb +9 -5
- data/killbill.gemspec +1 -0
- data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +0 -1
- data/lib/killbill/helpers/active_merchant/payment_plugin.rb +6 -1
- data/lib/killbill/migration.rb +13 -2
- data/lib/killbill/version.rb +1 -1
- data/spec/killbill/helpers/payment_method_spec.rb +8 -8
- data/spec/killbill/helpers/response_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1730160e98115add24b6b457985e313299e2f32
|
4
|
+
data.tar.gz: 1dc1a41b89290563650c62cd37a120c38d18e64a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34090213e5cad5b2073e4f4f9098cba35fde5f09606eac5eef1384a575b32b098f9877c5211275fba5c45c77ca3bd2c7acb02a01feb41c64fe022d04d6a8f118
|
7
|
+
data.tar.gz: 080dabf41fb14e0accaa031f5c4eee87336c4b768530fb2cf3e95a0b80ccaab7637f553109726d20ef5a7362f732751626603b6e6ea25ec4ce096235dd2a78f8
|
data/.travis.yml
CHANGED
@@ -6,9 +6,14 @@ cache:
|
|
6
6
|
directories:
|
7
7
|
- $HOME/.m2
|
8
8
|
|
9
|
+
services:
|
10
|
+
- mysql
|
11
|
+
- postgresql
|
12
|
+
|
9
13
|
before_script:
|
10
14
|
- bundle exec jbundle install
|
11
15
|
- mysql -uroot -e 'create database killbill_test;'
|
16
|
+
- psql -c 'create database killbill_test;' -U postgres
|
12
17
|
|
13
18
|
notifications:
|
14
19
|
email:
|
@@ -20,6 +25,7 @@ env:
|
|
20
25
|
matrix:
|
21
26
|
# Need MySQL 5.6 - see https://github.com/travis-ci/travis-ci/issues/1986
|
22
27
|
#- AR_ADAPTER='mariadb' AR_USERNAME='root' AR_PASSWORD='' AR_DATABASE='killbill_test'
|
28
|
+
- AR_ADAPTER='postgresql' AR_USERNAME='postgres' AR_DATABASE='killbill_test'
|
23
29
|
- AR_ADAPTER='sqlite3' AR_DATABASE='test.db'
|
24
30
|
|
25
31
|
rvm:
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
killbill (7.0.
|
4
|
+
killbill (7.0.6)
|
5
5
|
rack (>= 1.5.2)
|
6
6
|
sinatra (~> 1.3.4)
|
7
7
|
typhoeus (~> 0.6.9)
|
@@ -68,6 +68,7 @@ GEM
|
|
68
68
|
maven-tools (~> 1.0.10)
|
69
69
|
ruby-maven (~> 3.3, >= 3.3.3)
|
70
70
|
jdbc-mariadb (1.1.9)
|
71
|
+
jdbc-postgres (9.4.1206)
|
71
72
|
jdbc-sqlite3 (3.8.11.2)
|
72
73
|
json (1.8.3-java)
|
73
74
|
maven-tools (1.0.13)
|
@@ -132,6 +133,7 @@ DEPENDENCIES
|
|
132
133
|
activerecord-jdbc-adapter (~> 1.3)
|
133
134
|
jbundler (~> 0.9.2)
|
134
135
|
jdbc-mariadb (~> 1.1.8)
|
136
|
+
jdbc-postgres (~> 9.4)
|
135
137
|
jdbc-sqlite3 (~> 3.7)
|
136
138
|
killbill!
|
137
139
|
monetize (~> 1.1.0)
|
data/NEWS
CHANGED
data/README.md
CHANGED
@@ -12,11 +12,15 @@ RSpec.configure do |config|
|
|
12
12
|
config.formatter = 'documentation'
|
13
13
|
end
|
14
14
|
|
15
|
-
require 'active_record'
|
16
|
-
|
17
|
-
:adapter => 'sqlite3',
|
18
|
-
:database => 'test.db'
|
19
|
-
|
15
|
+
require defined?(JRUBY_VERSION) ? 'arjdbc' : 'active_record'
|
16
|
+
db_config = {
|
17
|
+
:adapter => ENV['AR_ADAPTER'] || 'sqlite3',
|
18
|
+
:database => ENV['AR_DATABASE'] || 'test.db',
|
19
|
+
}
|
20
|
+
db_config[:username] = ENV['AR_USERNAME'] if ENV['AR_USERNAME']
|
21
|
+
db_config[:password] = ENV['AR_PASSWORD'] if ENV['AR_PASSWORD']
|
22
|
+
ActiveRecord::Base.establish_connection(db_config)
|
23
|
+
|
20
24
|
# For debugging
|
21
25
|
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
22
26
|
# Create the schema
|
data/killbill.gemspec
CHANGED
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
# See https://github.com/killbill/killbill-plugin-framework-ruby/issues/33
|
38
38
|
s.add_development_dependency 'activerecord-jdbc-adapter', '~> 1.3'
|
39
39
|
s.add_development_dependency 'jdbc-mariadb', '~> 1.1.8'
|
40
|
+
s.add_development_dependency 'jdbc-postgres', '~> 9.4'
|
40
41
|
end
|
41
42
|
s.add_development_dependency 'actionpack', '~> 4.1.0'
|
42
43
|
s.add_development_dependency 'actionview', '~> 4.1.0'
|
@@ -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)
|
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|
|
data/lib/killbill/migration.rb
CHANGED
@@ -3,8 +3,19 @@ require 'logger'
|
|
3
3
|
require 'active_record'
|
4
4
|
require 'arjdbc'
|
5
5
|
|
6
|
-
|
7
|
-
|
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
|
data/lib/killbill/version.rb
CHANGED
@@ -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 =
|
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
|
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 =
|
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
|
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 =
|
196
|
-
::Killbill::Test::TestPaymentMethod.search_query('XXX', '11-22-33').to_sql.should
|
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 =
|
200
|
-
::Killbill::Test::TestPaymentMethod.search_query('XXX', '11-22-33', 0, 10).to_sql.should
|
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
|
@@ -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 (((
|
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 (((
|
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 (((
|
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 (((
|
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
|
|
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: 7.0.
|
4
|
+
version: 7.0.6
|
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-
|
11
|
+
date: 2016-06-22 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
|