spree_gateway 3.3.3 → 3.3.5

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
- SHA1:
3
- metadata.gz: 0797ee9ac672b7bc3c0d560df24c63ae049ceb09
4
- data.tar.gz: 3aa79156ee10d3c62c8dde5fe221ad39fd65e58c
2
+ SHA256:
3
+ metadata.gz: 648d40901742451fde4132f84a47a1cb6cd87da368e231026bd43bc0de827317
4
+ data.tar.gz: a7074f7a84f7f59e91302d2fa40d939d074df09665a6c5187cf2282104a5d934
5
5
  SHA512:
6
- metadata.gz: 9638942a8d2612a426f121e34e8d8b6df4cd6dc90da9f4494ac5b59782310825b068a81b34335757697212ed2b4345a8db7a91a3c4bd8de37a9a913b2f27c800
7
- data.tar.gz: 0d7f46182bea7350373611872731922d87bc2559c9fea6210af45934b2d952e36ddab6bb0a2b28422244c24e42e68a39625019d3a5c110cfc9e44ce3e00684f8
6
+ metadata.gz: ab2a9999f550f7c983f74fd4d373e5283e8b4c851c51db219358c8003f3d0c24fef1436ee259fc872399e40c8660c843d3edb589f6371739ed92379dc869473e
7
+ data.tar.gz: 03dfc59510f180067067e29cdd37cbd4a545c1b172c0a096ede0a9a3f1ff8006be49b35ac93755c15eeede25a94bff3f9016f0a887505d21b71f87b9183d75ed
data/.travis.yml CHANGED
@@ -3,6 +3,9 @@ dist: trusty
3
3
 
4
4
  language: ruby
5
5
 
6
+ addons:
7
+ chrome: stable
8
+
6
9
  env:
7
10
  - DB=postgres
8
11
  - DB=mysql
@@ -26,3 +29,9 @@ matrix:
26
29
 
27
30
  before_install:
28
31
  - mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
32
+ - wget -N https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip -P ~/
33
+ - unzip ~/chromedriver_linux64.zip -d ~/
34
+ - rm ~/chromedriver_linux64.zip
35
+ - sudo mv -f ~/chromedriver /usr/local/share/
36
+ - sudo chmod +x /usr/local/share/chromedriver
37
+ - sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
@@ -40,16 +40,16 @@ module Spree
40
40
  provider.capture(money, response_code, gateway_options)
41
41
  end
42
42
 
43
- def credit(money, creditcard, response_code, gateway_options)
44
- provider.refund(money, response_code, {})
43
+ def credit(money, creditcard, response_code, gateway_options)tes
44
+ provider.refund(money, response_code, {}, gateway_options)
45
45
  end
46
46
 
47
47
  def void(response_code, creditcard, gateway_options)
48
- provider.void(response_code, {})
48
+ provider.void(response_code, {}, gateway_options)
49
49
  end
50
50
 
51
51
  def cancel(response_code)
52
- provider.void(response_code, {})
52
+ provider.void(response_code, {}, gateway_options)
53
53
  end
54
54
 
55
55
  def create_profile(payment)
@@ -87,14 +87,17 @@ module Spree
87
87
 
88
88
  # In this gateway, what we call 'secret_key' is the 'login'
89
89
  def options
90
- options = super
91
- options.merge(:login => preferred_secret_key)
90
+ super.merge(
91
+ login: preferred_secret_key,
92
+ application: app_info
93
+ )
92
94
  end
93
95
 
94
96
  def options_for_purchase_or_auth(money, creditcard, gateway_options)
95
97
  options = {}
96
98
  options[:description] = "Spree Order ID: #{gateway_options[:order_id]}"
97
99
  options[:currency] = gateway_options[:currency]
100
+ options[:application] = app_info
98
101
 
99
102
  if customer = creditcard.gateway_customer_profile_id
100
103
  options[:customer] = customer
@@ -133,5 +136,11 @@ module Spree
133
136
  source.cc_type = CARD_TYPE_MAPPING[source.cc_type] if CARD_TYPE_MAPPING.include?(source.cc_type)
134
137
  source
135
138
  end
139
+
140
+ def app_info
141
+ name_with_version = "SpreeGateway/#{SpreeGateway.version}"
142
+ url = 'https://spreecommerce.org'
143
+ "#{name_with_version} #{url}"
144
+ end
136
145
  end
137
146
  end
@@ -0,0 +1,17 @@
1
+ ActiveMerchant::Billing::StripeGateway.class_eval do
2
+ private
3
+
4
+ alias_method :original_headers, :headers
5
+ alias_method :original_add_customer_data, :add_customer_data
6
+
7
+ def headers(options = {})
8
+ headers = original_headers(options)
9
+ headers['User-Agent'] = headers['X-Stripe-Client-User-Agent']
10
+ headers
11
+ end
12
+
13
+ def add_customer_data(post, options)
14
+ original_add_customer_data(post, options)
15
+ post[:payment_user_agent] = "SpreeGateway/#{SpreeGateway.version}"
16
+ end
17
+ end
data/lib/spree_gateway.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'spree_core'
2
2
  require 'spree_gateway/engine'
3
+ require 'spree_gateway/version'
3
4
  require 'sass/rails'
4
5
  require 'spree_extension'
@@ -44,6 +44,9 @@ module SpreeGateway
44
44
  Rails.configuration.cache_classes ? require(c) : load(c)
45
45
  end
46
46
  end
47
+ Dir.glob(File.join(File.dirname(__FILE__), '../../lib/active_merchant/**/*_decorator*.rb')) do |c|
48
+ Rails.application.config.cache_classes ? require(c) : load(c)
49
+ end
47
50
  end
48
51
 
49
52
  def self.backend_available?
@@ -0,0 +1,5 @@
1
+ module SpreeGateway
2
+ def self.version
3
+ '3.3.5'
4
+ end
5
+ end
data/spec/spec_helper.rb CHANGED
@@ -9,8 +9,9 @@ require 'rspec/rails'
9
9
  require 'rspec/active_model/mocks'
10
10
  require 'capybara/rspec'
11
11
  require 'capybara/rails'
12
- require 'capybara/poltergeist'
13
12
  require 'capybara-screenshot/rspec'
13
+ require "selenium-webdriver"
14
+ require 'webdrivers'
14
15
  require 'database_cleaner'
15
16
  require 'ffaker'
16
17
  require 'rspec/active_model/mocks'
@@ -22,7 +23,7 @@ require 'spree/testing_support/order_walkthrough'
22
23
  require 'spree/testing_support/preferences'
23
24
  require 'spree/testing_support/capybara_ext'
24
25
 
25
- FactoryBot.find_definitions
26
+ FactoryGirl.find_definitions
26
27
 
27
28
  RSpec.configure do |config|
28
29
  config.infer_spec_type_from_file_location!
@@ -34,7 +35,7 @@ RSpec.configure do |config|
34
35
  #config.filter_run focus: true
35
36
  #config.filter_run_excluding slow: true
36
37
 
37
- config.include FactoryBot::Syntax::Methods
38
+ config.include FactoryGirl::Syntax::Methods
38
39
  config.include Spree::TestingSupport::Preferences
39
40
 
40
41
  config.before :suite do
@@ -52,5 +53,13 @@ RSpec.configure do |config|
52
53
  DatabaseCleaner.clean
53
54
  end
54
55
 
55
- Capybara.javascript_driver = :poltergeist
56
+ Capybara.register_driver :chrome do |app|
57
+ Capybara::Selenium::Driver.new app,
58
+ browser: :chrome,
59
+ options: Selenium::WebDriver::Chrome::Options.new(
60
+ args: %w[no-sandbox disable-dev-shm-usage disable-popup-blocking headless disable-gpu window-size=1920,1080 --enable-features=NetworkService,NetworkServiceInProcess --disable-features=VizDisplayCompositor],
61
+ log_level: :error
62
+ )
63
+ end
64
+ Capybara.javascript_driver = :chrome
56
65
  end
@@ -1,8 +1,13 @@
1
1
  # coding: utf-8
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'spree_gateway/version'
6
+
2
7
  Gem::Specification.new do |s|
3
8
  s.platform = Gem::Platform::RUBY
4
9
  s.name = 'spree_gateway'
5
- s.version = '3.3.3'
10
+ s.version = SpreeGateway.version
6
11
  s.summary = 'Additional Payment Gateways for Spree Commerce'
7
12
  s.description = s.summary
8
13
 
@@ -25,20 +30,22 @@ Gem::Specification.new do |s|
25
30
  s.add_development_dependency 'capybara-screenshot'
26
31
  s.add_development_dependency 'coffee-rails'
27
32
  s.add_development_dependency 'database_cleaner'
28
- s.add_development_dependency 'factory_bot'
33
+ s.add_development_dependency 'factory_girl'
34
+ s.add_development_dependency 'factory_bot', '~> 4.7'
29
35
  s.add_development_dependency 'ffaker'
30
36
  s.add_development_dependency 'guard-rspec'
31
37
  s.add_development_dependency 'launchy'
32
38
  s.add_development_dependency 'mysql2'
33
39
  s.add_development_dependency 'pg', '~> 0.18'
34
- s.add_development_dependency 'poltergeist'
35
40
  s.add_development_dependency 'pry'
41
+ s.add_development_dependency 'puma'
36
42
  s.add_development_dependency 'rspec-activemodel-mocks'
37
43
  s.add_development_dependency 'rspec-rails'
38
44
  s.add_development_dependency 'bootstrap-sass', '>= 3.3.5.1'
39
45
  s.add_development_dependency 'sass-rails', '>= 3.2'
40
46
  s.add_development_dependency 'selenium-webdriver'
47
+ s.add_development_dependency 'webdrivers', '~> 3.9.0'
41
48
  s.add_development_dependency 'simplecov'
42
- s.add_development_dependency 'sqlite3'
49
+ s.add_development_dependency 'sqlite3', '~> 1.3.6'
43
50
  s.add_development_dependency 'appraisal'
44
51
  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.3.3
4
+ version: 3.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spree Commerce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2019-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -115,7 +115,7 @@ dependencies:
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  - !ruby/object:Gem::Dependency
118
- name: factory_bot
118
+ name: factory_girl
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="
@@ -128,6 +128,20 @@ dependencies:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: factory_bot
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '4.7'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '4.7'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: ffaker
133
147
  requirement: !ruby/object:Gem::Requirement
@@ -199,7 +213,7 @@ dependencies:
199
213
  - !ruby/object:Gem::Version
200
214
  version: '0.18'
201
215
  - !ruby/object:Gem::Dependency
202
- name: poltergeist
216
+ name: pry
203
217
  requirement: !ruby/object:Gem::Requirement
204
218
  requirements:
205
219
  - - ">="
@@ -213,7 +227,7 @@ dependencies:
213
227
  - !ruby/object:Gem::Version
214
228
  version: '0'
215
229
  - !ruby/object:Gem::Dependency
216
- name: pry
230
+ name: puma
217
231
  requirement: !ruby/object:Gem::Requirement
218
232
  requirements:
219
233
  - - ">="
@@ -296,6 +310,20 @@ dependencies:
296
310
  - - ">="
297
311
  - !ruby/object:Gem::Version
298
312
  version: '0'
313
+ - !ruby/object:Gem::Dependency
314
+ name: webdrivers
315
+ requirement: !ruby/object:Gem::Requirement
316
+ requirements:
317
+ - - "~>"
318
+ - !ruby/object:Gem::Version
319
+ version: 3.9.0
320
+ type: :development
321
+ prerelease: false
322
+ version_requirements: !ruby/object:Gem::Requirement
323
+ requirements:
324
+ - - "~>"
325
+ - !ruby/object:Gem::Version
326
+ version: 3.9.0
299
327
  - !ruby/object:Gem::Dependency
300
328
  name: simplecov
301
329
  requirement: !ruby/object:Gem::Requirement
@@ -314,16 +342,16 @@ dependencies:
314
342
  name: sqlite3
315
343
  requirement: !ruby/object:Gem::Requirement
316
344
  requirements:
317
- - - ">="
345
+ - - "~>"
318
346
  - !ruby/object:Gem::Version
319
- version: '0'
347
+ version: 1.3.6
320
348
  type: :development
321
349
  prerelease: false
322
350
  version_requirements: !ruby/object:Gem::Requirement
323
351
  requirements:
324
- - - ">="
352
+ - - "~>"
325
353
  - !ruby/object:Gem::Version
326
- version: '0'
354
+ version: 1.3.6
327
355
  - !ruby/object:Gem::Dependency
328
356
  name: appraisal
329
357
  requirement: !ruby/object:Gem::Requirement
@@ -393,11 +421,13 @@ files:
393
421
  - gemfiles/spree_3_1.gemfile
394
422
  - gemfiles/spree_3_2.gemfile
395
423
  - gemfiles/spree_master.gemfile
424
+ - lib/active_merchant/billing/gateways/stripe_decorator.rb
396
425
  - lib/assets/javascripts/spree/frontend/spree_gateway.js
397
426
  - lib/assets/stylesheets/spree/frontend/spree_gateway.css
398
427
  - lib/generators/spree_gateway/install/install_generator.rb
399
428
  - lib/spree_gateway.rb
400
429
  - lib/spree_gateway/engine.rb
430
+ - lib/spree_gateway/version.rb
401
431
  - lib/views/backend/spree/admin/log_entries/_braintree.html.erb
402
432
  - lib/views/backend/spree/admin/log_entries/_stripe.html.erb
403
433
  - lib/views/backend/spree/admin/payments/source_forms/_quickcheckout.html.erb
@@ -454,8 +484,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
454
484
  version: '0'
455
485
  requirements:
456
486
  - none
457
- rubyforge_project:
458
- rubygems_version: 2.6.10
487
+ rubygems_version: 3.0.2
459
488
  signing_key:
460
489
  specification_version: 4
461
490
  summary: Additional Payment Gateways for Spree Commerce