killbill-litle 1.9.6 → 1.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Jarfile +5 -5
- data/NEWS +8 -0
- data/README.md +2 -0
- data/VERSION +1 -1
- data/killbill-litle.gemspec +2 -1
- data/lib/litle.rb +1 -0
- data/lib/litle/api.rb +14 -4
- data/lib/litle/models/litle_response.rb +56 -7
- data/lib/litle/models/litle_transaction.rb +16 -10
- data/pom.xml +1 -1
- data/spec/litle/litle_response_spec.rb +91 -0
- data/spec/litle/remote/integration_spec.rb +4 -3
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc0d66bea92052455c27f5e608fdca9249f0d435
|
4
|
+
data.tar.gz: d1c626601553b6e6d05981a954245b09dd7c1bab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93529b31d8598992e7daac6228d4afe7ef1b7500f622f299ff1e5fc071817893aa12db4258f24df78c5286d6192fdd039a5311b779c676ce047aa652c27e2e8e
|
7
|
+
data.tar.gz: 3f9261b41c28ef0987d480c46a07452a14f1955bd336d080ac1fd98aee1a2f4d8a080d386aef6e66e6d5daebcdcbce4ec2c0773baaf545d5bafcc9662908db53
|
data/Jarfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
jar 'com.ning.billing:killbill-api', '0.
|
2
|
-
jar 'com.ning.billing.plugin:killbill-plugin-api-notification', '0.6.
|
3
|
-
jar 'com.ning.billing.plugin:killbill-plugin-api-payment', '0.6.
|
4
|
-
jar 'com.ning.billing.plugin:killbill-plugin-api-currency', '0.6.
|
5
|
-
jar 'com.ning.billing:killbill-util:tests', '0.
|
1
|
+
jar 'com.ning.billing:killbill-api', '0.8.0'
|
2
|
+
jar 'com.ning.billing.plugin:killbill-plugin-api-notification', '0.6.3'
|
3
|
+
jar 'com.ning.billing.plugin:killbill-plugin-api-payment', '0.6.3'
|
4
|
+
jar 'com.ning.billing.plugin:killbill-plugin-api-currency', '0.6.3'
|
5
|
+
jar 'com.ning.billing:killbill-util:tests', '0.8.8'
|
6
6
|
jar 'javax.servlet:javax.servlet-api', '3.0.1'
|
data/NEWS
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,8 @@ killbill-litle-plugin
|
|
6
6
|
|
7
7
|
Plugin to use Litle & Co. as a gateway.
|
8
8
|
|
9
|
+
Release builds are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.ning.killbill.ruby%22%20AND%20a%3A%22litle-plugin%22) with coordinates `com.ning.killbill.ruby:litle-plugin`.
|
10
|
+
|
9
11
|
Requirements
|
10
12
|
------------
|
11
13
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.7
|
data/killbill-litle.gemspec
CHANGED
@@ -22,9 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.rdoc_options << '--exclude' << '.'
|
24
24
|
|
25
|
-
s.add_dependency 'killbill', '~>
|
25
|
+
s.add_dependency 'killbill', '~> 2.0.0'
|
26
26
|
s.add_dependency 'activemerchant', '~> 1.36.0'
|
27
27
|
s.add_dependency 'activerecord', '~> 3.2.1'
|
28
|
+
s.add_dependency 'money', '~> 6.0.0'
|
28
29
|
s.add_dependency 'sinatra', '~> 1.3.4'
|
29
30
|
# LitleOnline gem dependencies
|
30
31
|
s.add_dependency 'LitleOnline', '~> 8.16.0'
|
data/lib/litle.rb
CHANGED
data/lib/litle/api.rb
CHANGED
@@ -14,7 +14,8 @@ module Killbill::Litle
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount, currency, call_context = nil, options = {})
|
17
|
-
|
17
|
+
# Use Money to compute the amount in cents, as it depends on the currency (1 cent of BTC is 1 Satoshi, not 0.01 BTC)
|
18
|
+
amount_in_cents = Money.new_with_amount(amount, currency).cents.to_i
|
18
19
|
|
19
20
|
# If the payment was already made, just return the status
|
20
21
|
# TODO Should we set the Litle Id field to check for dups (https://www.litle.com/mc-secure/DupeChecking_V1.2.pdf)?
|
@@ -55,7 +56,8 @@ module Killbill::Litle
|
|
55
56
|
end
|
56
57
|
|
57
58
|
def process_refund(kb_account_id, kb_payment_id, amount, currency, call_context = nil, options = {})
|
58
|
-
|
59
|
+
# Use Money to compute the amount in cents, as it depends on the currency (1 cent of BTC is 1 Satoshi, not 0.01 BTC)
|
60
|
+
amount_in_cents = Money.new_with_amount(amount, currency).cents.to_i
|
59
61
|
|
60
62
|
# Check for currency conversion
|
61
63
|
actual_amount, actual_currency = convert_amount_currency_if_required(amount_in_cents, currency, kb_payment_id)
|
@@ -75,9 +77,9 @@ module Killbill::Litle
|
|
75
77
|
def get_refund_info(kb_account_id, kb_payment_id, tenant_context = nil, options = {})
|
76
78
|
# We assume the refund is immutable in Litle and only look at our tables since there
|
77
79
|
# doesn't seem to be a Litle API to fetch details for a given transaction.
|
78
|
-
|
80
|
+
litle_transactions = LitleTransaction.refunds_from_kb_payment_id(kb_payment_id)
|
79
81
|
|
80
|
-
|
82
|
+
litle_transactions.map { |t| t.litle_response.to_refund_response }
|
81
83
|
end
|
82
84
|
|
83
85
|
def add_payment_method(kb_account_id, kb_payment_method_id, payment_method_props, set_default, call_context = nil, options = {})
|
@@ -165,6 +167,14 @@ module Killbill::Litle
|
|
165
167
|
end
|
166
168
|
end
|
167
169
|
|
170
|
+
def search_payments(search_key, offset = 0, limit = 100, call_context = nil, options = {})
|
171
|
+
LitleResponse.search(search_key, offset, limit, :payment)
|
172
|
+
end
|
173
|
+
|
174
|
+
def search_refunds(search_key, offset = 0, limit = 100, call_context = nil, options = {})
|
175
|
+
LitleResponse.search(search_key, offset, limit, :refund)
|
176
|
+
end
|
177
|
+
|
168
178
|
def search_payment_methods(search_key, offset = 0, limit = 100, call_context = nil, options = {})
|
169
179
|
LitlePaymentMethod.search(search_key, offset, limit)
|
170
180
|
end
|
@@ -84,6 +84,52 @@ module Killbill::Litle
|
|
84
84
|
to_killbill_response :refund
|
85
85
|
end
|
86
86
|
|
87
|
+
# VisibleForTesting
|
88
|
+
def self.search_query(api_call, search_key, offset = nil, limit = nil)
|
89
|
+
t = self.arel_table
|
90
|
+
|
91
|
+
# Exact matches only
|
92
|
+
where_clause = t[:params_litleonelineresponse_saleresponse_id].eq(search_key)
|
93
|
+
.or(t[:params_litleonelineresponse_saleresponse_litle_txn_id].eq(search_key))
|
94
|
+
.or(t[:params_litleonelineresponse_saleresponse_order_id].eq(search_key))
|
95
|
+
.or(t[:params_litleonelineresponse_saleresponse_auth_code].eq(search_key))
|
96
|
+
|
97
|
+
# Only search successful payments and refunds
|
98
|
+
where_clause = where_clause.and(t[:api_call].eq(api_call))
|
99
|
+
.and(t[:success].eq(true))
|
100
|
+
|
101
|
+
query = t.where(where_clause)
|
102
|
+
.order(t[:id])
|
103
|
+
|
104
|
+
if offset.blank? and limit.blank?
|
105
|
+
# true is for count distinct
|
106
|
+
query.project(t[:id].count(true))
|
107
|
+
else
|
108
|
+
query.skip(offset) unless offset.blank?
|
109
|
+
query.take(limit) unless limit.blank?
|
110
|
+
query.project(t[Arel.star])
|
111
|
+
# Not chainable
|
112
|
+
query.distinct
|
113
|
+
end
|
114
|
+
query
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.search(search_key, offset = 0, limit = 100, type = :payment)
|
118
|
+
api_call = type == :payment ? 'charge' : 'refund'
|
119
|
+
pagination = Killbill::Plugin::Model::Pagination.new
|
120
|
+
pagination.current_offset = offset
|
121
|
+
pagination.total_nb_records = self.count_by_sql(self.search_query(api_call, search_key))
|
122
|
+
pagination.max_nb_records = self.where(:api_call => api_call, :success => true).count
|
123
|
+
pagination.next_offset = (!pagination.total_nb_records.nil? && offset + limit >= pagination.total_nb_records) ? nil : offset + limit
|
124
|
+
# Reduce the limit if the specified value is larger than the number of records
|
125
|
+
actual_limit = [pagination.max_nb_records, limit].min
|
126
|
+
pagination.iterator = StreamyResultSet.new(actual_limit) do |offset,limit|
|
127
|
+
self.find_by_sql(self.search_query(api_call, search_key, offset, limit))
|
128
|
+
.map { |x| type == :payment ? x.to_payment_response : x.to_refund_response }
|
129
|
+
end
|
130
|
+
pagination
|
131
|
+
end
|
132
|
+
|
87
133
|
private
|
88
134
|
|
89
135
|
def to_killbill_response(type)
|
@@ -97,8 +143,8 @@ module Killbill::Litle
|
|
97
143
|
amount_in_cents = litle_transaction.amount_in_cents
|
98
144
|
currency = litle_transaction.currency
|
99
145
|
created_date = litle_transaction.created_at
|
100
|
-
|
101
|
-
|
146
|
+
first_reference_id = params_litleonelineresponse_saleresponse_id
|
147
|
+
second_reference_id = litle_transaction.litle_txn_id
|
102
148
|
end
|
103
149
|
|
104
150
|
effective_date = params_litleonelineresponse_saleresponse_response_time || created_date
|
@@ -107,26 +153,29 @@ module Killbill::Litle
|
|
107
153
|
|
108
154
|
if type == :payment
|
109
155
|
p_info_plugin = Killbill::Plugin::Model::PaymentInfoPlugin.new
|
110
|
-
p_info_plugin.
|
156
|
+
p_info_plugin.kb_payment_id = kb_payment_id
|
157
|
+
p_info_plugin.amount = Money.new(amount_in_cents, currency).to_d if currency
|
111
158
|
p_info_plugin.currency = currency
|
112
159
|
p_info_plugin.created_date = created_date
|
113
160
|
p_info_plugin.effective_date = effective_date
|
114
161
|
p_info_plugin.status = (success ? :PROCESSED : :ERROR)
|
115
162
|
p_info_plugin.gateway_error = gateway_error
|
116
163
|
p_info_plugin.gateway_error_code = gateway_error_code
|
117
|
-
p_info_plugin.first_payment_reference_id =
|
118
|
-
p_info_plugin.second_payment_reference_id =
|
164
|
+
p_info_plugin.first_payment_reference_id = first_reference_id
|
165
|
+
p_info_plugin.second_payment_reference_id = second_reference_id
|
119
166
|
p_info_plugin
|
120
167
|
else
|
121
168
|
r_info_plugin = Killbill::Plugin::Model::RefundInfoPlugin.new
|
122
|
-
r_info_plugin.
|
169
|
+
r_info_plugin.kb_payment_id = kb_payment_id
|
170
|
+
r_info_plugin.amount = Money.new(amount_in_cents, currency).to_d if currency
|
123
171
|
r_info_plugin.currency = currency
|
124
172
|
r_info_plugin.created_date = created_date
|
125
173
|
r_info_plugin.effective_date = effective_date
|
126
174
|
r_info_plugin.status = (success ? :PROCESSED : :ERROR)
|
127
175
|
r_info_plugin.gateway_error = gateway_error
|
128
176
|
r_info_plugin.gateway_error_code = gateway_error_code
|
129
|
-
r_info_plugin.
|
177
|
+
r_info_plugin.first_refund_reference_id = first_reference_id
|
178
|
+
r_info_plugin.second_refund_reference_id = second_reference_id
|
130
179
|
r_info_plugin
|
131
180
|
end
|
132
181
|
end
|
@@ -4,18 +4,11 @@ module Killbill::Litle
|
|
4
4
|
attr_accessible :amount_in_cents, :currency, :api_call, :kb_payment_id, :litle_txn_id
|
5
5
|
|
6
6
|
def self.from_kb_payment_id(kb_payment_id)
|
7
|
-
|
7
|
+
transaction_from_kb_payment_id :charge, kb_payment_id, :single
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.single_transaction_from_kb_payment_id(api_call, kb_payment_id)
|
15
|
-
litle_transactions = find_all_by_api_call_and_kb_payment_id(api_call, kb_payment_id)
|
16
|
-
raise "Unable to find Litle transaction id for payment #{kb_payment_id}" if litle_transactions.empty?
|
17
|
-
raise "Killbill payment mapping to multiple Litle transactions for payment #{kb_payment_id}" if litle_transactions.size > 1
|
18
|
-
litle_transactions[0]
|
10
|
+
def self.refunds_from_kb_payment_id(kb_payment_id)
|
11
|
+
transaction_from_kb_payment_id :refund, kb_payment_id, :multiple
|
19
12
|
end
|
20
13
|
|
21
14
|
def self.find_candidate_transaction_for_refund(kb_payment_id, amount_in_cents)
|
@@ -34,5 +27,18 @@ module Killbill::Litle
|
|
34
27
|
|
35
28
|
litle_transactions.first
|
36
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def self.transaction_from_kb_payment_id(api_call, kb_payment_id, how_many)
|
34
|
+
litle_transactions = find_all_by_api_call_and_kb_payment_id(api_call, kb_payment_id)
|
35
|
+
raise "Unable to find Litle transaction id for payment #{kb_payment_id}" if litle_transactions.empty?
|
36
|
+
if how_many == :single
|
37
|
+
raise "Killbill payment mapping to multiple Litle transactions for payment #{kb_payment_id}" if litle_transactions.size > 1
|
38
|
+
litle_transactions[0]
|
39
|
+
else
|
40
|
+
litle_transactions
|
41
|
+
end
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
data/pom.xml
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
<groupId>com.ning.killbill.ruby</groupId>
|
26
26
|
<artifactId>litle-plugin</artifactId>
|
27
27
|
<packaging>pom</packaging>
|
28
|
-
<version>1.9.
|
28
|
+
<version>1.9.7</version>
|
29
29
|
<name>litle-plugin</name>
|
30
30
|
<url>http://github.com/killbill/killbill-litle-plugin</url>
|
31
31
|
<description>Plugin for accessing Litle as a payment gateway</description>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Killbill::Litle::LitleResponse do
|
4
|
+
before :all do
|
5
|
+
Killbill::Litle::LitleResponse.delete_all
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should generate the right SQL query' do
|
9
|
+
# Check count query (search query numeric)
|
10
|
+
expected_query = "SELECT COUNT(DISTINCT \"litle_responses\".\"id\") FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = '1234' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = '1234') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\""
|
11
|
+
# Note that Kill Bill will pass a String, even for numeric types
|
12
|
+
Killbill::Litle::LitleResponse.search_query('charge', '1234').to_sql.should == expected_query
|
13
|
+
|
14
|
+
# Check query with results (search query numeric)
|
15
|
+
expected_query = "SELECT DISTINCT \"litle_responses\".* FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = '1234' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = '1234') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = '1234') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\" LIMIT 10 OFFSET 0"
|
16
|
+
# Note that Kill Bill will pass a String, even for numeric types
|
17
|
+
Killbill::Litle::LitleResponse.search_query('charge', '1234', 0, 10).to_sql.should == expected_query
|
18
|
+
|
19
|
+
# Check count query (search query string)
|
20
|
+
expected_query = "SELECT COUNT(DISTINCT \"litle_responses\".\"id\") FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = 'XXX' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = 'XXX') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\""
|
21
|
+
Killbill::Litle::LitleResponse.search_query('charge', 'XXX').to_sql.should == expected_query
|
22
|
+
|
23
|
+
# Check query with results (search query string)
|
24
|
+
expected_query = "SELECT DISTINCT \"litle_responses\".* FROM \"litle_responses\" WHERE (((\"litle_responses\".\"params_litleonelineresponse_saleresponse_id\" = 'XXX' OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_litle_txn_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_order_id\" = 'XXX') OR \"litle_responses\".\"params_litleonelineresponse_saleresponse_auth_code\" = 'XXX') AND \"litle_responses\".\"api_call\" = 'charge' AND \"litle_responses\".\"success\" = 't' ORDER BY \"litle_responses\".\"id\" LIMIT 10 OFFSET 0"
|
25
|
+
Killbill::Litle::LitleResponse.search_query('charge', 'XXX', 0, 10).to_sql.should == expected_query
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should search all fields' do
|
29
|
+
do_search('foo').size.should == 0
|
30
|
+
|
31
|
+
pm = Killbill::Litle::LitleResponse.create :api_call => 'charge',
|
32
|
+
:kb_payment_id => '11-22-33-44',
|
33
|
+
:params_litleonelineresponse_saleresponse_id => '55-66-77-88',
|
34
|
+
:params_litleonelineresponse_saleresponse_litle_txn_id => 38102343,
|
35
|
+
:params_litleonelineresponse_saleresponse_order_id => 'order-id-1',
|
36
|
+
:params_litleonelineresponse_saleresponse_auth_code => 'auth-code-1',
|
37
|
+
:success => true
|
38
|
+
|
39
|
+
# Wrong api_call
|
40
|
+
ignored1 = Killbill::Litle::LitleResponse.create :api_call => 'add_payment_method',
|
41
|
+
:kb_payment_id => pm.kb_payment_id,
|
42
|
+
:params_litleonelineresponse_saleresponse_id => pm.params_litleonelineresponse_saleresponse_id,
|
43
|
+
:params_litleonelineresponse_saleresponse_litle_txn_id => pm.params_litleonelineresponse_saleresponse_litle_txn_id,
|
44
|
+
:params_litleonelineresponse_saleresponse_order_id => pm.params_litleonelineresponse_saleresponse_order_id,
|
45
|
+
:params_litleonelineresponse_saleresponse_auth_code => pm.params_litleonelineresponse_saleresponse_auth_code,
|
46
|
+
:success => true
|
47
|
+
|
48
|
+
# Not successful
|
49
|
+
ignored2 = Killbill::Litle::LitleResponse.create :api_call => 'charge',
|
50
|
+
:kb_payment_id => pm.kb_payment_id,
|
51
|
+
:params_litleonelineresponse_saleresponse_id => pm.params_litleonelineresponse_saleresponse_id,
|
52
|
+
:params_litleonelineresponse_saleresponse_litle_txn_id => pm.params_litleonelineresponse_saleresponse_litle_txn_id,
|
53
|
+
:params_litleonelineresponse_saleresponse_order_id => pm.params_litleonelineresponse_saleresponse_order_id,
|
54
|
+
:params_litleonelineresponse_saleresponse_auth_code => pm.params_litleonelineresponse_saleresponse_auth_code,
|
55
|
+
:success => false
|
56
|
+
|
57
|
+
do_search('foo').size.should == 0
|
58
|
+
do_search(pm.params_litleonelineresponse_saleresponse_id).size.should == 1
|
59
|
+
do_search(pm.params_litleonelineresponse_saleresponse_litle_txn_id).size.should == 1
|
60
|
+
do_search(pm.params_litleonelineresponse_saleresponse_order_id).size.should == 1
|
61
|
+
do_search(pm.params_litleonelineresponse_saleresponse_auth_code).size.should == 1
|
62
|
+
|
63
|
+
pm2 = Killbill::Litle::LitleResponse.create :api_call => 'charge',
|
64
|
+
:kb_payment_id => '11-22-33-44',
|
65
|
+
:params_litleonelineresponse_saleresponse_id => '11-22-33-44',
|
66
|
+
:params_litleonelineresponse_saleresponse_litle_txn_id => pm.params_litleonelineresponse_saleresponse_litle_txn_id,
|
67
|
+
:params_litleonelineresponse_saleresponse_order_id => 'order-id-2',
|
68
|
+
:params_litleonelineresponse_saleresponse_auth_code => 'auth-code-2',
|
69
|
+
:success => true
|
70
|
+
|
71
|
+
do_search('foo').size.should == 0
|
72
|
+
do_search(pm.params_litleonelineresponse_saleresponse_id).size.should == 1
|
73
|
+
do_search(pm.params_litleonelineresponse_saleresponse_litle_txn_id).size.should == 2
|
74
|
+
do_search(pm.params_litleonelineresponse_saleresponse_order_id).size.should == 1
|
75
|
+
do_search(pm.params_litleonelineresponse_saleresponse_auth_code).size.should == 1
|
76
|
+
do_search(pm2.params_litleonelineresponse_saleresponse_id).size.should == 1
|
77
|
+
do_search(pm2.params_litleonelineresponse_saleresponse_litle_txn_id).size.should == 2
|
78
|
+
do_search(pm2.params_litleonelineresponse_saleresponse_order_id).size.should == 1
|
79
|
+
do_search(pm2.params_litleonelineresponse_saleresponse_auth_code).size.should == 1
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
def do_search(search_key)
|
85
|
+
pagination = Killbill::Litle::LitleResponse.search(search_key)
|
86
|
+
pagination.current_offset.should == 0
|
87
|
+
results = pagination.iterator.to_a
|
88
|
+
pagination.total_nb_records.should == results.size
|
89
|
+
results
|
90
|
+
end
|
91
|
+
end
|
@@ -92,10 +92,11 @@ describe Killbill::Litle::PaymentPlugin do
|
|
92
92
|
response.success.should be_true
|
93
93
|
|
94
94
|
# Check we can retrieve the refund
|
95
|
-
|
95
|
+
refund_responses = @plugin.get_refund_info pm.kb_account_id, kb_payment_id
|
96
|
+
refund_responses.size.should == 1
|
96
97
|
# Apparently, Litle returns positive amounts for refunds
|
97
|
-
|
98
|
-
|
98
|
+
refund_responses[0].amount.should == amount
|
99
|
+
refund_responses[0].status.should == :PROCESSED
|
99
100
|
|
100
101
|
# Make sure we can charge again the same payment method
|
101
102
|
second_amount = BigDecimal.new("294.71")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-litle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.7
|
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: 2014-01-
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: killbill
|
@@ -16,12 +16,12 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.0
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - ~>
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
24
|
+
version: 2.0.0
|
25
25
|
prerelease: false
|
26
26
|
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
version: 3.2.1
|
53
53
|
prerelease: false
|
54
54
|
type: :runtime
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: money
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 6.0.0
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 6.0.0
|
67
|
+
prerelease: false
|
68
|
+
type: :runtime
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: sinatra
|
57
71
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -215,6 +229,7 @@ files:
|
|
215
229
|
- spec/litle/base_plugin_spec.rb
|
216
230
|
- spec/litle/currency_conversion_spec.rb
|
217
231
|
- spec/litle/litle_payment_method_spec.rb
|
232
|
+
- spec/litle/litle_response_spec.rb
|
218
233
|
- spec/litle/remote/integration_spec.rb
|
219
234
|
- spec/litle/utils_spec.rb
|
220
235
|
- spec/spec_helper.rb
|
@@ -248,6 +263,7 @@ test_files:
|
|
248
263
|
- spec/litle/base_plugin_spec.rb
|
249
264
|
- spec/litle/currency_conversion_spec.rb
|
250
265
|
- spec/litle/litle_payment_method_spec.rb
|
266
|
+
- spec/litle/litle_response_spec.rb
|
251
267
|
- spec/litle/remote/integration_spec.rb
|
252
268
|
- spec/litle/utils_spec.rb
|
253
269
|
- spec/spec_helper.rb
|