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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de80caa4522285cd27f1a301ef97b5c8a55b97ac
4
- data.tar.gz: b845e06202782fa21dc24ee638037dfc8dab433d
3
+ metadata.gz: 59d06c29878a6203de1b5ca3c4cd97b88f7ed257
4
+ data.tar.gz: 7a20a8c0667e50b87bac1cc29781a265b1eba85a
5
5
  SHA512:
6
- metadata.gz: 48adbc9c754c4ee9bf87577fc7f7ececb41c0bf04e4a938b24b4ff2876fba318f9b6fbf07974e1cdafc01316cc15d3668dd4aa909899dac2646520bc12cee1ba
7
- data.tar.gz: 899026855249b287e02426298925d293d03f375d60155543c076560d88b506160107857a7f5e5df79e0cb2cc245d4b15e1f6f8ab5a5ab8db784ef6abe0f84751
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
- coverage
17
+ .sass-cache
18
+ public/spree
19
+ .ruby-version
20
+ .ruby-gemset
21
+ gemfiles/*.gemfile.lock
data/.rspec CHANGED
@@ -1 +1,3 @@
1
- --colour
1
+ --color
2
+ -r spec_helper
3
+ -f documentation
data/.travis.yml CHANGED
@@ -1,11 +1,28 @@
1
- before_script:
2
- - bundle exec rake test_app
3
- - export DISPLAY=:99.0
4
- - sh -e /etc/init.d/xvfb start
1
+ sudo: required
2
+ dist: trusty
3
+
4
+ language: ruby
5
+
5
6
  env:
6
- - DB=mysql
7
7
  - DB=postgres
8
- language: ruby
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.2.5
11
- sudo: false
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.png?branch=master)](https://travis-ci.org/spree/spree_gateway)
4
- [![Code Climate](https://codeclimate.com/github/spree/spree_gateway.png)](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
- In your Gemfile:
14
+ 1. Add this extension to your Gemfile with this line:
15
+
16
+ #### Spree >= 3.1
19
17
 
20
- **Spree edge**
18
+ ```ruby
19
+ gem 'spree_gateway', github: 'spree/spree_gateway'
20
+ ```
21
21
 
22
- ```ruby
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
- **Spree 1.3**
24
+ ```ruby
25
+ gem 'spree_gateway', github: 'spree/spree_gateway', branch: 'X-X-stable'
26
+ ```
28
27
 
29
- ```ruby
30
- gem 'spree', '~> 1.3'
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
- Then run from the command line:
31
+ 2. Install the gem using Bundler:
32
+ ```ruby
33
+ bundle install
34
+ ```
35
35
 
36
- $ bundle install
37
- $ rails g spree_gateway:install
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 options_with_test_preference
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
- options_without_test_preference.merge(test: (self.preferred_server != "live") )
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 options_with_test_preference
36
- options_without_test_preference.merge(:test => self.preferred_test_mode)
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 options_with_test_preference
15
- options_without_test_preference.merge(:test => self.preferred_test_mode)
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 options_with_test_preference
11
- options_without_test_preference.merge(:test => self.preferred_test_mode)
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 options_with_test_preference
12
- options_without_test_preference.merge(:test => self.preferred_test_mode)
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: payment.source.cc_type, # side-effect of update_source!
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
  })
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "spree", "~> 3.1.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "spree", "~> 3.2.0"
6
+ gem "rails-controller-testing"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "spree", :github => "spree/spree", :branch => "master"
6
+ gem "rails-controller-testing"
7
+
8
+ gemspec :path => "../"
@@ -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
- order = create(:order_with_totals, bill_address: address, ship_address: address)
73
- order.update_with_updater!
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
@@ -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.beta'
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 'rails-controller-testing'
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.beta
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: 2016-12-06 00:00:00.000000000 Z
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: rails-controller-testing
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: 1.3.1
454
+ version: '0'
451
455
  requirements:
452
456
  - none
453
457
  rubyforge_project:
454
- rubygems_version: 2.5.1
458
+ rubygems_version: 2.6.10
455
459
  signing_key:
456
460
  specification_version: 4
457
461
  summary: Additional Payment Gateways for Spree Commerce