killbill-paypal-express 1.5.4 → 1.6.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.
- data/.travis.yml +3 -6
- data/Jarfile +4 -4
- data/NEWS +5 -0
- data/VERSION +1 -1
- data/db/ddl.sql +1 -1
- data/killbill-paypal-express.gemspec +1 -1
- data/lib/paypal_express/api.rb +3 -3
- data/lib/paypal_express/config/configuration.rb +6 -1
- data/lib/paypal_express/models/paypal_express_payment_method.rb +46 -8
- data/lib/paypal_express/paypal_express_utils.rb +27 -1
- data/pom.xml +1 -1
- data/spec/paypal_express/base_plugin_spec.rb +1 -0
- data/spec/paypal_express/paypal_express_payment_method_spec.rb +110 -12
- data/spec/paypal_express/remote/integration_spec.rb +2 -1
- data/spec/paypal_express/streamy_result_set_spec.rb +37 -0
- data/spec/spec_helper.rb +2 -0
- metadata +31 -30
data/.travis.yml
CHANGED
@@ -2,21 +2,18 @@ language: ruby
|
|
2
2
|
|
3
3
|
notifications:
|
4
4
|
email:
|
5
|
-
-
|
5
|
+
- kill-bill-commits@googlegroups.com
|
6
6
|
|
7
7
|
rvm:
|
8
|
-
- 1.9.2
|
9
|
-
- 1.9.3
|
10
|
-
- ruby-head
|
11
8
|
- jruby-19mode
|
9
|
+
- jruby-20mode
|
12
10
|
- jruby-head
|
13
11
|
|
14
12
|
jdk:
|
13
|
+
- openjdk6
|
15
14
|
- openjdk7
|
16
15
|
- oraclejdk7
|
17
|
-
- openjdk6
|
18
16
|
|
19
17
|
matrix:
|
20
18
|
allow_failures:
|
21
|
-
- rvm: ruby-head
|
22
19
|
- rvm: jruby-head
|
data/Jarfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
jar 'com.ning.billing:killbill-api', '0.
|
2
|
-
jar 'com.ning.billing.plugin:killbill-plugin-api-notification', '0.
|
3
|
-
jar 'com.ning.billing.plugin:killbill-plugin-api-payment', '0.
|
4
|
-
jar 'com.ning.billing:killbill-util:tests', '0.6.
|
1
|
+
jar 'com.ning.billing:killbill-api', '0.7.1'
|
2
|
+
jar 'com.ning.billing.plugin:killbill-plugin-api-notification', '0.5.0'
|
3
|
+
jar 'com.ning.billing.plugin:killbill-plugin-api-payment', '0.5.0'
|
4
|
+
jar 'com.ning.billing:killbill-util:tests', '0.6.17'
|
5
5
|
jar 'javax.servlet:javax.servlet-api', '3.0.1'
|
data/NEWS
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/db/ddl.sql
CHANGED
@@ -82,6 +82,6 @@ CREATE TABLE `paypal_express_responses` (
|
|
82
82
|
`success` tinyint(1) DEFAULT NULL,
|
83
83
|
`created_at` datetime NOT NULL,
|
84
84
|
`updated_at` datetime NOT NULL,
|
85
|
-
PRIMARY KEY (`id`)
|
85
|
+
PRIMARY KEY (`id`),
|
86
86
|
KEY `index_paypal_express_responses_on_token_and_api_call` (`token`, `api_call`)
|
87
87
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.rdoc_options << '--exclude' << '.'
|
24
24
|
|
25
|
-
s.add_dependency 'killbill', '~> 1.
|
25
|
+
s.add_dependency 'killbill', '~> 1.7.1'
|
26
26
|
s.add_dependency 'activemerchant', '~> 1.36.0'
|
27
27
|
s.add_dependency 'activerecord', '~> 3.2.1'
|
28
28
|
s.add_dependency 'sinatra', '~> 1.3.4'
|
data/lib/paypal_express/api.rb
CHANGED
@@ -26,7 +26,7 @@ module Killbill::PaypalExpress
|
|
26
26
|
options[:currency] ||= currency.to_s
|
27
27
|
options[:payment_type] ||= 'Any'
|
28
28
|
options[:invoice_id] ||= kb_payment_id
|
29
|
-
options[:description] ||= "Kill Bill payment for #{kb_payment_id}"
|
29
|
+
options[:description] ||= Killbill::PaypalExpress.paypal_payment_description || "Kill Bill payment for #{kb_payment_id}"
|
30
30
|
options[:ip] ||= @ip
|
31
31
|
|
32
32
|
if options[:reference_id].blank?
|
@@ -166,8 +166,8 @@ module Killbill::PaypalExpress
|
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
def search_payment_methods(search_key, call_context = nil, options = {})
|
170
|
-
PaypalExpressPaymentMethod.search(search_key)
|
169
|
+
def search_payment_methods(search_key, offset = 0, limit = 100, call_context = nil, options = {})
|
170
|
+
PaypalExpressPaymentMethod.search(search_key, offset, limit)
|
171
171
|
end
|
172
172
|
|
173
173
|
private
|
@@ -6,6 +6,7 @@ module Killbill::PaypalExpress
|
|
6
6
|
mattr_reader :gateway
|
7
7
|
mattr_reader :paypal_sandbox_url
|
8
8
|
mattr_reader :paypal_production_url
|
9
|
+
mattr_reader :paypal_payment_description
|
9
10
|
mattr_reader :initialized
|
10
11
|
mattr_reader :test
|
11
12
|
|
@@ -16,9 +17,12 @@ module Killbill::PaypalExpress
|
|
16
17
|
@@config = Properties.new(config_file)
|
17
18
|
@@config.parse!
|
18
19
|
|
20
|
+
@@logger.log_level = Logger::DEBUG if (@@config[:logger] || {})[:debug]
|
21
|
+
|
19
22
|
@@paypal_sandbox_url = @@config[:paypal][:sandbox_url] || 'https://www.sandbox.paypal.com/cgi-bin/webscr'
|
20
23
|
@@paypal_production_url = @@config[:paypal][:production_url] || 'https://www.paypal.com/cgi-bin/webscr'
|
21
24
|
@@test = @@config[:paypal][:test]
|
25
|
+
@@paypal_payment_description = @@config[:paypal][:payment_description]
|
22
26
|
|
23
27
|
@@gateway = Killbill::PaypalExpress::Gateway.instance
|
24
28
|
@@gateway.configure(@@config[:paypal])
|
@@ -30,7 +34,8 @@ module Killbill::PaypalExpress
|
|
30
34
|
end
|
31
35
|
|
32
36
|
ActiveRecord::Base.establish_connection(@@config[:database])
|
37
|
+
ActiveRecord::Base.logger = @@logger
|
33
38
|
|
34
39
|
@@initialized = true
|
35
40
|
end
|
36
|
-
end
|
41
|
+
end
|
@@ -33,14 +33,52 @@ module Killbill::PaypalExpress
|
|
33
33
|
payment_method.save!
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
# VisibleForTesting
|
37
|
+
def self.search_query(search_key, offset = nil, limit = nil)
|
38
|
+
t = self.arel_table
|
39
|
+
tr = PaypalExpressResponse.arel_table
|
40
|
+
|
41
|
+
# Note 1: Exact match for ids and email, partial match for name
|
42
|
+
# Note 2: Creating a payment method is a two-step process. We first create a placeholder during the SetExpressCheckout call, which
|
43
|
+
# doesn't have a kb_payment_method_id (nor a paypal_express_payer_id). During the CreateBillingAgreement call, both attributes
|
44
|
+
# will be populated, as well as the baid. If the second step is never completed, the payment method placeholder is garbage and
|
45
|
+
# we want to ignore it.
|
46
|
+
query = t.join(tr, Arel::Nodes::OuterJoin).on( tr[:api_call].eq('details_for')
|
47
|
+
.and(tr[:success].eq(true))
|
48
|
+
.and(tr[:token].eq(t[:paypal_express_token])))
|
49
|
+
.where( t[:paypal_express_payer_id].eq(search_key)
|
50
|
+
.or(t[:paypal_express_baid].eq(search_key))
|
51
|
+
.or(t[:paypal_express_token].eq(search_key))
|
52
|
+
.or(tr[:payer_email].eq(search_key))
|
53
|
+
.or(tr[:payer_name].matches("%#{search_key}%")))
|
54
|
+
.where(t[:kb_payment_method_id].not_eq(nil))
|
55
|
+
.order(t[:id])
|
56
|
+
if offset.blank? and limit.blank?
|
57
|
+
# true is for count distinct
|
58
|
+
query.project(t[:id].count(true))
|
59
|
+
else
|
60
|
+
query.skip(offset) unless offset.blank?
|
61
|
+
query.take(limit) unless limit.blank?
|
62
|
+
query.project(t[Arel.star])
|
63
|
+
# Not chainable
|
64
|
+
query.distinct
|
65
|
+
end
|
66
|
+
query
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.search(search_key, offset = 0, limit = 100)
|
70
|
+
pagination = Killbill::Plugin::Model::Pagination.new
|
71
|
+
pagination.current_offset = offset
|
72
|
+
pagination.total_nb_records = self.count_by_sql(self.search_query(search_key))
|
73
|
+
pagination.max_nb_records = self.where('kb_payment_method_id is not NULL').count
|
74
|
+
pagination.next_offset = (!pagination.total_nb_records.nil? && offset + limit >= pagination.total_nb_records) ? nil : offset + limit
|
75
|
+
# Reduce the limit if the specified value is larger than the number of records
|
76
|
+
actual_limit = [pagination.max_nb_records, limit].min
|
77
|
+
pagination.iterator = StreamyResultSet.new(actual_limit) do |offset,limit|
|
78
|
+
self.find_by_sql(self.search_query(search_key, offset, limit))
|
79
|
+
.map(&:to_payment_method_response)
|
80
|
+
end
|
81
|
+
pagination
|
44
82
|
end
|
45
83
|
|
46
84
|
def to_payment_method_response
|
@@ -14,4 +14,30 @@ module Killbill::PaypalExpress
|
|
14
14
|
@@first_public_ipv4 ||= Socket.ip_address_list.detect{ |intf| intf.ipv4? and !intf.ipv4_loopback? and !intf.ipv4_multicast? and !intf.ipv4_private? }
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
|
+
# Closest from a streaming API as we can get with ActiveRecord
|
19
|
+
class StreamyResultSet
|
20
|
+
include Enumerable
|
21
|
+
|
22
|
+
def initialize(limit, batch_size = 100, &delegate)
|
23
|
+
@limit = limit
|
24
|
+
@batch = [batch_size, limit].min
|
25
|
+
@delegate = delegate
|
26
|
+
end
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
(0..(@limit - @batch)).step(@batch) do |i|
|
30
|
+
result = @delegate.call(i, @batch)
|
31
|
+
block.call(result)
|
32
|
+
# Optimization: bail out if no more results
|
33
|
+
break if result.nil? || result.empty?
|
34
|
+
end if @batch > 0
|
35
|
+
# Make sure to return DB connections to the Pool
|
36
|
+
ActiveRecord::Base.connection.close
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_a
|
40
|
+
super.to_a.flatten
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/pom.xml
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
<groupId>com.ning.killbill.ruby</groupId>
|
26
26
|
<artifactId>paypal-express-plugin</artifactId>
|
27
27
|
<packaging>pom</packaging>
|
28
|
-
<version>1.
|
28
|
+
<version>1.6.0</version>
|
29
29
|
<name>paypal-express-plugin</name>
|
30
30
|
<url>http://github.com/killbill/killbill-paypal-express-plugin</url>
|
31
31
|
<description>Plugin for accessing paypal as a payment gateway</description>
|
@@ -18,6 +18,7 @@ describe Killbill::PaypalExpress::PaymentPlugin do
|
|
18
18
|
|
19
19
|
@plugin = Killbill::PaypalExpress::PaymentPlugin.new
|
20
20
|
@plugin.logger = Logger.new(STDOUT)
|
21
|
+
@plugin.logger.level = Logger::INFO
|
21
22
|
@plugin.conf_dir = File.dirname(file)
|
22
23
|
|
23
24
|
# Start the plugin here - since the config file will be deleted
|
@@ -1,8 +1,37 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Killbill::PaypalExpress::PaypalExpressPaymentMethod do
|
4
|
+
before :all do
|
5
|
+
Killbill::PaypalExpress::PaypalExpressPaymentMethod.delete_all
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should ignore in search results payment methods without a kb payment method id' do
|
9
|
+
kb_account_id = SecureRandom.uuid
|
10
|
+
token = SecureRandom.uuid
|
11
|
+
pm1 = Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => kb_account_id,
|
12
|
+
:kb_payment_method_id => SecureRandom.uuid,
|
13
|
+
:paypal_express_payer_id => SecureRandom.uuid,
|
14
|
+
:paypal_express_baid => SecureRandom.uuid,
|
15
|
+
:paypal_express_token => token
|
16
|
+
# Token, but not baid/kb payment method id
|
17
|
+
pm2 = Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => kb_account_id,
|
18
|
+
:paypal_express_token => token
|
19
|
+
|
20
|
+
do_search(token).size.should == 1
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should generate the right SQL query' do
|
24
|
+
# Check count query
|
25
|
+
expected_query = "SELECT COUNT(DISTINCT \"paypal_express_payment_methods\".\"id\") FROM \"paypal_express_payment_methods\" LEFT OUTER JOIN \"paypal_express_responses\" ON \"paypal_express_responses\".\"api_call\" = 'details_for' AND \"paypal_express_responses\".\"success\" = 't' AND \"paypal_express_responses\".\"token\" = \"paypal_express_payment_methods\".\"paypal_express_token\" WHERE ((((\"paypal_express_payment_methods\".\"paypal_express_payer_id\" = 'XXX' OR \"paypal_express_payment_methods\".\"paypal_express_baid\" = 'XXX') OR \"paypal_express_payment_methods\".\"paypal_express_token\" = 'XXX') OR \"paypal_express_responses\".\"payer_email\" = 'XXX') OR \"paypal_express_responses\".\"payer_name\" LIKE '%XXX%') AND \"paypal_express_payment_methods\".\"kb_payment_method_id\" IS NOT NULL ORDER BY \"paypal_express_payment_methods\".\"id\""
|
26
|
+
Killbill::PaypalExpress::PaypalExpressPaymentMethod.search_query('XXX').to_sql.should == expected_query
|
27
|
+
|
28
|
+
# Check query with results
|
29
|
+
expected_query = "SELECT DISTINCT \"paypal_express_payment_methods\".* FROM \"paypal_express_payment_methods\" LEFT OUTER JOIN \"paypal_express_responses\" ON \"paypal_express_responses\".\"api_call\" = 'details_for' AND \"paypal_express_responses\".\"success\" = 't' AND \"paypal_express_responses\".\"token\" = \"paypal_express_payment_methods\".\"paypal_express_token\" WHERE ((((\"paypal_express_payment_methods\".\"paypal_express_payer_id\" = 'XXX' OR \"paypal_express_payment_methods\".\"paypal_express_baid\" = 'XXX') OR \"paypal_express_payment_methods\".\"paypal_express_token\" = 'XXX') OR \"paypal_express_responses\".\"payer_email\" = 'XXX') OR \"paypal_express_responses\".\"payer_name\" LIKE '%XXX%') AND \"paypal_express_payment_methods\".\"kb_payment_method_id\" IS NOT NULL ORDER BY \"paypal_express_payment_methods\".\"id\" LIMIT 10 OFFSET 0"
|
30
|
+
Killbill::PaypalExpress::PaypalExpressPaymentMethod.search_query('XXX', 0, 10).to_sql.should == expected_query
|
31
|
+
end
|
32
|
+
|
4
33
|
it 'should search all fields' do
|
5
|
-
|
34
|
+
do_search('foo').size.should == 0
|
6
35
|
|
7
36
|
pm = Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => '11-22-33-44',
|
8
37
|
:kb_payment_method_id => '55-66-77-88',
|
@@ -10,11 +39,12 @@ describe Killbill::PaypalExpress::PaypalExpressPaymentMethod do
|
|
10
39
|
:paypal_express_baid => 'baid',
|
11
40
|
:paypal_express_token => 'token'
|
12
41
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
42
|
+
do_search('foo').size.should == 0
|
43
|
+
do_search(pm.paypal_express_payer_id).size.should == 1
|
44
|
+
do_search('baid').size.should == 1
|
45
|
+
do_search('token').size.should == 1
|
46
|
+
# No partial match for payer id
|
47
|
+
do_search(2343).size.should == 0
|
18
48
|
|
19
49
|
pm2 = Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => '22-33-44-55',
|
20
50
|
:kb_payment_method_id => '66-77-88-99',
|
@@ -22,11 +52,79 @@ describe Killbill::PaypalExpress::PaypalExpressPaymentMethod do
|
|
22
52
|
:paypal_express_baid => 'baid',
|
23
53
|
:paypal_express_token => 'token'
|
24
54
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
55
|
+
do_search('foo').size.should == 0
|
56
|
+
do_search(pm.paypal_express_payer_id).size.should == 1
|
57
|
+
do_search(pm2.paypal_express_payer_id).size.should == 1
|
58
|
+
do_search('baid').size.should == 2
|
59
|
+
do_search('token').size.should == 2
|
60
|
+
# No partial match for payer id
|
61
|
+
do_search(2343).size.should == 0
|
62
|
+
|
63
|
+
# New pm with new token
|
64
|
+
pm3 = Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => '66-77-88-99',
|
65
|
+
:kb_payment_method_id => '08-09-10-11',
|
66
|
+
:paypal_express_payer_id => 9938420,
|
67
|
+
:paypal_express_baid => 'baid2',
|
68
|
+
:paypal_express_token => 'token2'
|
69
|
+
# Check search by name
|
70
|
+
do_search('good').size.should == 0
|
71
|
+
do_search('bad').size.should == 0
|
72
|
+
# Check partial search
|
73
|
+
do_search('goo').size.should == 0
|
74
|
+
do_search('ba').size.should == 0
|
75
|
+
# Check search by email
|
76
|
+
do_search('visible@visible.com').size.should == 0
|
77
|
+
do_search('hidden@visible.com').size.should == 0
|
78
|
+
|
79
|
+
# Good response
|
80
|
+
Killbill::PaypalExpress::PaypalExpressResponse.create :api_call => 'details_for',
|
81
|
+
:token => 'token2',
|
82
|
+
:success => true,
|
83
|
+
:payer_name => 'good',
|
84
|
+
:payer_email => 'visible@visible.com'
|
85
|
+
# Create a dup, to make sure we see it only once
|
86
|
+
Killbill::PaypalExpress::PaypalExpressResponse.create :api_call => 'details_for',
|
87
|
+
:token => 'token2',
|
88
|
+
:success => true,
|
89
|
+
:payer_name => 'good',
|
90
|
+
:payer_email => 'visible@visible.com'
|
91
|
+
# Bad response: wrong api call
|
92
|
+
Killbill::PaypalExpress::PaypalExpressResponse.create :api_call => 'something',
|
93
|
+
:token => 'token2',
|
94
|
+
:success => true,
|
95
|
+
:payer_name => 'bad',
|
96
|
+
:payer_email => 'hidden@hidden.com'
|
97
|
+
# Bad response: wrong token
|
98
|
+
Killbill::PaypalExpress::PaypalExpressResponse.create :api_call => 'details_for',
|
99
|
+
:token => 'something',
|
100
|
+
:success => true,
|
101
|
+
:payer_name => 'bad',
|
102
|
+
:payer_email => 'hidden@hidden.com'
|
103
|
+
# Bad response: not successful
|
104
|
+
Killbill::PaypalExpress::PaypalExpressResponse.create :api_call => 'details_for',
|
105
|
+
:token => 'token2',
|
106
|
+
:success => false,
|
107
|
+
:payer_name => 'bad',
|
108
|
+
:payer_email => 'hidden@hidden.com'
|
109
|
+
|
110
|
+
# Check search by name
|
111
|
+
do_search('good').size.should == 1
|
112
|
+
do_search('bad').size.should == 0
|
113
|
+
# Check partial search
|
114
|
+
do_search('goo').size.should == 1
|
115
|
+
do_search('ba').size.should == 0
|
116
|
+
# Check search by email
|
117
|
+
do_search('visible@visible.com').size.should == 1
|
118
|
+
do_search('hidden@visible.com').size.should == 0
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
def do_search(search_key)
|
124
|
+
pagination = Killbill::PaypalExpress::PaypalExpressPaymentMethod.search(search_key)
|
125
|
+
pagination.current_offset.should == 0
|
126
|
+
results = pagination.iterator.to_a
|
127
|
+
pagination.total_nb_records.should == results.size
|
128
|
+
results
|
31
129
|
end
|
32
130
|
end
|
@@ -9,7 +9,7 @@ describe Killbill::PaypalExpress::PaymentPlugin do
|
|
9
9
|
@plugin.conf_dir = File.expand_path(File.dirname(__FILE__) + '../../../../')
|
10
10
|
|
11
11
|
logger = Logger.new(STDOUT)
|
12
|
-
logger.level = Logger::
|
12
|
+
logger.level = Logger::INFO
|
13
13
|
@plugin.logger = logger
|
14
14
|
|
15
15
|
@plugin.start_plugin
|
@@ -112,6 +112,7 @@ describe Killbill::PaypalExpress::PaymentPlugin do
|
|
112
112
|
pm_details.external_payment_method_id.should == @pm.paypal_express_baid
|
113
113
|
|
114
114
|
pms_found = @plugin.search_payment_methods @pm.paypal_express_baid
|
115
|
+
pms_found = pms_found.iterator.to_a
|
115
116
|
pms_found.size.should == 1
|
116
117
|
pms_found.first.external_payment_method_id.should == pm_details.external_payment_method_id
|
117
118
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Killbill::PaypalExpress::StreamyResultSet do
|
4
|
+
before :all do
|
5
|
+
Killbill::PaypalExpress::PaypalExpressPaymentMethod.delete_all
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should stream results per batch' do
|
9
|
+
1.upto(35) do
|
10
|
+
Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => SecureRandom.uuid,
|
11
|
+
:kb_payment_method_id => SecureRandom.uuid,
|
12
|
+
:paypal_express_payer_id => SecureRandom.uuid,
|
13
|
+
:paypal_express_baid => SecureRandom.uuid,
|
14
|
+
:paypal_express_token => SecureRandom.uuid
|
15
|
+
end
|
16
|
+
Killbill::PaypalExpress::PaypalExpressPaymentMethod.count.should == 35
|
17
|
+
|
18
|
+
enum = Killbill::PaypalExpress::StreamyResultSet.new(40, 10) do |offset,limit|
|
19
|
+
Killbill::PaypalExpress::PaypalExpressPaymentMethod.where('kb_payment_method_id is not NULL')
|
20
|
+
.order("id ASC")
|
21
|
+
.offset(offset)
|
22
|
+
.limit(limit)
|
23
|
+
end
|
24
|
+
|
25
|
+
i = 0
|
26
|
+
enum.each do |results|
|
27
|
+
if i < 3
|
28
|
+
results.size.should == 10
|
29
|
+
elsif i == 3
|
30
|
+
results.size.should == 5
|
31
|
+
else
|
32
|
+
fail 'Too many results'
|
33
|
+
end
|
34
|
+
i += 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,6 +16,8 @@ ActiveRecord::Base.establish_connection(
|
|
16
16
|
:adapter => 'sqlite3',
|
17
17
|
:database => 'test.db'
|
18
18
|
)
|
19
|
+
# For debugging
|
20
|
+
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
19
21
|
# Create the schema
|
20
22
|
require File.expand_path(File.dirname(__FILE__) + '../../db/schema.rb')
|
21
23
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-paypal-express
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.6.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.5.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kill Bill core team
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: killbill
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.7.1
|
21
21
|
none: false
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.7.1
|
27
27
|
none: false
|
28
28
|
prerelease: false
|
29
29
|
type: :runtime
|
@@ -31,13 +31,13 @@ dependencies:
|
|
31
31
|
name: activemerchant
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ~>
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 1.36.0
|
37
37
|
none: false
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.36.0
|
43
43
|
none: false
|
@@ -47,13 +47,13 @@ dependencies:
|
|
47
47
|
name: activerecord
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- -
|
50
|
+
- - ~>
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 3.2.1
|
53
53
|
none: false
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ~>
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: 3.2.1
|
59
59
|
none: false
|
@@ -63,13 +63,13 @@ dependencies:
|
|
63
63
|
name: sinatra
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.3.4
|
69
69
|
none: false
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ~>
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 1.3.4
|
75
75
|
none: false
|
@@ -79,13 +79,13 @@ dependencies:
|
|
79
79
|
name: activerecord-jdbcmysql-adapter
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ~>
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 1.2.9
|
85
85
|
none: false
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ~>
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 1.2.9
|
91
91
|
none: false
|
@@ -95,13 +95,13 @@ dependencies:
|
|
95
95
|
name: jbundler
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- -
|
98
|
+
- - ~>
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: 0.4.1
|
101
101
|
none: false
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- -
|
104
|
+
- - ~>
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: 0.4.1
|
107
107
|
none: false
|
@@ -111,13 +111,13 @@ dependencies:
|
|
111
111
|
name: rake
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - '>='
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: 10.0.0
|
117
117
|
none: false
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - '>='
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: 10.0.0
|
123
123
|
none: false
|
@@ -127,13 +127,13 @@ dependencies:
|
|
127
127
|
name: rspec
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ~>
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 2.12.0
|
133
133
|
none: false
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 2.12.0
|
139
139
|
none: false
|
@@ -143,13 +143,13 @@ dependencies:
|
|
143
143
|
name: activerecord-jdbcsqlite3-adapter
|
144
144
|
version_requirements: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
|
-
- -
|
146
|
+
- - ~>
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: 1.2.6
|
149
149
|
none: false
|
150
150
|
requirement: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- -
|
152
|
+
- - ~>
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: 1.2.6
|
155
155
|
none: false
|
@@ -161,8 +161,8 @@ executables: []
|
|
161
161
|
extensions: []
|
162
162
|
extra_rdoc_files: []
|
163
163
|
files:
|
164
|
-
-
|
165
|
-
-
|
164
|
+
- .gitignore
|
165
|
+
- .travis.yml
|
166
166
|
- Gemfile
|
167
167
|
- Jarfile
|
168
168
|
- NEWS
|
@@ -190,31 +190,31 @@ files:
|
|
190
190
|
- spec/paypal_express/base_plugin_spec.rb
|
191
191
|
- spec/paypal_express/paypal_express_payment_method_spec.rb
|
192
192
|
- spec/paypal_express/remote/integration_spec.rb
|
193
|
+
- spec/paypal_express/streamy_result_set_spec.rb
|
193
194
|
- spec/spec_helper.rb
|
194
195
|
homepage: http://kill-bill.org
|
195
196
|
licenses:
|
196
197
|
- Apache License (2.0)
|
197
198
|
post_install_message:
|
198
199
|
rdoc_options:
|
199
|
-
-
|
200
|
-
-
|
200
|
+
- --exclude
|
201
|
+
- .
|
201
202
|
require_paths:
|
202
203
|
- lib
|
203
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
204
205
|
requirements:
|
205
|
-
- -
|
206
|
+
- - '>='
|
206
207
|
- !ruby/object:Gem::Version
|
207
208
|
version: 1.9.3
|
208
209
|
none: false
|
209
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
211
|
requirements:
|
211
|
-
- -
|
212
|
+
- - '>='
|
212
213
|
- !ruby/object:Gem::Version
|
213
214
|
segments:
|
214
215
|
- 0
|
216
|
+
version: '0'
|
215
217
|
hash: 2
|
216
|
-
version: !binary |-
|
217
|
-
MA==
|
218
218
|
none: false
|
219
219
|
requirements: []
|
220
220
|
rubyforge_project:
|
@@ -226,4 +226,5 @@ test_files:
|
|
226
226
|
- spec/paypal_express/base_plugin_spec.rb
|
227
227
|
- spec/paypal_express/paypal_express_payment_method_spec.rb
|
228
228
|
- spec/paypal_express/remote/integration_spec.rb
|
229
|
+
- spec/paypal_express/streamy_result_set_spec.rb
|
229
230
|
- spec/spec_helper.rb
|