Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix expired SSL certificate Error from using the old PayPal SDK. #214

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 36 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,56 @@
sudo: required
dist: trusty
---
os: linux
dist: bionic

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable

services:
- mysql
- postgresql

language: ruby

script:
- bundle exec rake test_app
- bundle exec rake spec
rvm:
- 2.5
- 2.6

env:
- DB=mysql
- DB=postgres

addons:
chrome: stable
postgresql: 9.4

rvm:
- 2.3.8
- 2.4.4
- 2.5.1

gemfile:
- gemfiles/spree_3_5.gemfile
- gemfiles/spree_3_7.gemfile
- gemfiles/spree_4_0.gemfile
- gemfiles/spree_4_1.gemfile
- gemfiles/spree_master.gemfile

before_install:
- mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"

matrix:
jobs:
exclude:
- rvm: 2.5.1
gemfile: gemfiles/spree_3_5.gemfile
- rvm: 2.4.4
- rvm: 2.6
gemfile: gemfiles/spree_3_7.gemfile
- rvm: 2.5
gemfile: gemfiles/spree_4_0.gemfile
- rvm: 2.3.8
gemfile: gemfiles/spree_4_0.gemfile
- rvm: 2.4.4
gemfile: gemfiles/spree_master.gemfile
- rvm: 2.3.8
- rvm: 2.5
gemfile: gemfiles/spree_4_1.gemfile
- rvm: 2.5
gemfile: gemfiles/spree_master.gemfile
allow_failures:
- gemfile: gemfiles/spree_master.gemfile
- gemfile: gemfiles/spree_master.gemfile

before_install:
- mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
- wget -N https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip -P ~/
- unzip ~/chromedriver_linux64.zip -d ~/
- rm ~/chromedriver_linux64.zip
- sudo mv -f ~/chromedriver /usr/local/share/
- sudo chmod +x /usr/local/share/chromedriver
- sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver

before_script:
- CHROME_MAIN_VERSION=`google-chrome-stable --version | sed -E 's/(^Google Chrome |\.[0-9]+ )//g'`
- CHROMEDRIVER_VERSION=`curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAIN_VERSION"`
- curl "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" -O
- unzip chromedriver_linux64.zip -d ~/bin

script:
- bundle exec rake test_app
- bundle exec rake spec
12 changes: 7 additions & 5 deletions app/models/spree/gateway/pay_pal_express.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ def provider_class

def provider
::PayPal::SDK.configure(
:mode => preferred_server.present? ? preferred_server : "sandbox",
:username => preferred_login,
:password => preferred_password,
:signature => preferred_signature)
provider_class.new
mode: preferred_server.present? ? preferred_server : "sandbox",
username: preferred_login,
password: preferred_password,
signature: preferred_signature,
ssl_options: { ca_file: nil }
)
provider_class.new
end

def auto_capture?
Expand Down
4 changes: 2 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ en:
spree:
paypal:
already_refunded: "This payment has been refunded and no further action can be taken on it."
no_payment_via_admin_backend: "You cannot charge PayPal accounts through the admin backend at this time."
no_payment_via_admin_backend: "You cannot charge PayPal accounts through the admin back-end at this time."
transaction: "PayPal Transaction"
payer_id: "Payer ID"
transaction_id: "Transaction ID"
Expand All @@ -18,4 +18,4 @@ en:
flash:
cancel: "Don't want to use PayPal? No problems."
connection_failed: "Could not connect to PayPal."
generic_error: "PayPal failed. %{reasons}"
generic_error: "PayPal failed. %{reasons}"
8 changes: 0 additions & 8 deletions gemfiles/spree_3_5.gemfile

This file was deleted.

10 changes: 5 additions & 5 deletions gemfiles/spree_3_7.gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"
source 'https://rubygems.org'

gem "spree", "~> 3.7.0"
gem "rails-controller-testing"
gem "sass-rails"
gem 'spree', '~> 3.7.0'
gem 'rails-controller-testing'
gem 'sass-rails'

gemspec path: "../"
gemspec path: '../'
8 changes: 4 additions & 4 deletions gemfiles/spree_4_0.gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"
source 'https://rubygems.org'

gem "spree", "~> 4.0.0.rc2"
gem "rails-controller-testing"
gem 'spree', '~> 4.1.0'
gem 'rails-controller-testing'

gemspec path: "../"
gemspec path: '../'
8 changes: 8 additions & 0 deletions gemfiles/spree_4_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source 'https://rubygems.org'

gem 'spree', '~> 4.1.0'
gem 'rails-controller-testing'

gemspec path: '../'
8 changes: 4 additions & 4 deletions gemfiles/spree_master.gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"
source 'https://rubygems.org'

gem "spree", github: "spree/spree", branch: "master"
gem "rails-controller-testing"
gem 'spree', github: 'spree/spree', branch: 'master'
gem 'rails-controller-testing'

gemspec path: "../"
gemspec path: '../'
95 changes: 2 additions & 93 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,102 +1,11 @@
# Run Coverage report
require 'simplecov'
SimpleCov.start do
add_filter 'spec/dummy'
add_group 'Controllers', 'app/controllers'
add_group 'Helpers', 'app/helpers'
add_group 'Mailers', 'app/mailers'
add_group 'Models', 'app/models'
add_group 'Views', 'app/views'
add_group 'Libraries', 'lib'
end

# CodeClimate coverage
require "simplecov"
SimpleCov.start

# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'

require File.expand_path('../dummy/config/environment.rb', __FILE__)
require 'spree_dev_tools/rspec/spec_helper'

require 'rspec/rails'
require 'rspec/active_model/mocks'
require 'database_cleaner'
require 'ffaker'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }

# Requires factories and other useful helpers defined in spree_core.
require 'spree/testing_support/authorization_helpers'
require 'spree/testing_support/capybara_ext'
require 'spree/testing_support/controller_requests'
require 'spree/testing_support/factories'
require 'spree/testing_support/url_helpers'
require 'spree/testing_support/order_walkthrough'

require 'pry'
require 'webdrivers'

RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods

# Infer an example group's spec type from the file location.
config.infer_spec_type_from_file_location!

# == URL Helpers
#
# Allows access to Spree's routes in specs:
#
# visit spree.admin_path
# current_path.should eql(spree.products_path)
config.include Spree::TestingSupport::UrlHelpers
config.include Spree::TestingSupport::AuthorizationHelpers::Controller

# == Requests support
#
# Adds convenient methods to request Spree's controllers
# spree_get :index
config.include Spree::TestingSupport::ControllerRequests, type: :controller

# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec do |mocks|
mocks.syntax = [:expect, :should]
end
config.color = true

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

# Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
# to cleanup after each test instead. Without transactional fixtures set to false the records created
# to setup a test will be unavailable to the browser, which runs under a separate server instance.
config.use_transactional_fixtures = false

# Ensure Suite is set to use transactions for speed.
config.before :suite do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with :truncation
end

# Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
config.before :each do
DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.start
end

# After each spec clean the database.
config.after :each do
DatabaseCleaner.clean
end

config.fail_fast = ENV['FAIL_FAST'] || false
config.order = 'random'
end
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].sort.each { |f| require f }
6 changes: 3 additions & 3 deletions spec/support/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
require 'selenium-webdriver'
require 'webdrivers'

RSpec.configure do |config|
RSpec.configure do |_config|
Capybara.register_driver :chrome do |app|
Selenium::WebDriver.logger.level = :error

Capybara::Selenium::Driver.new app,
browser: :chrome,
options: Selenium::WebDriver::Chrome::Options.new(args: %w[disable-popup-blocking headless disable-gpu window-size=1920,1080])
browser: :chrome,
options: Selenium::WebDriver::Chrome::Options.new(args: %w[disable-popup-blocking headless disable-gpu window-size=1920,1080])
end

Capybara.javascript_driver = :chrome
Expand Down
4 changes: 2 additions & 2 deletions spec/support/capybara_ext.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module CapybaraExt
def wait_for(options = {})
default_options = { error: nil, seconds: 5 }.merge(options)

Selenium::WebDriver::Wait.new(timeout: default_options[:seconds]).until { yield }
rescue Selenium::WebDriver::Error::TimeOutError
default_options[:error].nil? ? false : raise(default_options[:error])
Expand All @@ -10,4 +10,4 @@ def wait_for(options = {})
RSpec.configure do |c|
c.include CapybaraExt
end
end
end
19 changes: 1 addition & 18 deletions spree_paypal_express.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ Gem::Specification.new do |s|
s.add_dependency 'paypal-sdk-merchant'
s.add_dependency 'spree_extension'

s.add_development_dependency 'capybara'
s.add_development_dependency 'capybara-screenshot'
s.add_development_dependency 'selenium-webdriver'
s.add_development_dependency 'webdrivers', '~> 4.1'
s.add_development_dependency 'coffee-rails'
s.add_development_dependency 'database_cleaner'
s.add_development_dependency 'factory_bot', '~> 4.7'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'rspec-rails', '~> 4.0.0.beta2'
s.add_development_dependency 'rspec-activemodel-mocks'
s.add_development_dependency 'sass-rails'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'pry'
s.add_development_dependency 'require_all'
s.add_development_dependency 'pg'
s.add_development_dependency 'puma'
s.add_development_dependency 'mysql2'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'appraisal'
s.add_development_dependency 'spree_dev_tools'
end