killbill-litle 1.3.0 → 1.4.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/Jarfile +1 -1
- data/VERSION +1 -1
- data/killbill-litle.gemspec +1 -1
- data/lib/litle/api.rb +6 -2
- data/lib/litle/models/litle_response.rb +2 -2
- data/lib/litle.rb +1 -0
- data/pom.xml +1 -1
- data/spec/litle/integration_spec.rb +11 -12
- metadata +4 -4
data/Jarfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
jar 'com.ning.billing:killbill-api', '0.3.0'
|
2
2
|
jar 'com.ning.billing.plugin:killbill-plugin-api-notification', '0.2.4'
|
3
3
|
jar 'com.ning.billing.plugin:killbill-plugin-api-payment', '0.2.4'
|
4
|
-
jar 'com.ning.billing:killbill-util:tests', '0.
|
4
|
+
jar 'com.ning.billing:killbill-util:tests', '0.3.0'
|
5
5
|
jar 'javax.servlet:javax.servlet-api', '3.0.1'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/killbill-litle.gemspec
CHANGED
@@ -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.2.0'
|
26
26
|
s.add_dependency 'activemerchant', '~> 2.0.0'
|
27
27
|
s.add_dependency 'activerecord', '~> 3.2.1'
|
28
28
|
s.add_dependency 'sinatra', '~> 1.3.4'
|
data/lib/litle/api.rb
CHANGED
@@ -13,7 +13,9 @@ module Killbill::Litle
|
|
13
13
|
ActiveRecord::Base.connection.close
|
14
14
|
end
|
15
15
|
|
16
|
-
def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id,
|
16
|
+
def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount, currency, call_context = nil, options = {})
|
17
|
+
amount_in_cents = (amount * 100).to_i
|
18
|
+
|
17
19
|
# If the payment was already made, just return the status
|
18
20
|
# TODO Should we set the Litle Id field to check for dups (https://www.litle.com/mc-secure/DupeChecking_V1.2.pdf)?
|
19
21
|
litle_transaction = LitleTransaction.from_kb_payment_id(kb_payment_id) rescue nil
|
@@ -45,7 +47,9 @@ module Killbill::Litle
|
|
45
47
|
litle_transaction.litle_response.to_payment_response
|
46
48
|
end
|
47
49
|
|
48
|
-
def process_refund(kb_account_id, kb_payment_id,
|
50
|
+
def process_refund(kb_account_id, kb_payment_id, amount, currency, call_context = nil, options = {})
|
51
|
+
amount_in_cents = (amount * 100).to_i
|
52
|
+
|
49
53
|
litle_transaction = LitleTransaction.find_candidate_transaction_for_refund(kb_payment_id, amount_in_cents)
|
50
54
|
|
51
55
|
# Set a default report group
|
@@ -105,7 +105,7 @@ module Killbill::Litle
|
|
105
105
|
|
106
106
|
if type == :payment
|
107
107
|
p_info_plugin = Killbill::Plugin::Model::PaymentInfoPlugin.new
|
108
|
-
p_info_plugin.amount = amount_in_cents
|
108
|
+
p_info_plugin.amount = BigDecimal.new(amount_in_cents.to_s) / 100.0 if amount_in_cents
|
109
109
|
p_info_plugin.created_date = created_date
|
110
110
|
p_info_plugin.effective_date = effective_date
|
111
111
|
p_info_plugin.status = (success ? :PROCESSED : :ERROR)
|
@@ -116,7 +116,7 @@ module Killbill::Litle
|
|
116
116
|
p_info_plugin
|
117
117
|
else
|
118
118
|
r_info_plugin = Killbill::Plugin::Model::RefundInfoPlugin.new
|
119
|
-
r_info_plugin.amount = amount_in_cents
|
119
|
+
r_info_plugin.amount = BigDecimal.new(amount_in_cents.to_s) / 100.0 if amount_in_cents
|
120
120
|
r_info_plugin.created_date = created_date
|
121
121
|
r_info_plugin.effective_date = effective_date
|
122
122
|
r_info_plugin.status = (success ? :PROCESSED : :ERROR)
|
data/lib/litle.rb
CHANGED
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.
|
28
|
+
<version>1.4.0</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>
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'logger'
|
3
2
|
|
4
3
|
ActiveMerchant::Billing::Base.mode = :test
|
5
4
|
|
@@ -54,12 +53,12 @@ describe Killbill::Litle::PaymentPlugin do
|
|
54
53
|
|
55
54
|
it 'should be able to charge and refund' do
|
56
55
|
pm = create_payment_method
|
57
|
-
|
56
|
+
amount = BigDecimal.new("100")
|
58
57
|
currency = 'USD'
|
59
58
|
kb_payment_id = SecureRandom.uuid
|
60
59
|
|
61
|
-
payment_response = @plugin.process_payment pm.kb_account_id, kb_payment_id, pm.kb_payment_method_id,
|
62
|
-
payment_response.amount.should ==
|
60
|
+
payment_response = @plugin.process_payment pm.kb_account_id, kb_payment_id, pm.kb_payment_method_id, amount, currency
|
61
|
+
payment_response.amount.should == amount
|
63
62
|
payment_response.status.should == :PROCESSED
|
64
63
|
|
65
64
|
# Verify our table directly
|
@@ -70,14 +69,14 @@ describe Killbill::Litle::PaymentPlugin do
|
|
70
69
|
response.params_litleonelineresponse_saleresponse_order_id.should == Killbill::Litle::Utils.compact_uuid(kb_payment_id)
|
71
70
|
|
72
71
|
payment_response = @plugin.get_payment_info pm.kb_account_id, kb_payment_id
|
73
|
-
payment_response.amount.should ==
|
72
|
+
payment_response.amount.should == amount
|
74
73
|
payment_response.status.should == :PROCESSED
|
75
74
|
|
76
75
|
# Check we cannot refund an amount greater than the original charge
|
77
|
-
lambda { @plugin.process_refund pm.kb_account_id, kb_payment_id,
|
76
|
+
lambda { @plugin.process_refund pm.kb_account_id, kb_payment_id, amount + 1, currency }.should raise_error RuntimeError
|
78
77
|
|
79
|
-
refund_response = @plugin.process_refund pm.kb_account_id, kb_payment_id,
|
80
|
-
refund_response.amount.should ==
|
78
|
+
refund_response = @plugin.process_refund pm.kb_account_id, kb_payment_id, amount, currency
|
79
|
+
refund_response.amount.should == amount
|
81
80
|
refund_response.status.should == :PROCESSED
|
82
81
|
|
83
82
|
# Verify our table directly
|
@@ -88,15 +87,15 @@ describe Killbill::Litle::PaymentPlugin do
|
|
88
87
|
# Check we can retrieve the refund
|
89
88
|
refund_response = @plugin.get_refund_info pm.kb_account_id, kb_payment_id
|
90
89
|
# Apparently, Litle returns positive amounts for refunds
|
91
|
-
refund_response.amount.should ==
|
90
|
+
refund_response.amount.should == amount
|
92
91
|
refund_response.status.should == :PROCESSED
|
93
92
|
|
94
93
|
# Make sure we can charge again the same payment method
|
95
|
-
|
94
|
+
second_amount = BigDecimal.new("294.71")
|
96
95
|
second_kb_payment_id = SecureRandom.uuid
|
97
96
|
|
98
|
-
payment_response = @plugin.process_payment pm.kb_account_id, second_kb_payment_id, pm.kb_payment_method_id,
|
99
|
-
payment_response.amount.should ==
|
97
|
+
payment_response = @plugin.process_payment pm.kb_account_id, second_kb_payment_id, pm.kb_payment_method_id, second_amount, currency
|
98
|
+
payment_response.amount.should == second_amount
|
100
99
|
payment_response.status.should == :PROCESSED
|
101
100
|
end
|
102
101
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-litle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: killbill
|
@@ -17,13 +17,13 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.2.0
|
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.2.0
|
27
27
|
none: false
|
28
28
|
prerelease: false
|
29
29
|
type: :runtime
|