spree_gateway 3.4.1 → 3.6.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
  SHA256:
3
- metadata.gz: ab0af879a6877329f9bf577c68c4be1c24970bf5b966f29e1b08f2b00f1072c4
4
- data.tar.gz: 8cef017de3de845ac500f50c2e2ee8f67be8c620bff0eb646134730dfe5a79b9
3
+ metadata.gz: 1a46b08f61300dc52d37b71bd1bc6357f9f0d28ce952ed6885c73a1f176d228d
4
+ data.tar.gz: 6fd7292e92776ad777132602e67b4d9711dac6668fc72105177af6e71a113bb1
5
5
  SHA512:
6
- metadata.gz: 0e353d5f589c1586bbfb149313f4a222858254415ce6d973a2c371c6ef28780ce07d82723d683d35d4403f2cceb249ff13bff14dee2f6cb9b5e0ca673325d17e
7
- data.tar.gz: f8ea33e2365305a84153714ba96fc10c04827aac9140ec36a9c5fe2de6414bfc9742da53cb7b73a7e77c777bf388fe5e73eabc9839a371d367fc1e602afca93a
6
+ metadata.gz: e2d0959d8367e402e3a7245a80bb00d5d13fb1da36c97d09089750e3f5740ee3231fccaede466f15d37dfe9b524a70b0842886f95a0b24e5ed842baa9b13d284
7
+ data.tar.gz: facedd67685ede7e306d8e3a46f57f1d07c8f39371ab8b771ab82b92bf509d8c7efe1d6cbe3459c2571c9a2a05abd1c46d491e407aa4473017ae6ba1130b6b44
@@ -5,15 +5,16 @@ language: ruby
5
5
 
6
6
  addons:
7
7
  chrome: stable
8
+ postgresql: 9.4
8
9
 
9
10
  env:
10
11
  - DB=postgres
11
12
  - DB=mysql
12
13
 
13
14
  gemfile:
14
- - gemfiles/spree_3_2.gemfile
15
+ # - gemfiles/spree_3_2.gemfile
15
16
  - gemfiles/spree_3_5.gemfile
16
- - gemfiles/spree_3_6.gemfile
17
+ - gemfiles/spree_3_7.gemfile
17
18
  - gemfiles/spree_master.gemfile
18
19
 
19
20
  script:
@@ -27,7 +28,16 @@ rvm:
27
28
 
28
29
  matrix:
29
30
  allow_failures:
30
- - gemfile: gemfiles/spree_master.gemfile
31
+ - gemfile: gemfiles/spree_master.gemfile
32
+ exclude:
33
+ - rvm: 2.3.7
34
+ gemfile: gemfiles/spree_master.gemfile
35
+ - rvm: 2.4.4
36
+ gemfile: gemfiles/spree_master.gemfile
37
+ - rvm: 2.5.1
38
+ gemfile: gemfiles/spree_3_2.gemfile
39
+ - rvm: 2.4.4
40
+ gemfile: gemfiles/spree_3_2.gemfile
31
41
 
32
42
  before_install:
33
43
  - mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
data/Appraisals CHANGED
@@ -8,8 +8,9 @@ appraise 'spree-3-5' do
8
8
  gem 'rails-controller-testing'
9
9
  end
10
10
 
11
- appraise 'spree-3-6' do
12
- gem 'spree', '~> 3.6.0'
11
+ appraise 'spree-3-7' do
12
+ gem 'spree', '~> 3.7.0'
13
+ gem 'sass-rails'
13
14
  gem 'rails-controller-testing'
14
15
  end
15
16
 
data/README.md CHANGED
@@ -25,7 +25,7 @@ Supported payment gateways:
25
25
  * QuickPay
26
26
  * sage Pay
27
27
  * SecurePay
28
- * Spreadly
28
+ * Spreedly
29
29
  * Stripe (with Stripe Elements)
30
30
  * USAePay
31
31
  * Worldpay (previously Cardsave)
@@ -0,0 +1,20 @@
1
+ module Spree
2
+ module ApplePayOrderDecorator
3
+ def confirmation_required?
4
+ return false if paid_with_apple_pay?
5
+
6
+ # Little hacky fix for #4117
7
+ # If this wasn't here, order would transition to address state on confirm failure
8
+ # because there would be no valid payments any more.
9
+ Spree::Config[:always_include_confirm_step] ||
10
+ payments.valid.map(&:payment_method).compact.any?(&:payment_profiles_supported?) ||
11
+ confirm?
12
+ end
13
+
14
+ def paid_with_apple_pay?
15
+ payments.valid.any?(&:apple_pay?)
16
+ end
17
+ end
18
+ end
19
+
20
+ Spree::Order.prepend Spree::ApplePayOrderDecorator
@@ -1,4 +1,4 @@
1
- module SpreeGateway
1
+ module Spree
2
2
  module ApplePayPaymentDecorator
3
3
  def apple_pay?
4
4
  payment_method.is_a? Spree::Gateway::StripeApplePayGateway
@@ -6,4 +6,4 @@ module SpreeGateway
6
6
  end
7
7
  end
8
8
 
9
- Spree::Payment.prepend SpreeGateway::ApplePayPaymentDecorator
9
+ Spree::Payment.prepend Spree::ApplePayPaymentDecorator
@@ -3,6 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails-controller-testing"
6
- gem "spree", "~> 3.6.0"
6
+ gem "spree", "~> 3.7.0"
7
+ gem "sass-rails"
7
8
 
8
9
  gemspec path: "../"
@@ -1 +1,75 @@
1
- <%= render "spree/admin/payments/source_forms/gateway", payment_method: payment_method, previous_cards: payment_method.reusable_sources(@order) %>
1
+ <%= render "spree/admin/payments/source_forms/gateway", payment_method: payment_method, previous_cards: payment_method.reusable_sources(@order) %>
2
+
3
+ <script type="text/javascript" src="https://js.stripe.com/v2/"></script>
4
+ <script type="text/javascript">
5
+ Stripe.setPublishableKey("<%= payment_method.preferred_publishable_key %>");
6
+ </script>
7
+
8
+ <script>
9
+ Spree.stripePaymentMethod = $('#payment_method_' + <%= payment_method.id %>);
10
+ var mapCC, stripeResponseHandler;
11
+ mapCC = function(ccType) {
12
+ if (ccType === 'MasterCard') {
13
+ return 'mastercard';
14
+ } else if (ccType === 'Visa') {
15
+ return 'visa';
16
+ } else if (ccType === 'American Express') {
17
+ return 'amex';
18
+ } else if (ccType === 'Discover') {
19
+ return 'discover';
20
+ } else if (ccType === 'Diners Club') {
21
+ return 'dinersclub';
22
+ } else if (ccType === 'JCB') {
23
+ return 'jcb';
24
+ }
25
+ };
26
+ stripeResponseHandler = function(status, response) {
27
+ var paymentMethodId, token;
28
+ if (response.error) {
29
+ $('#stripeError').html(response.error.message);
30
+ var param_map = {
31
+ number: '#card_number',
32
+ exp_month: '#card_expiry',
33
+ exp_year: '#card_expiry',
34
+ cvc: '#card_code'
35
+ }
36
+ if (response.error.param) {
37
+ errorField = Spree.stripePaymentMethod.find(param_map[response.error.param])
38
+ errorField.addClass('error');
39
+ errorField.parent().addClass('has-error');
40
+ }
41
+ return $('#stripeError').show();
42
+ } else {
43
+ Spree.stripePaymentMethod.find('#card_number<%= payment_method.id %>, #card_expiry<%= payment_method.id %>, #card_code<%= payment_method.id %>').prop("disabled", true);
44
+ Spree.stripePaymentMethod.find(".ccType").prop("disabled", false);
45
+ Spree.stripePaymentMethod.find(".ccType").val(mapCC(response.card.brand));
46
+ token = response['id'];
47
+ paymentMethodId = Spree.stripePaymentMethod.prop('id').split("_")[2];
48
+ Spree.stripePaymentMethod.append("<input type='hidden' class='stripeToken' name='payment_source[" + paymentMethodId + "][gateway_payment_profile_id]' value='" + token + "'/>");
49
+ Spree.stripePaymentMethod.append("<input type='hidden' class='stripeToken' name='payment_source[" + paymentMethodId + "][last_digits]' value='" + response.card.last4 + "'/>");
50
+ Spree.stripePaymentMethod.append("<input type='hidden' class='stripeToken' name='payment_source[" + paymentMethodId + "][month]' value='" + response.card.exp_month + "'/>");
51
+ Spree.stripePaymentMethod.append("<input type='hidden' class='stripeToken' name='payment_source[" + paymentMethodId + "][year]' value='" + response.card.exp_year + "'/>");
52
+ return Spree.stripePaymentMethod.parents("form").trigger('submit');
53
+ }
54
+ };
55
+
56
+ Spree.ready(function() {
57
+ Spree.stripePaymentMethod.prepend("<div id='stripeError' class='errorExplanation alert alert-danger' style='display:none'></div>");
58
+ return $('#new_payment [data-hook=buttons]').click(function() {
59
+ var expiration, params;
60
+ $('#stripeError').hide();
61
+ Spree.stripePaymentMethod.find('#card_number, #card_expiry, #card_code').removeClass('error');
62
+ if (Spree.stripePaymentMethod.is(':visible')) {
63
+ expiration = $('.cardExpiry:visible').payment('cardExpiryVal');
64
+ params = $.extend({
65
+ number: $('.cardNumber:visible').val(),
66
+ cvc: $('.cardCode:visible').val(),
67
+ exp_month: expiration.month || 0,
68
+ exp_year: expiration.year || 0
69
+ }, Spree.stripeAdditionalInfo);
70
+ Stripe.card.createToken(params, stripeResponseHandler);
71
+ return false;
72
+ }
73
+ });
74
+ });
75
+ </script>
@@ -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.4.1'
5
+ s.version = '3.6.0'
6
6
  s.summary = 'Additional Payment Gateways for Spree Commerce'
7
7
  s.description = s.summary
8
8
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.require_path = 'lib'
17
17
  s.requirements << 'none'
18
18
 
19
- spree_version = '>= 3.1.0', '< 4.0'
19
+ spree_version = '>= 3.1.0', '< 5.0'
20
20
  s.add_dependency 'spree_core', spree_version
21
21
  s.add_dependency 'spree_extension'
22
22
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency 'capybara-screenshot'
28
28
  s.add_development_dependency 'coffee-rails'
29
29
  s.add_development_dependency 'database_cleaner'
30
- s.add_development_dependency 'factory_bot'
30
+ s.add_development_dependency 'factory_bot', '~> 4.7'
31
31
  s.add_development_dependency 'ffaker'
32
32
  s.add_development_dependency 'guard-rspec'
33
33
  s.add_development_dependency 'launchy'
@@ -40,5 +40,5 @@ Gem::Specification.new do |s|
40
40
  s.add_development_dependency 'sass-rails'
41
41
  s.add_development_dependency 'selenium-webdriver'
42
42
  s.add_development_dependency 'simplecov'
43
- s.add_development_dependency 'sqlite3'
43
+ s.add_development_dependency 'sqlite3', '~> 1.4.1'
44
44
  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.4.1
4
+ version: 3.6.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: 2019-01-18 00:00:00.000000000 Z
11
+ date: 2019-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 3.1.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4.0'
22
+ version: '5.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 3.1.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4.0'
32
+ version: '5.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: spree_extension
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -146,16 +146,16 @@ dependencies:
146
146
  name: factory_bot
147
147
  requirement: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ">="
149
+ - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '0'
151
+ version: '4.7'
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - ">="
156
+ - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '0'
158
+ version: '4.7'
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: ffaker
161
161
  requirement: !ruby/object:Gem::Requirement
@@ -328,16 +328,16 @@ dependencies:
328
328
  name: sqlite3
329
329
  requirement: !ruby/object:Gem::Requirement
330
330
  requirements:
331
- - - ">="
331
+ - - "~>"
332
332
  - !ruby/object:Gem::Version
333
- version: '0'
333
+ version: 1.4.1
334
334
  type: :development
335
335
  prerelease: false
336
336
  version_requirements: !ruby/object:Gem::Requirement
337
337
  requirements:
338
- - - ">="
338
+ - - "~>"
339
339
  - !ruby/object:Gem::Version
340
- version: '0'
340
+ version: 1.4.1
341
341
  description: Additional Payment Gateways for Spree Commerce
342
342
  email: gems@spreecommerce.com
343
343
  executables: []
@@ -353,6 +353,8 @@ files:
353
353
  - LICENSE.md
354
354
  - README.md
355
355
  - Rakefile
356
+ - app/models/spree/apple_pay_order_decorator.rb
357
+ - app/models/spree/apple_pay_payment_decorator.rb
356
358
  - app/models/spree/billing_integration.rb
357
359
  - app/models/spree/gateway/authorize_net.rb
358
360
  - app/models/spree/gateway/authorize_net_cim.rb
@@ -383,8 +385,6 @@ files:
383
385
  - app/models/spree/gateway/stripe_gateway.rb
384
386
  - app/models/spree/gateway/usa_epay_transaction.rb
385
387
  - app/models/spree/gateway/worldpay.rb
386
- - app/models/spree/order_decorator.rb
387
- - app/models/spree/payment_decorator.rb
388
388
  - config/locales/bg.yml
389
389
  - config/locales/de.yml
390
390
  - config/locales/en.yml
@@ -397,7 +397,7 @@ files:
397
397
  - db/migrate/20131112133401_migrate_stripe_preferences.rb
398
398
  - gemfiles/spree_3_2.gemfile
399
399
  - gemfiles/spree_3_5.gemfile
400
- - gemfiles/spree_3_6.gemfile
400
+ - gemfiles/spree_3_7.gemfile
401
401
  - gemfiles/spree_master.gemfile
402
402
  - lib/controllers/spree/apple_pay_domain_verification_controller.rb
403
403
  - lib/generators/spree_gateway/install/install_generator.rb
@@ -464,8 +464,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
464
464
  version: '0'
465
465
  requirements:
466
466
  - none
467
- rubyforge_project:
468
- rubygems_version: 2.7.8
467
+ rubygems_version: 3.0.2
469
468
  signing_key:
470
469
  specification_version: 4
471
470
  summary: Additional Payment Gateways for Spree Commerce
@@ -1,16 +0,0 @@
1
- Spree::Order.class_eval do
2
- def confirmation_required?
3
- return false if paid_with_apple_pay?
4
-
5
- Spree::Config[:always_include_confirm_step] ||
6
- payments.valid.map(&:payment_method).compact.any?(&:payment_profiles_supported?) ||
7
- # Little hacky fix for #4117
8
- # If this wasn't here, order would transition to address state on confirm failure
9
- # because there would be no valid payments any more.
10
- confirm?
11
- end
12
-
13
- def paid_with_apple_pay?
14
- payments.valid.any?(&:apple_pay?)
15
- end
16
- end