killbill-litle 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +107 -131
- data/.gitignore +0 -35
- data/.travis.yml +0 -41
- data/Gemfile +0 -3
- data/Gemfile.head +0 -5
- data/Gemfile.lock +0 -151
- data/Jarfile +0 -12
- data/Jarfile.lock +0 -66
- data/LICENSE +0 -201
- data/NEWS +0 -78
- data/README.md +0 -87
- data/Rakefile +0 -30
- data/VERSION +0 -1
- data/config.ru +0 -4
- data/db/ddl.sql +0 -82
- data/db/schema.rb +0 -83
- data/killbill-litle.gemspec +0 -53
- data/killbill.properties +0 -3
- data/litle.yml +0 -38
- data/pom.xml +0 -45
- data/release.sh +0 -61
- data/spec/litle/base_plugin_spec.rb +0 -60
- data/spec/litle/remote/certification/certification_spec.rb +0 -713
- data/spec/litle/remote/integration_spec.rb +0 -125
- data/spec/spec_helper.rb +0 -24
@@ -1,125 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
ActiveMerchant::Billing::Base.mode = :test
|
4
|
-
|
5
|
-
describe Killbill::Litle::PaymentPlugin do
|
6
|
-
|
7
|
-
include ::Killbill::Plugin::ActiveMerchant::RSpec
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
::Killbill::Litle::LitlePaymentMethod.delete_all
|
11
|
-
::Killbill::Litle::LitleResponse.delete_all
|
12
|
-
::Killbill::Litle::LitleTransaction.delete_all
|
13
|
-
|
14
|
-
@plugin = build_plugin(::Killbill::Litle::PaymentPlugin, 'litle')
|
15
|
-
@plugin.start_plugin
|
16
|
-
|
17
|
-
@call_context = build_call_context
|
18
|
-
|
19
|
-
@properties = []
|
20
|
-
@pm = create_payment_method(::Killbill::Litle::LitlePaymentMethod, nil, @call_context.tenant_id, @properties)
|
21
|
-
@amount = BigDecimal.new('100')
|
22
|
-
@currency = 'USD'
|
23
|
-
|
24
|
-
kb_payment_id = SecureRandom.uuid
|
25
|
-
1.upto(6) do
|
26
|
-
@kb_payment = @plugin.kb_apis.proxied_services[:payment_api].add_payment(kb_payment_id)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
after(:each) do
|
31
|
-
@plugin.stop_plugin
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'should be able to charge a Credit Card directly' do
|
35
|
-
properties = build_pm_properties
|
36
|
-
|
37
|
-
# We created the payment method, hence the rows
|
38
|
-
Killbill::Litle::LitleResponse.all.size.should == 1
|
39
|
-
Killbill::Litle::LitleTransaction.all.size.should == 0
|
40
|
-
|
41
|
-
payment_response = @plugin.purchase_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, properties, @call_context)
|
42
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
43
|
-
payment_response.amount.should == @amount
|
44
|
-
payment_response.transaction_type.should == :PURCHASE
|
45
|
-
|
46
|
-
responses = Killbill::Litle::LitleResponse.all
|
47
|
-
responses.size.should == 2
|
48
|
-
responses[0].api_call.should == 'add_payment_method'
|
49
|
-
responses[0].message.should == 'Approved'
|
50
|
-
responses[1].api_call.should == 'purchase'
|
51
|
-
responses[1].message.should == 'Approved'
|
52
|
-
transactions = Killbill::Litle::LitleTransaction.all
|
53
|
-
transactions.size.should == 1
|
54
|
-
transactions[0].api_call.should == 'purchase'
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'should be able to charge and refund' do
|
58
|
-
payment_response = @plugin.purchase_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
|
59
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
60
|
-
payment_response.amount.should == @amount
|
61
|
-
payment_response.transaction_type.should == :PURCHASE
|
62
|
-
|
63
|
-
# Try a full refund
|
64
|
-
refund_response = @plugin.refund_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[1].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
|
65
|
-
refund_response.status.should eq(:PROCESSED), refund_response.gateway_error
|
66
|
-
refund_response.amount.should == @amount
|
67
|
-
refund_response.transaction_type.should == :REFUND
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'should be able to auth, capture and refund' do
|
71
|
-
payment_response = @plugin.authorize_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
|
72
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
73
|
-
payment_response.amount.should == @amount
|
74
|
-
payment_response.transaction_type.should == :AUTHORIZE
|
75
|
-
|
76
|
-
# Try multiple partial captures
|
77
|
-
partial_capture_amount = BigDecimal.new('10')
|
78
|
-
1.upto(3) do |i|
|
79
|
-
payment_response = @plugin.capture_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[i].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
|
80
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
81
|
-
payment_response.amount.should == partial_capture_amount
|
82
|
-
payment_response.transaction_type.should == :CAPTURE
|
83
|
-
end
|
84
|
-
|
85
|
-
# Try a partial refund
|
86
|
-
refund_response = @plugin.refund_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[4].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
|
87
|
-
refund_response.status.should eq(:PROCESSED), refund_response.gateway_error
|
88
|
-
refund_response.amount.should == partial_capture_amount
|
89
|
-
refund_response.transaction_type.should == :REFUND
|
90
|
-
|
91
|
-
# Try to capture again
|
92
|
-
payment_response = @plugin.capture_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[5].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
|
93
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
94
|
-
payment_response.amount.should == partial_capture_amount
|
95
|
-
payment_response.transaction_type.should == :CAPTURE
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'should be able to auth and void' do
|
99
|
-
payment_response = @plugin.authorize_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
|
100
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
101
|
-
payment_response.amount.should == @amount
|
102
|
-
payment_response.transaction_type.should == :AUTHORIZE
|
103
|
-
|
104
|
-
payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[1].id, @pm.kb_payment_method_id, @properties, @call_context)
|
105
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
106
|
-
payment_response.transaction_type.should == :VOID
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'should be able to auth, partial capture and void' do
|
110
|
-
payment_response = @plugin.authorize_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[0].id, @pm.kb_payment_method_id, @amount, @currency, @properties, @call_context)
|
111
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
112
|
-
payment_response.amount.should == @amount
|
113
|
-
payment_response.transaction_type.should == :AUTHORIZE
|
114
|
-
|
115
|
-
partial_capture_amount = BigDecimal.new('10')
|
116
|
-
payment_response = @plugin.capture_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[1].id, @pm.kb_payment_method_id, partial_capture_amount, @currency, @properties, @call_context)
|
117
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
118
|
-
payment_response.amount.should == partial_capture_amount
|
119
|
-
payment_response.transaction_type.should == :CAPTURE
|
120
|
-
|
121
|
-
payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[2].id, @pm.kb_payment_method_id, @properties, @call_context)
|
122
|
-
payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
|
123
|
-
payment_response.transaction_type.should == :VOID
|
124
|
-
end
|
125
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
require 'litle'
|
3
|
-
require 'killbill/helpers/active_merchant/killbill_spec_helper'
|
4
|
-
|
5
|
-
require 'logger'
|
6
|
-
|
7
|
-
require 'rspec'
|
8
|
-
|
9
|
-
RSpec.configure do |config|
|
10
|
-
config.color_enabled = true
|
11
|
-
config.tty = true
|
12
|
-
config.formatter = 'documentation'
|
13
|
-
end
|
14
|
-
|
15
|
-
require 'active_record'
|
16
|
-
ActiveRecord::Base.establish_connection(
|
17
|
-
:adapter => 'sqlite3',
|
18
|
-
:database => 'test.db'
|
19
|
-
)
|
20
|
-
# For debugging
|
21
|
-
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
22
|
-
# Create the schema
|
23
|
-
require File.expand_path(File.dirname(__FILE__) + '../../db/schema.rb')
|
24
|
-
|