spree_gateway 3.2.0.beta → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -2
- data/.rspec +3 -1
- data/.travis.yml +25 -8
- data/Appraisals +13 -0
- data/README.md +22 -20
- data/app/models/spree/gateway/authorize_net.rb +2 -3
- data/app/models/spree/gateway/balanced_gateway.rb +2 -3
- data/app/models/spree/gateway/eway.rb +2 -4
- data/app/models/spree/gateway/pay_junction.rb +2 -4
- data/app/models/spree/gateway/payflow_pro.rb +2 -5
- data/app/models/spree/gateway/stripe_gateway.rb +12 -1
- data/gemfiles/spree_3_1.gemfile +7 -0
- data/gemfiles/spree_3_2.gemfile +8 -0
- data/gemfiles/spree_master.gemfile +8 -0
- data/spec/features/stripe_checkout_spec.rb +1 -0
- data/spec/models/gateway/braintree_gateway_spec.rb +18 -3
- data/spec/spec_helper.rb +0 -7
- data/spree_gateway.gemspec +2 -2
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59d06c29878a6203de1b5ca3c4cd97b88f7ed257
|
4
|
+
data.tar.gz: 7a20a8c0667e50b87bac1cc29781a265b1eba85a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3674f7cc0061a2428959eff085930bca279454526d537df7dfd5d3667e5394d8c2aedcc881333bef6c5a8d5fb37c22c03f936affa9229a3b2f4bddc2a57a3d0b
|
7
|
+
data.tar.gz: 98b84448539919606b6149100def41019f17690fc11b92caf54122d43cf2e6b40c72be7bf27638c7fa187443434ded19a3c445a310a53835224ccf3a781c73a1
|
data/.gitignore
CHANGED
@@ -2,8 +2,20 @@
|
|
2
2
|
*~
|
3
3
|
.#*
|
4
4
|
.DS_Store
|
5
|
+
.idea
|
6
|
+
.localeapp/locales
|
7
|
+
.project
|
8
|
+
coverage
|
9
|
+
default
|
10
|
+
Gemfile.lock
|
5
11
|
tmp
|
12
|
+
nbproject
|
13
|
+
pkg
|
14
|
+
*.sw?
|
6
15
|
spec/dummy
|
7
|
-
Gemfile.lock
|
8
16
|
.rvmrc
|
9
|
-
|
17
|
+
.sass-cache
|
18
|
+
public/spree
|
19
|
+
.ruby-version
|
20
|
+
.ruby-gemset
|
21
|
+
gemfiles/*.gemfile.lock
|
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -1,11 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
sudo: required
|
2
|
+
dist: trusty
|
3
|
+
|
4
|
+
language: ruby
|
5
|
+
|
5
6
|
env:
|
6
|
-
- DB=mysql
|
7
7
|
- DB=postgres
|
8
|
-
|
8
|
+
- DB=mysql
|
9
|
+
|
10
|
+
gemfile:
|
11
|
+
- gemfiles/spree_3_1.gemfile
|
12
|
+
- gemfiles/spree_3_2.gemfile
|
13
|
+
- gemfiles/spree_master.gemfile
|
14
|
+
|
15
|
+
script:
|
16
|
+
- bundle exec rake test_app
|
17
|
+
- bundle exec rake spec
|
18
|
+
|
9
19
|
rvm:
|
10
|
-
- 2.
|
11
|
-
|
20
|
+
- 2.3.1
|
21
|
+
- 2.2.7
|
22
|
+
|
23
|
+
addons:
|
24
|
+
apt:
|
25
|
+
packages:
|
26
|
+
- mysql-server-5.6
|
27
|
+
- mysql-client-core-5.6
|
28
|
+
- mysql-client-5.6
|
data/Appraisals
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
appraise 'spree-3-1' do
|
2
|
+
gem 'spree', '~> 3.1.0'
|
3
|
+
end
|
4
|
+
|
5
|
+
appraise 'spree-3-2' do
|
6
|
+
gem 'spree', '~> 3.2.0'
|
7
|
+
gem 'rails-controller-testing'
|
8
|
+
end
|
9
|
+
|
10
|
+
appraise 'spree-master' do
|
11
|
+
gem 'spree', github: 'spree/spree', branch: 'master'
|
12
|
+
gem 'rails-controller-testing'
|
13
|
+
end
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Spree Gateway
|
2
2
|
|
3
|
-
[![Build Status](https://api.travis-ci.org/spree/spree_gateway.
|
4
|
-
[![Code Climate](https://codeclimate.com/github/spree/spree_gateway.
|
3
|
+
[![Build Status](https://api.travis-ci.org/spree/spree_gateway.svg?branch=master)](https://travis-ci.org/spree/spree_gateway)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/spree/spree_gateway.svg)](https://codeclimate.com/github/spree/spree_gateway)
|
5
5
|
|
6
6
|
Community supported Spree Payment Method Gateways. It works as a wrapper for
|
7
7
|
active_merchant gateway. Note that for some gateways you might still need to
|
@@ -9,32 +9,34 @@ add another gem to your Gemfile to make it work. For example active_merchant
|
|
9
9
|
require `braintree` but it doesn't include that gem on its gemspec. So you
|
10
10
|
need to manually add it to your rails app Gemfile.
|
11
11
|
|
12
|
-
These can be used with Spree >= 1.0.x (but see note below for necessary changes)
|
13
|
-
|
14
|
-
http://guides.spreecommerce.com/developer/payments.html
|
15
|
-
|
16
12
|
## Installation
|
17
13
|
|
18
|
-
|
14
|
+
1. Add this extension to your Gemfile with this line:
|
15
|
+
|
16
|
+
#### Spree >= 3.1
|
19
17
|
|
20
|
-
|
18
|
+
```ruby
|
19
|
+
gem 'spree_gateway', github: 'spree/spree_gateway'
|
20
|
+
```
|
21
21
|
|
22
|
-
|
23
|
-
gem 'spree'
|
24
|
-
gem 'spree_gateway', github: 'spree/spree_gateway', branch: 'master'
|
25
|
-
```
|
22
|
+
#### Spree 3.0 and Spree 2.x
|
26
23
|
|
27
|
-
|
24
|
+
```ruby
|
25
|
+
gem 'spree_gateway', github: 'spree/spree_gateway', branch: 'X-X-stable'
|
26
|
+
```
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '1-3-stable'
|
32
|
-
```
|
28
|
+
The `branch` option is important: it must match the version of Spree you're using.
|
29
|
+
For example, use `3-0-stable` if you're using Spree `3-0-stable` or any `3.0.x` version.
|
33
30
|
|
34
|
-
|
31
|
+
2. Install the gem using Bundler:
|
32
|
+
```ruby
|
33
|
+
bundle install
|
34
|
+
```
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
3. Copy & run migrations
|
37
|
+
```ruby
|
38
|
+
bundle exec rails g spree_gateway:install
|
39
|
+
```
|
38
40
|
|
39
41
|
Finally, make sure to **restart your app**. Navigate to *Configuration > Payment Methods > New Payment Method* in the admin panel and you should see that a bunch of additional gateways have been added to the list.
|
40
42
|
|
@@ -8,11 +8,11 @@ module Spree
|
|
8
8
|
ActiveMerchant::Billing::AuthorizeNetGateway
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def options
|
12
12
|
if !['live','test'].include?(self.preferred_server)
|
13
13
|
raise "You must set the 'server' preference in your payment method (Gateway::AuthorizeNet) to either 'live' or 'test'"
|
14
14
|
end
|
15
|
-
|
15
|
+
super().merge(test: (self.preferred_server != "live"))
|
16
16
|
end
|
17
17
|
|
18
18
|
def cancel(response_code)
|
@@ -25,7 +25,6 @@ module Spree
|
|
25
25
|
|
26
26
|
response
|
27
27
|
end
|
28
|
-
alias_method_chain :options, :test_preference
|
29
28
|
|
30
29
|
def credit(amount, response_code, refund, gateway_options = {})
|
31
30
|
gateway_options[:card_number] = refund[:originator].payment.source.last_digits
|
@@ -32,10 +32,9 @@ module Spree
|
|
32
32
|
payment.send(:gateway_error, ex.message)
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
|
35
|
+
def options
|
36
|
+
super().merge(:test => self.preferred_test_mode)
|
37
37
|
end
|
38
|
-
alias_method_chain :options, :test_preference
|
39
38
|
|
40
39
|
def payment_profiles_supported?
|
41
40
|
true
|
@@ -11,10 +11,8 @@ module Spree
|
|
11
11
|
ActiveMerchant::Billing::EwayGateway
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def options
|
15
|
+
super().merge(:test => self.preferred_test_mode)
|
16
16
|
end
|
17
|
-
|
18
|
-
alias_method_chain :options, :test_preference
|
19
17
|
end
|
20
18
|
end
|
@@ -7,10 +7,8 @@ module Spree
|
|
7
7
|
ActiveMerchant::Billing::PayJunctionGateway
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def options
|
11
|
+
super().merge(:test => self.preferred_test_mode)
|
12
12
|
end
|
13
|
-
|
14
|
-
alias_method_chain :options, :test_preference
|
15
13
|
end
|
16
14
|
end
|
@@ -8,11 +8,8 @@ module Spree
|
|
8
8
|
ActiveMerchant::Billing::PayflowGateway
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def options
|
12
|
+
super().merge(:test => self.preferred_test_mode)
|
13
13
|
end
|
14
|
-
|
15
|
-
alias_method_chain :options, :test_preference
|
16
|
-
|
17
14
|
end
|
18
15
|
end
|
@@ -6,6 +6,13 @@ module Spree
|
|
6
6
|
CARD_TYPE_MAPPING = {
|
7
7
|
'American Express' => 'american_express',
|
8
8
|
'Diners Club' => 'diners_club',
|
9
|
+
'Discover' => 'discover',
|
10
|
+
'JCB' => 'jcb',
|
11
|
+
'Laser' => 'laser',
|
12
|
+
'Maestro' => 'maestro',
|
13
|
+
'MasterCard' => 'master',
|
14
|
+
'Solo' => 'solo',
|
15
|
+
'Switch' => 'switch',
|
9
16
|
'Visa' => 'visa'
|
10
17
|
}
|
11
18
|
|
@@ -61,8 +68,12 @@ module Spree
|
|
61
68
|
|
62
69
|
response = provider.store(creditcard, options)
|
63
70
|
if response.success?
|
71
|
+
cc_type=payment.source.cc_type
|
72
|
+
response_cc_type = response.params['sources']['data'].first['brand']
|
73
|
+
cc_type = CARD_TYPE_MAPPING[response_cc_type] if CARD_TYPE_MAPPING.include?(response_cc_type)
|
74
|
+
|
64
75
|
payment.source.update_attributes!({
|
65
|
-
cc_type:
|
76
|
+
cc_type: cc_type, # side-effect of update_source!
|
66
77
|
gateway_customer_profile_id: response.params['id'],
|
67
78
|
gateway_payment_profile_id: response.params['default_source'] || response.params['default_card']
|
68
79
|
})
|
@@ -79,6 +79,7 @@ describe "Stripe checkout", type: :feature do
|
|
79
79
|
it "shows an error with invalid security fields", :js => true do
|
80
80
|
fill_in "Card Number", :with => "4242 4242 4242 4242"
|
81
81
|
fill_in "Expiration", :with => "01 / #{Time.now.year + 1}"
|
82
|
+
fill_in "Card Code", :with => "99"
|
82
83
|
click_button "Save and Continue"
|
83
84
|
wait_for_stripe
|
84
85
|
expect(page).to have_content("Your card's security code is invalid.")
|
@@ -69,8 +69,23 @@ describe Spree::Gateway::BraintreeGateway do
|
|
69
69
|
|
70
70
|
describe 'payment profile failure' do
|
71
71
|
before do
|
72
|
-
|
73
|
-
|
72
|
+
country = Spree::Country.default
|
73
|
+
state = country.states.first
|
74
|
+
address = create(:address,
|
75
|
+
firstname: 'John',
|
76
|
+
lastname: 'Doe',
|
77
|
+
address1: '1234 My Street',
|
78
|
+
address2: 'Apt 1',
|
79
|
+
city: 'Washington DC',
|
80
|
+
zipcode: '20123',
|
81
|
+
phone: '(555)555-5555',
|
82
|
+
state: state,
|
83
|
+
country: country
|
84
|
+
)
|
85
|
+
@address = address
|
86
|
+
|
87
|
+
@order = create(:order_with_totals, bill_address: address, ship_address: address)
|
88
|
+
@order.update_with_updater!
|
74
89
|
|
75
90
|
@credit_card = create(:credit_card,
|
76
91
|
verification_value: '123',
|
@@ -82,7 +97,7 @@ describe Spree::Gateway::BraintreeGateway do
|
|
82
97
|
end
|
83
98
|
|
84
99
|
it 'should fail creation' do
|
85
|
-
expect{ create(:payment, source: @credit_card, order: order, payment_method: @gateway, amount: 10.00) }.to raise_error
|
100
|
+
expect{ create(:payment, source: @credit_card, order: @order, payment_method: @gateway, amount: 10.00) }.to raise_error Spree::Core::GatewayError
|
86
101
|
end
|
87
102
|
|
88
103
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -14,7 +14,6 @@ require 'capybara-screenshot/rspec'
|
|
14
14
|
require 'database_cleaner'
|
15
15
|
require 'ffaker'
|
16
16
|
require 'rspec/active_model/mocks'
|
17
|
-
require 'rails-controller-testing'
|
18
17
|
|
19
18
|
Dir[File.join(File.dirname(__FILE__), "support", "**", "*.rb")].each { |f| require f }
|
20
19
|
|
@@ -54,10 +53,4 @@ RSpec.configure do |config|
|
|
54
53
|
end
|
55
54
|
|
56
55
|
Capybara.javascript_driver = :poltergeist
|
57
|
-
|
58
|
-
[:controller, :view, :request].each do |type|
|
59
|
-
config.include ::Rails::Controller::Testing::TestProcess, type: type
|
60
|
-
config.include ::Rails::Controller::Testing::TemplateAssertions, type: type
|
61
|
-
config.include ::Rails::Controller::Testing::Integration, type: type
|
62
|
-
end
|
63
56
|
end
|
data/spree_gateway.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_gateway'
|
5
|
-
s.version = '3.2.0
|
5
|
+
s.version = '3.2.0'
|
6
6
|
s.summary = 'Additional Payment Gateways for Spree Commerce'
|
7
7
|
s.description = s.summary
|
8
8
|
|
@@ -39,5 +39,5 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.add_development_dependency 'selenium-webdriver'
|
40
40
|
s.add_development_dependency 'simplecov'
|
41
41
|
s.add_development_dependency 'sqlite3'
|
42
|
-
s.add_development_dependency '
|
42
|
+
s.add_development_dependency 'appraisal'
|
43
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spree Commerce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -311,7 +311,7 @@ dependencies:
|
|
311
311
|
- !ruby/object:Gem::Version
|
312
312
|
version: '0'
|
313
313
|
- !ruby/object:Gem::Dependency
|
314
|
-
name:
|
314
|
+
name: appraisal
|
315
315
|
requirement: !ruby/object:Gem::Requirement
|
316
316
|
requirements:
|
317
317
|
- - ">="
|
@@ -333,6 +333,7 @@ files:
|
|
333
333
|
- ".gitignore"
|
334
334
|
- ".rspec"
|
335
335
|
- ".travis.yml"
|
336
|
+
- Appraisals
|
336
337
|
- Gemfile
|
337
338
|
- Guardfile
|
338
339
|
- LICENSE.md
|
@@ -378,6 +379,9 @@ files:
|
|
378
379
|
- db/migrate/20130415222802_update_balanced_payment_method_type.rb
|
379
380
|
- db/migrate/20131008221012_update_paypal_payment_method_type.rb
|
380
381
|
- db/migrate/20131112133401_migrate_stripe_preferences.rb
|
382
|
+
- gemfiles/spree_3_1.gemfile
|
383
|
+
- gemfiles/spree_3_2.gemfile
|
384
|
+
- gemfiles/spree_master.gemfile
|
381
385
|
- lib/active_merchant/billing/skrill.rb
|
382
386
|
- lib/assets/javascripts/spree/frontend/spree_gateway.js
|
383
387
|
- lib/assets/stylesheets/spree/frontend/spree_gateway.css
|
@@ -445,13 +449,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
445
449
|
version: '0'
|
446
450
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
447
451
|
requirements:
|
448
|
-
- - "
|
452
|
+
- - ">="
|
449
453
|
- !ruby/object:Gem::Version
|
450
|
-
version:
|
454
|
+
version: '0'
|
451
455
|
requirements:
|
452
456
|
- none
|
453
457
|
rubyforge_project:
|
454
|
-
rubygems_version: 2.
|
458
|
+
rubygems_version: 2.6.10
|
455
459
|
signing_key:
|
456
460
|
specification_version: 4
|
457
461
|
summary: Additional Payment Gateways for Spree Commerce
|