spree_gateway 2.2.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -17
- data/Gemfile +1 -1
- data/README.md +9 -3
- data/app/models/spree/billing_integration.rb +21 -0
- data/app/models/spree/gateway/authorize_net.rb +31 -1
- data/app/models/spree/gateway/authorize_net_cim.rb +128 -47
- data/app/models/spree/gateway/balanced_gateway.rb +3 -5
- data/app/models/spree/gateway/braintree_gateway.rb +55 -18
- data/app/models/spree/gateway/cyber_source.rb +10 -0
- data/app/models/spree/gateway/migs.rb +11 -0
- data/app/models/spree/gateway/payflow_pro.rb +1 -0
- data/app/models/spree/gateway/pin_gateway.rb +45 -0
- data/app/models/spree/gateway/spreedly_core_gateway.rb +10 -0
- data/app/models/spree/gateway/stripe_gateway.rb +29 -6
- data/app/models/spree/gateway/usa_epay_transaction.rb +9 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20111118164631_create_skrill_transactions.rb +1 -2
- data/lib/assets/javascripts/spree/frontend/spree_gateway.js +1 -0
- data/{app → lib}/assets/stylesheets/spree/frontend/spree_gateway.css +0 -0
- data/{app/controllers → lib/controllers/frontend}/spree/checkout_controller_decorator.rb +1 -1
- data/{app/controllers → lib/controllers/frontend}/spree/skrill_status_controller.rb +0 -0
- data/lib/spree_gateway.rb +1 -1
- data/lib/spree_gateway/engine.rb +56 -25
- data/{app/views → lib/views/backend}/spree/admin/log_entries/_braintree.html.erb +0 -0
- data/{app/views → lib/views/backend}/spree/admin/log_entries/_stripe.html.erb +0 -0
- data/{app/views → lib/views/backend}/spree/admin/payments/source_forms/_quickcheckout.html.erb +0 -0
- data/lib/views/backend/spree/admin/payments/source_forms/_stripe.html.erb +1 -0
- data/{app/views → lib/views/backend}/spree/admin/payments/source_views/_quickcheckout.html.erb +0 -0
- data/{app/views → lib/views/backend}/spree/admin/payments/source_views/_stripe.html.erb +0 -0
- data/{app/views → lib/views/frontend}/spree/checkout/payment/_quickcheckout.html.erb +2 -2
- data/lib/views/frontend/spree/checkout/payment/_stripe.html.erb +90 -0
- data/spec/factories/payment_method_factory.rb +0 -1
- data/spec/features/stripe_checkout_spec.rb +15 -4
- data/spec/models/gateway/authorize_net_cim_spec.rb +6 -6
- data/spec/models/gateway/authorize_net_spec.rb +6 -6
- data/spec/models/gateway/balanced_gateway_spec.rb +1 -1
- data/spec/models/gateway/beanstream_spec.rb +1 -1
- data/spec/models/gateway/braintree_gateway_spec.rb +147 -31
- data/spec/models/gateway/cyber_source_spec.rb +11 -0
- data/spec/models/gateway/eway_spec.rb +3 -3
- data/spec/models/gateway/maxipago_spec.rb +1 -1
- data/spec/models/gateway/pay_junction_spec.rb +2 -2
- data/spec/models/gateway/payflow_pro_spec.rb +2 -2
- data/spec/models/gateway/pin_gateway_spec.rb +4 -6
- data/spec/models/gateway/stripe_gateway_spec.rb +90 -9
- data/spec/models/gateway/{usa_epay_spec.rb → usa_epay_transaction_spec.rb} +9 -9
- data/spec/spec_helper.rb +5 -2
- data/spree_gateway.gemspec +15 -16
- metadata +89 -98
- data/Versionfile +0 -7
- data/app/assets/javascripts/spree/frontend/spree_gateway.js +0 -3
- data/app/assets/javascripts/store/gateway/stripe.js.coffee +0 -58
- data/app/assets/javascripts/store/spree_gateway.js +0 -2
- data/app/models/spree/gateway/fatzebra.rb +0 -15
- data/app/models/spree/gateway/linkpoint.rb +0 -28
- data/app/models/spree/gateway/samurai.rb +0 -63
- data/app/models/spree/gateway/usa_epay.rb +0 -9
- data/app/views/spree/admin/payments/source_forms/_stripe.html.erb +0 -1
- data/app/views/spree/checkout/payment/_stripe.html.erb +0 -21
- data/config/initializers/savon.rb +0 -3
- data/spec/models/gateway/fatzebra_spec.rb +0 -51
- data/spec/models/gateway/linkpoint_spec.rb +0 -62
- data/spec/models/gateway/samurai_spec.rb +0 -17
- data/spec/models/savon_spec.rb +0 -9
@@ -11,18 +11,18 @@ describe Spree::Gateway::AuthorizeNetCim do
|
|
11
11
|
|
12
12
|
context '.payment_profiles_supported?' do
|
13
13
|
it 'return true' do
|
14
|
-
expect(subject.payment_profiles_supported?).to
|
14
|
+
expect(subject.payment_profiles_supported?).to be true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe 'options' do
|
19
|
-
it 'include :test => true when
|
20
|
-
gateway.
|
21
|
-
expect(gateway.options[:test]).to
|
19
|
+
it 'include :test => true when test server is "test"' do
|
20
|
+
gateway.preferred_server = "test"
|
21
|
+
expect(gateway.options[:test]).to be true
|
22
22
|
end
|
23
23
|
|
24
|
-
it 'does not include :test when
|
25
|
-
gateway.
|
24
|
+
it 'does not include :test when test server is "live"' do
|
25
|
+
gateway.preferred_server = "live"
|
26
26
|
expect(gateway.options[:test]).to be_nil
|
27
27
|
end
|
28
28
|
end
|
@@ -10,14 +10,14 @@ describe Spree::Gateway::AuthorizeNet do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
describe 'options' do
|
13
|
-
it 'include :test => true when
|
14
|
-
gateway.
|
15
|
-
expect(gateway.options[:test]).to
|
13
|
+
it 'include :test => true when server is "test"' do
|
14
|
+
gateway.preferred_server = "test"
|
15
|
+
expect(gateway.options[:test]).to be true
|
16
16
|
end
|
17
17
|
|
18
|
-
it 'does not include :test when
|
19
|
-
gateway.
|
20
|
-
expect(gateway.options[:test]).to
|
18
|
+
it 'does not include :test when server is "live"' do
|
19
|
+
gateway.preferred_server = "live"
|
20
|
+
expect(gateway.options[:test]).to be false
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,14 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'pry'
|
2
3
|
|
3
4
|
describe Spree::Gateway::BraintreeGateway do
|
4
5
|
|
5
6
|
before do
|
6
7
|
Spree::Gateway.update_all(active: false)
|
7
|
-
@gateway = Spree::Gateway::BraintreeGateway.create!(name: 'Braintree Gateway',
|
8
|
-
@gateway.
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
@gateway = Spree::Gateway::BraintreeGateway.create!(name: 'Braintree Gateway', active: true)
|
9
|
+
@gateway.preferences = {
|
10
|
+
environment: 'sandbox',
|
11
|
+
merchant_id: 'zbn5yzq9t7wmwx42',
|
12
|
+
public_key: 'ym9djwqpkxbv3xzt',
|
13
|
+
private_key: '4ghghkyp2yy6yqc8'
|
14
|
+
}
|
12
15
|
@gateway.save!
|
13
16
|
|
14
17
|
with_payment_profiles_off do
|
@@ -29,30 +32,112 @@ describe Spree::Gateway::BraintreeGateway do
|
|
29
32
|
order = create(:order_with_totals, bill_address: address, ship_address: address)
|
30
33
|
order.update!
|
31
34
|
|
35
|
+
# Use a valid CC from braintree sandbox: https://www.braintreepayments.com/docs/ruby/reference/sandbox
|
36
|
+
|
32
37
|
@credit_card = create(:credit_card,
|
33
38
|
verification_value: '123',
|
34
|
-
number: '
|
39
|
+
number: '5555555555554444',
|
35
40
|
month: 9,
|
36
41
|
year: Time.now.year + 1,
|
37
|
-
|
38
|
-
last_name: 'Doe',
|
42
|
+
name: 'John Doe',
|
39
43
|
cc_type: 'mastercard')
|
40
44
|
|
41
45
|
@payment = create(:payment, source: @credit_card, order: order, payment_method: @gateway, amount: 10.00)
|
42
|
-
@payment.payment_method.environment = 'test'
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
49
|
+
describe 'payment profile creation' do
|
50
|
+
before do
|
51
|
+
country = create(:country, name: 'United States', iso_name: 'UNITED STATES', iso3: 'USA', iso: 'US', numcode: 840)
|
52
|
+
state = create(:state, name: 'Maryland', abbr: 'MD', country: country)
|
53
|
+
address = create(:address,
|
54
|
+
firstname: 'John',
|
55
|
+
lastname: 'Doe',
|
56
|
+
address1: '1234 My Street',
|
57
|
+
address2: 'Apt 1',
|
58
|
+
city: 'Washington DC',
|
59
|
+
zipcode: '20123',
|
60
|
+
phone: '(555)555-5555',
|
61
|
+
state: state,
|
62
|
+
country: country
|
63
|
+
)
|
64
|
+
@address = address
|
65
|
+
|
66
|
+
order = create(:order_with_totals, bill_address: address, ship_address: address)
|
67
|
+
order.update!
|
68
|
+
|
69
|
+
@credit_card = create(:credit_card,
|
70
|
+
verification_value: '123',
|
71
|
+
number: '5555555555554444',
|
72
|
+
month: 9,
|
73
|
+
year: Time.now.year + 1,
|
74
|
+
name: 'John Doe',
|
75
|
+
cc_type: 'mastercard')
|
76
|
+
|
77
|
+
@payment = create(:payment, source: @credit_card, order: order, payment_method: @gateway, amount: 10.00)
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'when a credit card is created' do
|
81
|
+
it 'it has the address associated on the remote payment profile' do
|
82
|
+
remote_customer = @gateway.provider.instance_variable_get(:@braintree_gateway).customer.find(@credit_card.gateway_customer_profile_id)
|
83
|
+
remote_address = remote_customer.addresses.first rescue nil
|
84
|
+
expect(remote_address).not_to be_nil
|
85
|
+
expect(remote_address.street_address).to eq(@address.address1)
|
86
|
+
expect(remote_address.extended_address).to eq(@address.address2)
|
87
|
+
expect(remote_address.locality).to eq(@address.city)
|
88
|
+
expect(remote_address.region).to eq(@address.state.name)
|
89
|
+
expect(remote_address.country_code_alpha2).to eq(@address.country.iso)
|
90
|
+
expect(remote_address.postal_code).to eq(@address.zipcode)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
describe 'payment profile failure' do
|
97
|
+
before do
|
98
|
+
country = create(:country, name: 'United States', iso_name: 'UNITED STATES', iso3: 'USA', iso: 'US', numcode: 840)
|
99
|
+
state = create(:state, name: 'Maryland', abbr: 'MD', country: country)
|
100
|
+
address = create(:address,
|
101
|
+
firstname: 'John',
|
102
|
+
lastname: 'Doe',
|
103
|
+
address1: '1234 My Street',
|
104
|
+
address2: 'Apt 1',
|
105
|
+
city: 'Washington DC',
|
106
|
+
zipcode: '20123',
|
107
|
+
phone: '(555)555-5555',
|
108
|
+
state: state,
|
109
|
+
country: country
|
110
|
+
)
|
111
|
+
@address = address
|
112
|
+
|
113
|
+
order = create(:order_with_totals, bill_address: address, ship_address: address)
|
114
|
+
order.update!
|
115
|
+
|
116
|
+
@credit_card = create(:credit_card,
|
117
|
+
verification_value: '123',
|
118
|
+
number: '5105105105105100',
|
119
|
+
month: 9,
|
120
|
+
year: Time.now.year + 1,
|
121
|
+
name: 'John Doe',
|
122
|
+
cc_type: 'mastercard')
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'should fail creation' do
|
126
|
+
expect{ create(:payment, source: @credit_card, order: order, payment_method: @gateway, amount: 10.00) }.to raise_error
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
46
131
|
describe 'merchant_account_id' do
|
47
132
|
before do
|
48
|
-
@gateway.
|
133
|
+
@gateway.preferences[:merchant_account_id] = merchant_account_id
|
49
134
|
end
|
50
135
|
|
51
136
|
context 'with merchant_account_id empty' do
|
52
137
|
let(:merchant_account_id) { '' }
|
53
138
|
|
54
139
|
it 'does not be present in options' do
|
55
|
-
expect(@gateway.options.keys.include?(:merchant_account_id)).to
|
140
|
+
expect(@gateway.options.keys.include?(:merchant_account_id)).to be false
|
56
141
|
end
|
57
142
|
end
|
58
143
|
|
@@ -64,11 +149,11 @@ describe Spree::Gateway::BraintreeGateway do
|
|
64
149
|
end
|
65
150
|
|
66
151
|
it 'have a preferences[:merchant_account_id]' do
|
67
|
-
expect(@gateway.preferences.keys.include?(:merchant_account_id)).to
|
152
|
+
expect(@gateway.preferences.keys.include?(:merchant_account_id)).to be true
|
68
153
|
end
|
69
154
|
|
70
155
|
it 'is present in options' do
|
71
|
-
expect(@gateway.options.keys.include?(:merchant_account_id)).to
|
156
|
+
expect(@gateway.options.keys.include?(:merchant_account_id)).to be true
|
72
157
|
end
|
73
158
|
end
|
74
159
|
end
|
@@ -81,7 +166,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
81
166
|
|
82
167
|
context '.payment_profiles_supported?' do
|
83
168
|
it 'return true' do
|
84
|
-
expect(@gateway.payment_profiles_supported?).to
|
169
|
+
expect(@gateway.payment_profiles_supported?).to be true
|
85
170
|
end
|
86
171
|
end
|
87
172
|
|
@@ -92,10 +177,41 @@ describe Spree::Gateway::BraintreeGateway do
|
|
92
177
|
end
|
93
178
|
|
94
179
|
describe 'authorize' do
|
180
|
+
context "the credit card has a token" do
|
181
|
+
before(:each) do
|
182
|
+
@credit_card.update_attributes(gateway_payment_profile_id: 'test')
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'calls provider#authorize using the gateway_payment_profile_id' do
|
186
|
+
expect(@gateway.provider).to receive(:authorize).with(500, 'test', { payment_method_token: true } )
|
187
|
+
@gateway.authorize(500, @credit_card)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context "the given credit card does not have a token" do
|
192
|
+
context "the credit card has a customer profile id" do
|
193
|
+
before(:each) do
|
194
|
+
@credit_card.update_attributes(gateway_customer_profile_id: '12345')
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'calls provider#authorize using the gateway_customer_profile_id' do
|
198
|
+
expect(@gateway.provider).to receive(:authorize).with(500, '12345', {})
|
199
|
+
@gateway.authorize(500, @credit_card)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
context "no customer profile id" do
|
204
|
+
it 'calls provider#authorize with the credit card object' do
|
205
|
+
expect(@gateway.provider).to receive(:authorize).with(500, @credit_card, {})
|
206
|
+
@gateway.authorize(500, @credit_card)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
95
211
|
it 'return a success response with an authorization code' do
|
96
212
|
result = @gateway.authorize(500, @credit_card)
|
97
213
|
|
98
|
-
expect(result.success?).to
|
214
|
+
expect(result.success?).to be true
|
99
215
|
expect(result.authorization).to match /\A\w{6}\z/
|
100
216
|
expect(Braintree::Transaction::Status::Authorized).to eq Braintree::Transaction.find(result.authorization).status
|
101
217
|
end
|
@@ -123,7 +239,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
123
239
|
|
124
240
|
context 'when the card is a mastercard' do
|
125
241
|
before do
|
126
|
-
@credit_card.number = '
|
242
|
+
@credit_card.number = '5555555555554444'
|
127
243
|
@credit_card.cc_type = 'mastercard'
|
128
244
|
@credit_card.save
|
129
245
|
end
|
@@ -182,8 +298,8 @@ describe Spree::Gateway::BraintreeGateway do
|
|
182
298
|
transaction = ::Braintree::Transaction.find(@payment.response_code)
|
183
299
|
expect(transaction.status).to eq Braintree::Transaction::Status::Authorized
|
184
300
|
|
185
|
-
capture_result = @gateway.capture(@payment
|
186
|
-
expect(capture_result.success?).to
|
301
|
+
capture_result = @gateway.capture(@payment.amount, @payment.response_code)
|
302
|
+
expect(capture_result.success?).to be true
|
187
303
|
|
188
304
|
transaction = ::Braintree::Transaction.find(@payment.response_code)
|
189
305
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -199,20 +315,17 @@ describe Spree::Gateway::BraintreeGateway do
|
|
199
315
|
transaction = ::Braintree::Transaction.find(@payment.response_code)
|
200
316
|
expect(transaction.status).to eq Braintree::Transaction::Status::Authorized
|
201
317
|
|
202
|
-
|
203
|
-
@payment.payment_source.capture(@payment) # as done in PaymentsController#fire
|
318
|
+
@payment.capture! # as done in PaymentsController#fire
|
204
319
|
transaction = ::Braintree::Transaction.find(@payment.response_code)
|
205
320
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
206
|
-
expect
|
207
|
-
@payment.payment_source.capture(@payment)
|
208
|
-
}.to raise_error(Spree::Core::GatewayError, 'Cannot submit for settlement unless status is authorized. (91507)')
|
321
|
+
expect(@payment.completed?).to be true
|
209
322
|
end
|
210
323
|
end
|
211
324
|
|
212
325
|
context 'purchase' do
|
213
326
|
it 'return a success response with an authorization code' do
|
214
327
|
result = @gateway.purchase(500, @credit_card)
|
215
|
-
expect(result.success?).to
|
328
|
+
expect(result.success?).to be true
|
216
329
|
expect(result.authorization).to match /\A\w{6}\z/
|
217
330
|
expect(Braintree::Transaction::Status::SubmittedForSettlement).to eq Braintree::Transaction.find(result.authorization).status
|
218
331
|
end
|
@@ -234,14 +347,18 @@ describe Spree::Gateway::BraintreeGateway do
|
|
234
347
|
|
235
348
|
context 'credit' do
|
236
349
|
it 'work through the spree interface' do
|
237
|
-
pending 'undefined method credit for #<TestCard:0x007fdba1809ad8>'
|
238
350
|
@payment.amount += 100.00
|
239
351
|
purchase_using_spree_interface
|
352
|
+
skip "Braintree does not provide a way to settle a transaction manually: https://twitter.com/braintree/status/446099537224933376"
|
240
353
|
credit_using_spree_interface
|
241
354
|
end
|
242
355
|
end
|
243
356
|
|
244
357
|
context 'void' do
|
358
|
+
before do
|
359
|
+
Spree::Config.set(auto_capture: true)
|
360
|
+
end
|
361
|
+
|
245
362
|
it 'work through the spree credit_card / payment interface' do
|
246
363
|
expect(@payment.log_entries.size).to eq(0)
|
247
364
|
@payment.process!
|
@@ -249,11 +366,10 @@ describe Spree::Gateway::BraintreeGateway do
|
|
249
366
|
expect(@payment.log_entries.size).to eq(1)
|
250
367
|
expect(@payment.response_code).to match /\A\w{6}\z/
|
251
368
|
|
252
|
-
pending 'expected: submitted_for_settlement got: authorized'
|
253
369
|
transaction = Braintree::Transaction.find(@payment.response_code)
|
254
370
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
255
371
|
|
256
|
-
@
|
372
|
+
@payment.void_transaction!
|
257
373
|
transaction = Braintree::Transaction.find(transaction.id)
|
258
374
|
expect(transaction.status).to eq Braintree::Transaction::Status::Voided
|
259
375
|
end
|
@@ -261,7 +377,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
261
377
|
|
262
378
|
context 'update_card_number' do
|
263
379
|
it 'passes through gateway_payment_profile_id' do
|
264
|
-
credit_card = { 'token' => 'testing', 'last_4' => '1234', 'masked_number' => '
|
380
|
+
credit_card = { 'token' => 'testing', 'last_4' => '1234', 'masked_number' => '555555******4444' }
|
265
381
|
@gateway.update_card_number(@payment.source, credit_card)
|
266
382
|
expect(@payment.source.gateway_payment_profile_id).to eq 'testing'
|
267
383
|
end
|
@@ -269,7 +385,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
269
385
|
|
270
386
|
def credit_using_spree_interface
|
271
387
|
expect(@payment.log_entries.size).to eq(1)
|
272
|
-
@payment.
|
388
|
+
@payment.credit!
|
273
389
|
expect(@payment.log_entries.size).to eq(2)
|
274
390
|
|
275
391
|
# Let's get the payment record associated with the credit
|
@@ -279,7 +395,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
279
395
|
transaction = ::Braintree::Transaction.find(@payment.response_code)
|
280
396
|
expect(transaction.type).to eq Braintree::Transaction::Type::Credit
|
281
397
|
expect(transaction.status).to eq Braintree::Transaction::Status::SubmittedForSettlement
|
282
|
-
expect(transaction.credit_card_details.masked_number).to eq '
|
398
|
+
expect(transaction.credit_card_details.masked_number).to eq '555555******4444'
|
283
399
|
expect(transaction.credit_card_details.expiration_date).to eq "09/#{Time.now.year + 1}"
|
284
400
|
expect(transaction.customer_details.first_name).to eq 'John'
|
285
401
|
expect(transaction.customer_details.last_name).to eq 'Doe'
|
@@ -296,7 +412,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
296
412
|
|
297
413
|
transaction = ::Braintree::Transaction.find(@payment.response_code)
|
298
414
|
expect(Braintree::Transaction::Status::SubmittedForSettlement).to eq transaction.status
|
299
|
-
expect(transaction.credit_card_details.masked_number).to eq '
|
415
|
+
expect(transaction.credit_card_details.masked_number).to eq '555555******4444'
|
300
416
|
expect(transaction.credit_card_details.expiration_date).to eq "09/#{Time.now.year + 1}"
|
301
417
|
expect(transaction.customer_details.first_name).to eq 'John'
|
302
418
|
expect(transaction.customer_details.last_name).to eq 'Doe'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::Gateway::CyberSource do
|
4
|
+
let(:gateway) { described_class.create!(name: 'CyberSource') }
|
5
|
+
|
6
|
+
context '.provider_class' do
|
7
|
+
it 'is a CyberSource gateway' do
|
8
|
+
expect(subject.provider_class).to eq ::ActiveMerchant::Billing::CyberSourceGateway
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -11,19 +11,19 @@ describe Spree::Gateway::Eway do
|
|
11
11
|
|
12
12
|
context '.auto_capture?' do
|
13
13
|
it 'supports purchase method only' do
|
14
|
-
expect(gateway.auto_capture?).to
|
14
|
+
expect(gateway.auto_capture?).to be true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe 'options' do
|
19
19
|
it 'include :test => true in when :test_mode is true' do
|
20
20
|
gateway.preferred_test_mode = true
|
21
|
-
expect(gateway.options[:test]).to
|
21
|
+
expect(gateway.options[:test]).to be true
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'does not include :test when test_mode is false' do
|
25
25
|
gateway.preferred_test_mode = false
|
26
|
-
expect(gateway.options[:test]).to
|
26
|
+
expect(gateway.options[:test]).to be false
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -12,12 +12,12 @@ describe Spree::Gateway::PayJunction do
|
|
12
12
|
describe 'options' do
|
13
13
|
it 'include :test => true in when :test_mode is true' do
|
14
14
|
gateway.preferred_test_mode = true
|
15
|
-
expect(gateway.options[:test]).to
|
15
|
+
expect(gateway.options[:test]).to be true
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'does not include :test when test_mode is false' do
|
19
19
|
gateway.preferred_test_mode = false
|
20
|
-
expect(gateway.options[:test]).to
|
20
|
+
expect(gateway.options[:test]).to be false
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -12,12 +12,12 @@ describe Spree::Gateway::PayflowPro do
|
|
12
12
|
describe 'options' do
|
13
13
|
it 'include :test => true when :test_mode is true' do
|
14
14
|
gateway.preferred_test_mode = true
|
15
|
-
expect(gateway.options[:test]).to
|
15
|
+
expect(gateway.options[:test]).to be true
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'does not include :test when test_mode is false' do
|
19
19
|
gateway.preferred_test_mode = false
|
20
|
-
expect(gateway.options[:test]).to
|
20
|
+
expect(gateway.options[:test]).to be false
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|