solidus_gateway 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -1
  3. data/README.md +4 -3
  4. data/app/models/spree/gateway/authorize_net.rb +2 -3
  5. data/app/models/spree/gateway/balanced_gateway.rb +2 -3
  6. data/app/models/spree/gateway/eway.rb +2 -4
  7. data/app/models/spree/gateway/pay_junction.rb +2 -4
  8. data/app/models/spree/gateway/payflow_pro.rb +2 -5
  9. data/app/models/spree/gateway/stripe_gateway.rb +8 -2
  10. data/db/migrate/20121017004102_update_braintree_payment_method_type.rb +1 -1
  11. data/db/migrate/20130213222555_update_stripe_payment_method_type.rb +1 -1
  12. data/db/migrate/20130415222802_update_balanced_payment_method_type.rb +1 -1
  13. data/db/migrate/20131008221012_update_paypal_payment_method_type.rb +1 -1
  14. data/db/migrate/20131112133401_migrate_stripe_preferences.rb +1 -1
  15. data/lib/solidus_gateway.rb +2 -1
  16. data/lib/solidus_gateway/version.rb +1 -1
  17. data/lib/spree_gateway/engine.rb +0 -5
  18. data/solidus_gateway.gemspec +3 -1
  19. data/spec/features/stripe_checkout_spec.rb +4 -0
  20. data/spec/spec_helper.rb +2 -0
  21. metadata +35 -29
  22. data/app/models/spree/billing_integration/skrill/quick_checkout.rb +0 -48
  23. data/app/models/spree/skrill_transaction.rb +0 -19
  24. data/config/locales/bg.yml +0 -11
  25. data/config/locales/de.yml +0 -11
  26. data/config/locales/en.yml +0 -30
  27. data/config/locales/it.yml +0 -30
  28. data/config/locales/sv.yml +0 -11
  29. data/config/routes.rb +0 -12
  30. data/db/migrate/20111118164631_create_skrill_transactions.rb +0 -14
  31. data/lib/active_merchant/billing/skrill.rb +0 -18
  32. data/lib/controllers/frontend/spree/checkout_controller_decorator.rb +0 -51
  33. data/lib/controllers/frontend/spree/skrill_status_controller.rb +0 -39
  34. data/lib/views/backend/spree/admin/payments/source_views/_quickcheckout.html.erb +0 -39
  35. data/lib/views/frontend/spree/checkout/payment/_quickcheckout.html.erb +0 -26
  36. data/spec/factories/skrill_factory.rb +0 -5
  37. data/spec/lib/active_merchant/billing_skrill_spec.rb +0 -18
  38. data/spec/models/billing_integration/skrill_quick_checkout_spec.rb +0 -11
  39. data/spec/models/skrill_transaction_spec.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53a4a18f259485f7da30b7413eb26805dc4b020e
4
- data.tar.gz: a5e173405475bc7ae103eb3c6538bd1457afa76c
3
+ metadata.gz: edb5286317a172fc0994ca78e1d5532a7c648cfd
4
+ data.tar.gz: b808a3847b095a1dfb4d44ded6c8a04639281f7d
5
5
  SHA512:
6
- metadata.gz: 102239a4ac27b4d035bd5884616e7a5a2f2cac02a5e558c9ea209f3168d75fd6b7b6e83b858b0c2545527ab7a391d1e07274e0e784a57e1a22fc541d94222c88
7
- data.tar.gz: f064d47f57ae61d47a0d99f25423d7773645ee77ec5bcb3044bf28f30b6f392ed3159fa07251dc4130a036588a89b15fd012df54d33d440f7f82288649947634
6
+ metadata.gz: 18233008d74271e67a697f4705c6b67b3f80a502000522670baaf6944cb162c5eaf299bb5fe7b3c3dfd44315472b8b08d4018b270bd1bea59e626054fb2b2534
7
+ data.tar.gz: e7458514a6d6be0b16a51e610f47e61eca217d8fc3a858bf70f771cda35b17a2c71da427591ea7f03cb47287d1e0cb10e8c2359b2885b0ecc7c4e67b0e30e480
data/.travis.yml CHANGED
@@ -1,8 +1,11 @@
1
- sudo: false
1
+ sudo: required
2
+ dist: trusty
2
3
  cache: bundler
3
4
  language: ruby
4
5
  rvm:
5
6
  - 2.3.1
7
+ before_install:
8
+ - mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'%';"
6
9
  env:
7
10
  matrix:
8
11
  - SOLIDUS_BRANCH=v1.1 DB=postgres
@@ -10,10 +13,16 @@ env:
10
13
  - SOLIDUS_BRANCH=v1.3 DB=postgres
11
14
  - SOLIDUS_BRANCH=v1.4 DB=postgres
12
15
  - SOLIDUS_BRANCH=v2.0 DB=postgres
16
+ - SOLIDUS_BRANCH=v2.1 DB=postgres
17
+ - SOLIDUS_BRANCH=v2.2 DB=postgres
18
+ - SOLIDUS_BRANCH=v2.3 DB=postgres
13
19
  - SOLIDUS_BRANCH=master DB=postgres
14
20
  - SOLIDUS_BRANCH=v1.1 DB=mysql
15
21
  - SOLIDUS_BRANCH=v1.2 DB=mysql
16
22
  - SOLIDUS_BRANCH=v1.3 DB=mysql
17
23
  - SOLIDUS_BRANCH=v1.4 DB=mysql
18
24
  - SOLIDUS_BRANCH=v2.0 DB=mysql
25
+ - SOLIDUS_BRANCH=v2.1 DB=mysql
26
+ - SOLIDUS_BRANCH=v2.2 DB=mysql
27
+ - SOLIDUS_BRANCH=v2.3 DB=mysql
19
28
  - SOLIDUS_BRANCH=master DB=mysql
data/README.md CHANGED
@@ -23,9 +23,10 @@ bundle install
23
23
  rails g solidus_gateway:install
24
24
  ```
25
25
 
26
- Finally, make sure to **restart your app**. Navigate to *Configuration >
27
- Payment Methods > New Payment Method* in the admin panel and you should see
28
- that a bunch of additional gateways have been added to the list.
26
+ Finally, make sure to **restart your app**. Navigate to *Settings >
27
+ Payments > Payment Methods* in the admin panel. You should see a number of payment
28
+ methods and the assigned provider for each. Click on the payment method you wish
29
+ to change the provider, and you should see a number of options under the provider dropdown.
29
30
 
30
31
  Testing
31
32
  -------
@@ -7,10 +7,9 @@ module Spree
7
7
  ActiveMerchant::Billing::AuthorizeNetGateway
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
- alias_method_chain :options, :test_preference
14
13
 
15
14
  def credit(amount, response_code, refund, gateway_options = {})
16
15
  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
@@ -9,8 +9,14 @@ module Spree
9
9
  'Visa' => 'visa'
10
10
  }
11
11
 
12
- def method_type
13
- 'stripe'
12
+ if SolidusSupport.solidus_gem_version < Gem::Version.new('2.3.x')
13
+ def method_type
14
+ 'stripe'
15
+ end
16
+ else
17
+ def partial_name
18
+ 'stripe'
19
+ end
14
20
  end
15
21
 
16
22
  def provider_class
@@ -1,4 +1,4 @@
1
- class UpdateBraintreePaymentMethodType < ActiveRecord::Migration
1
+ class UpdateBraintreePaymentMethodType < SolidusSupport::Migration[4.2]
2
2
  def up
3
3
  Spree::PaymentMethod.where(:type => "Spree::Gateway::Braintree").update_all(:type => "Spree::Gateway::BraintreeGateway")
4
4
  end
@@ -1,4 +1,4 @@
1
- class UpdateStripePaymentMethodType < ActiveRecord::Migration
1
+ class UpdateStripePaymentMethodType < SolidusSupport::Migration[4.2]
2
2
  def up
3
3
  Spree::PaymentMethod.where(:type => "Spree::Gateway::Stripe").update_all(:type => "Spree::Gateway::StripeGateway")
4
4
  end
@@ -1,4 +1,4 @@
1
- class UpdateBalancedPaymentMethodType < ActiveRecord::Migration
1
+ class UpdateBalancedPaymentMethodType < SolidusSupport::Migration[4.2]
2
2
  def up
3
3
  Spree::PaymentMethod.where(:type => "Spree::Gateway::Balanced").update_all(:type => "Spree::Gateway::BalancedGateway")
4
4
  end
@@ -1,4 +1,4 @@
1
- class UpdatePaypalPaymentMethodType < ActiveRecord::Migration
1
+ class UpdatePaypalPaymentMethodType < SolidusSupport::Migration[4.2]
2
2
  def up
3
3
  Spree::PaymentMethod.where(:type => "Spree::Gateway::PayPal").update_all(:type => "Spree::Gateway::PayPalGateway")
4
4
  end
@@ -1,4 +1,4 @@
1
- class MigrateStripePreferences < ActiveRecord::Migration
1
+ class MigrateStripePreferences < SolidusSupport::Migration[4.2]
2
2
  def up
3
3
  Spree::Preference.where("#{ActiveRecord::Base.connection.quote_column_name("key")} LIKE 'spree/gateway/stripe_gateway/login%'").each do |pref|
4
4
  pref.key = pref.key.gsub('login', 'secret_key')
@@ -1,4 +1,5 @@
1
- require "spree_core"
1
+ require "solidus_core"
2
+ require "solidus_support"
2
3
  require "spree_gateway/engine"
3
4
  require "solidus_gateway/version"
4
5
  require "sass/rails"
@@ -1,3 +1,3 @@
1
1
  module SolidusGateway
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -20,7 +20,6 @@ module SpreeGateway
20
20
  app.config.spree.payment_methods << Spree::Gateway::Worldpay
21
21
  app.config.spree.payment_methods << Spree::Gateway::Banwire
22
22
  app.config.spree.payment_methods << Spree::Gateway::UsaEpay
23
- app.config.spree.payment_methods << Spree::BillingIntegration::Skrill::QuickCheckout
24
23
  app.config.spree.payment_methods << Spree::Gateway::BalancedGateway
25
24
  app.config.spree.payment_methods << Spree::Gateway::DataCash
26
25
  app.config.spree.payment_methods << Spree::Gateway::UsaEpay
@@ -52,9 +51,6 @@ module SpreeGateway
52
51
  'lib/assets/javascripts/spree/frontend/solidus_gateway.js',
53
52
  'lib/assets/javascripts/spree/frontend/solidus_gateway.css',
54
53
  ]
55
- Dir.glob(File.join(File.dirname(__FILE__), "../../controllers/frontend/*/*_decorator*.rb")) do |c|
56
- Rails.configuration.cache_classes ? require(c) : load(c)
57
- end
58
54
  end
59
55
  end
60
56
 
@@ -71,7 +67,6 @@ module SpreeGateway
71
67
  end
72
68
 
73
69
  if self.frontend_available?
74
- paths["app/controllers"] << "lib/controllers/frontend"
75
70
  paths["app/views"] << "lib/views/frontend"
76
71
  end
77
72
 
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.requirements << "none"
25
25
 
26
26
  s.add_dependency "solidus_core", [">= 1.1", "< 3"]
27
+ s.add_dependency "solidus_support"
27
28
 
28
29
  # ActiveMerchant v1.58 through v1.59 introduced a breaking change
29
30
  # to the stripe gateway.
@@ -39,6 +40,7 @@ Gem::Specification.new do |s|
39
40
  s.add_development_dependency "coffee-rails"
40
41
  s.add_development_dependency "factory_girl", "~> 4.4"
41
42
  s.add_development_dependency "capybara"
43
+ s.add_development_dependency "capybara-screenshot"
42
44
  s.add_development_dependency "poltergeist", "~> 1.9"
43
- s.add_development_dependency "database_cleaner", "1.2.0"
45
+ s.add_development_dependency "database_cleaner", "~> 1.5"
44
46
  end
@@ -21,9 +21,11 @@ RSpec.describe "Stripe checkout", type: :feature do
21
21
  click_link "DL-44"
22
22
  click_button "Add To Cart"
23
23
 
24
+ expect(page).to have_current_path("/cart")
24
25
  click_button "Checkout"
25
26
 
26
27
  # Address
28
+ expect(page).to have_current_path("/checkout/address")
27
29
  fill_in "Customer E-Mail", with: "han@example.com"
28
30
  within("#billing") do
29
31
  fill_in "First Name", with: "Han"
@@ -38,6 +40,7 @@ RSpec.describe "Stripe checkout", type: :feature do
38
40
  click_on "Save and Continue"
39
41
 
40
42
  # Delivery
43
+ expect(page).to have_current_path("/checkout/delivery")
41
44
  click_on "Save and Continue"
42
45
  end
43
46
 
@@ -78,6 +81,7 @@ RSpec.describe "Stripe checkout", type: :feature do
78
81
  it "shows an error with invalid security fields", js: true do
79
82
  fill_in "Card Number", with: "4242 4242 4242 4242"
80
83
  fill_in "Expiration", with: "01 / #{Time.now.year + 1}"
84
+ fill_in "Card Code", with: "12"
81
85
  click_button "Save and Continue"
82
86
  expect(page).to have_content("Your card's security code is invalid.")
83
87
  end
data/spec/spec_helper.rb CHANGED
@@ -8,11 +8,13 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
8
  require "rspec/rails"
9
9
 
10
10
  require "capybara/rspec"
11
+ require 'capybara-screenshot/rspec'
11
12
  require 'capybara/poltergeist'
12
13
  Capybara.register_driver(:poltergeist) do |app|
13
14
  Capybara::Poltergeist::Driver.new app, timeout: 90
14
15
  end
15
16
  Capybara.javascript_driver = :poltergeist
17
+ Capybara.default_max_wait_time = 10
16
18
 
17
19
  require "database_cleaner"
18
20
  require "braintree"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_gateway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-22 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '3'
33
+ - !ruby/object:Gem::Dependency
34
+ name: solidus_support
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: activemerchant
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -168,6 +182,20 @@ dependencies:
168
182
  - - ">="
169
183
  - !ruby/object:Gem::Version
170
184
  version: '0'
185
+ - !ruby/object:Gem::Dependency
186
+ name: capybara-screenshot
187
+ requirement: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ type: :development
193
+ prerelease: false
194
+ version_requirements: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
171
199
  - !ruby/object:Gem::Dependency
172
200
  name: poltergeist
173
201
  requirement: !ruby/object:Gem::Requirement
@@ -186,16 +214,16 @@ dependencies:
186
214
  name: database_cleaner
187
215
  requirement: !ruby/object:Gem::Requirement
188
216
  requirements:
189
- - - '='
217
+ - - "~>"
190
218
  - !ruby/object:Gem::Version
191
- version: 1.2.0
219
+ version: '1.5'
192
220
  type: :development
193
221
  prerelease: false
194
222
  version_requirements: !ruby/object:Gem::Requirement
195
223
  requirements:
196
- - - '='
224
+ - - "~>"
197
225
  - !ruby/object:Gem::Version
198
- version: 1.2.0
226
+ version: '1.5'
199
227
  description: Additional Payment Gateways for Solidus
200
228
  email: contact@solidus.io
201
229
  executables: []
@@ -209,7 +237,6 @@ files:
209
237
  - LICENSE.md
210
238
  - README.md
211
239
  - Rakefile
212
- - app/models/spree/billing_integration/skrill/quick_checkout.rb
213
240
  - app/models/spree/gateway/authorize_net.rb
214
241
  - app/models/spree/gateway/authorize_net_cim.rb
215
242
  - app/models/spree/gateway/balanced_gateway.rb
@@ -234,26 +261,15 @@ files:
234
261
  - app/models/spree/gateway/stripe_gateway.rb
235
262
  - app/models/spree/gateway/usa_epay.rb
236
263
  - app/models/spree/gateway/worldpay.rb
237
- - app/models/spree/skrill_transaction.rb
238
264
  - bin/rails
239
265
  - circle.yml
240
- - config/locales/bg.yml
241
- - config/locales/de.yml
242
- - config/locales/en.yml
243
- - config/locales/it.yml
244
- - config/locales/sv.yml
245
- - config/routes.rb
246
- - db/migrate/20111118164631_create_skrill_transactions.rb
247
266
  - db/migrate/20121017004102_update_braintree_payment_method_type.rb
248
267
  - db/migrate/20130213222555_update_stripe_payment_method_type.rb
249
268
  - db/migrate/20130415222802_update_balanced_payment_method_type.rb
250
269
  - db/migrate/20131008221012_update_paypal_payment_method_type.rb
251
270
  - db/migrate/20131112133401_migrate_stripe_preferences.rb
252
- - lib/active_merchant/billing/skrill.rb
253
271
  - lib/assets/javascripts/spree/frontend/solidus_gateway.js
254
272
  - lib/assets/stylesheets/spree/frontend/solidus_gateway.css
255
- - lib/controllers/frontend/spree/checkout_controller_decorator.rb
256
- - lib/controllers/frontend/spree/skrill_status_controller.rb
257
273
  - lib/generators/solidus_gateway/install/install_generator.rb
258
274
  - lib/solidus_gateway.rb
259
275
  - lib/solidus_gateway/version.rb
@@ -262,15 +278,10 @@ files:
262
278
  - lib/views/backend/spree/admin/log_entries/_stripe.html.erb
263
279
  - lib/views/backend/spree/admin/payments/source_forms/_quickcheckout.html.erb
264
280
  - lib/views/backend/spree/admin/payments/source_forms/_stripe.html.erb
265
- - lib/views/backend/spree/admin/payments/source_views/_quickcheckout.html.erb
266
281
  - lib/views/backend/spree/admin/payments/source_views/_stripe.html.erb
267
- - lib/views/frontend/spree/checkout/payment/_quickcheckout.html.erb
268
282
  - lib/views/frontend/spree/checkout/payment/_stripe.html.erb
269
283
  - solidus_gateway.gemspec
270
- - spec/factories/skrill_factory.rb
271
284
  - spec/features/stripe_checkout_spec.rb
272
- - spec/lib/active_merchant/billing_skrill_spec.rb
273
- - spec/models/billing_integration/skrill_quick_checkout_spec.rb
274
285
  - spec/models/gateway/authorize_net_cim_spec.rb
275
286
  - spec/models/gateway/authorize_net_spec.rb
276
287
  - spec/models/gateway/balanced_gateway_spec.rb
@@ -293,7 +304,6 @@ files:
293
304
  - spec/models/gateway/stripe_gateway_spec.rb
294
305
  - spec/models/gateway/usa_epay_spec.rb
295
306
  - spec/models/gateway/worldpay_spec.rb
296
- - spec/models/skrill_transaction_spec.rb
297
307
  - spec/spec_helper.rb
298
308
  homepage: https://solidus.io
299
309
  licenses:
@@ -316,15 +326,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
326
  requirements:
317
327
  - none
318
328
  rubyforge_project:
319
- rubygems_version: 2.5.1
329
+ rubygems_version: 2.6.11
320
330
  signing_key:
321
331
  specification_version: 4
322
332
  summary: Additional Payment Gateways for Solidus
323
333
  test_files:
324
- - spec/factories/skrill_factory.rb
325
334
  - spec/features/stripe_checkout_spec.rb
326
- - spec/lib/active_merchant/billing_skrill_spec.rb
327
- - spec/models/billing_integration/skrill_quick_checkout_spec.rb
328
335
  - spec/models/gateway/authorize_net_cim_spec.rb
329
336
  - spec/models/gateway/authorize_net_spec.rb
330
337
  - spec/models/gateway/balanced_gateway_spec.rb
@@ -347,5 +354,4 @@ test_files:
347
354
  - spec/models/gateway/stripe_gateway_spec.rb
348
355
  - spec/models/gateway/usa_epay_spec.rb
349
356
  - spec/models/gateway/worldpay_spec.rb
350
- - spec/models/skrill_transaction_spec.rb
351
357
  - spec/spec_helper.rb
@@ -1,48 +0,0 @@
1
- module Spree
2
- class BillingIntegration::Skrill::QuickCheckout < BillingIntegration
3
- preference :merchant_id, :string
4
- preference :language, :string, :default => 'EN'
5
- preference :currency, :string, :default => 'EUR'
6
- preference :payment_options, :string, :default => 'ACC'
7
- preference :pay_to_email, :string , :default => 'your@merchant.email_here'
8
-
9
- def provider_class
10
- ActiveMerchant::Billing::Skrill
11
- end
12
-
13
- def redirect_url(order, opts = {})
14
- opts.merge! self.preferences
15
-
16
- set_global_options(opts)
17
-
18
- opts[:detail1_text] = order.number
19
- opts[:detail1_description] = "Order:"
20
-
21
- opts[:pay_from_email] = order.email
22
- opts[:firstname] = order.bill_address.firstname
23
- opts[:lastname] = order.bill_address.lastname
24
- opts[:address] = order.bill_address.address1
25
- opts[:address2] = order.bill_address.address2
26
- opts[:phone_number] = order.bill_address.phone.gsub(/\D/,'') if order.bill_address.phone
27
- opts[:city] = order.bill_address.city
28
- opts[:postal_code] = order.bill_address.zipcode
29
- opts[:state] = order.bill_address.state.nil? ? order.bill_address.state_name.to_s : order.bill_address.state.abbr
30
- opts[:country] = order.bill_address.country.name
31
- opts[:pay_to_email] = self.preferred_pay_to_email
32
- opts[:hide_login] = 1
33
- opts[:merchant_fields] = 'platform,order_id,payment_method_id'
34
- opts[:platform] = 'Spree'
35
- opts[:order_id] = order.number
36
-
37
- skrill = self.provider
38
- skrill.payment_url(opts)
39
- end
40
-
41
- private
42
- def set_global_options(opts)
43
- opts[:recipient_description] = Spree::Config[:site_name]
44
- opts[:payment_methods] = self.preferred_payment_options
45
- end
46
-
47
- end
48
- end
@@ -1,19 +0,0 @@
1
- module Spree
2
- class SkrillTransaction < ActiveRecord::Base
3
- has_many :payments, :as => :source
4
-
5
- def actions
6
- []
7
- end
8
-
9
- def self.create_from_postback(params)
10
- SkrillTransaction.create(:email => params[:pay_from_email],
11
- :amount => params[:mb_amount],
12
- :currency => params[:mb_currency],
13
- :transaction_id => params[:mb_transaction_id],
14
- :customer_id => params[:customer_id],
15
- :payment_type => params[:payment_type])
16
- end
17
-
18
- end
19
- end
@@ -1,11 +0,0 @@
1
- ---
2
- bg:
3
- spree:
4
- payment_has_been_cancelled: Плащането беше прекъснато.
5
- complete_skrill_checkout: Моля довършете Вашето плащане със Skrill преди да продължите
6
- skrill: Skrill
7
- skrill_transaction: Транзакция
8
- skrill_customer_id: Клиентски номер
9
- skrill_transaction_id: Номер на транкцията
10
- skrill_payment_type: Вид на плащане
11
- skrill_payment_currency: Валута
@@ -1,11 +0,0 @@
1
- ---
2
- de:
3
- spree:
4
- payment_has_been_cancelled: Die Zahlung wurde abgebrochen.
5
- complete_skrill_checkout: Bitte schliessen Sie die Skrill-Zahlung ab
6
- skrill: Skrill
7
- skrill_transaction: Transaktion
8
- skrill_customer_id: Kunden ID
9
- skrill_transaction_id: Transaktions ID
10
- skrill_payment_type: Bezahlart
11
- skrill_payment_currency: Währung
@@ -1,30 +0,0 @@
1
- ---
2
- en:
3
- spree:
4
- payment_has_been_cancelled: The payment has been cancelled.
5
- complete_skrill_checkout: Please complete Skrill checkout before continuing
6
- skrill: Skrill
7
- skrill_transaction: Transaction
8
- skrill_customer_id: Customer ID
9
- skrill_transaction_id: Transaction ID
10
- skrill_payment_type: Payment Type
11
- skrill_payment_currency: Payment Currency
12
- log_entry:
13
- braintree:
14
- message: Message
15
- status: Status
16
- cc_token: Braintree Credit Card Token
17
- customer_id: Braintree Customer ID
18
- cvv_result: CVV Result
19
- avs_result_title: AVS result
20
- avs_result:
21
- message: Message
22
- street_match: Street Match
23
- postal_match: Postal Match
24
- stripe:
25
- message: Message
26
- charge_id: Stripe Charge ID
27
- card_id: Stripe Card ID
28
- cvv_result: CVV Result
29
- cvc_check: CVC Check
30
- address_zip_check: Address ZIP check
@@ -1,30 +0,0 @@
1
- ---
2
- it:
3
- spree:
4
- payment_has_been_cancelled: Il pagamento è stato cancellato.
5
- complete_skrill_checkout: Ti preghiamo di completate il checkout Skrill prima di continuare
6
- skrill: Skrill
7
- skrill_transaction: Transazione
8
- skrill_customer_id: ID cliente
9
- skrill_transaction_id: ID Transazione
10
- skrill_payment_type: Tipo di pagamento
11
- skrill_payment_currency: Valuta pagamento
12
- log_entry:
13
- braintree:
14
- message: Message
15
- status: Status
16
- cc_token: Token carta di credito Braintree
17
- customer_id: ID cliente Braintree
18
- cvv_result: Risultato CVV
19
- avs_result_title: Risultato AVS
20
- avs_result:
21
- message: Messaggio
22
- street_match: Match indirizzo
23
- postal_match: Match CAP
24
- stripe:
25
- message: Message
26
- charge_id: ID addebito Stripe
27
- card_id: ID carta Stripe
28
- cvv_result: Risultato CVV
29
- cvc_check: Controllo CVC
30
- address_zip_check: Controllo CAP
@@ -1,11 +0,0 @@
1
- ---
2
- sv:
3
- spree:
4
- payment_has_been_cancelled: Betalningen har avbrutits.
5
- complete_skrill_checkout: Var god fyll i Skrill kassan innan du fortsätter
6
- skrill: Skrill
7
- skrill_transaction: Transaktion
8
- skrill_customer_id: Kund ID
9
- skrill_transaction_id: Transaktion ID
10
- skrill_payment_type: Betalningstyp
11
- skrill_payment_currency: Betalningsvaluta
data/config/routes.rb DELETED
@@ -1,12 +0,0 @@
1
- Spree::Core::Engine.routes.draw do
2
- resources :orders, only: [] do
3
- resource :checkout, controller: 'checkout' do
4
- member do
5
- get :skrill_cancel
6
- get :skrill_return
7
- end
8
- end
9
- end
10
-
11
- post '/skrill', to: 'skrill_status#update'
12
- end
@@ -1,14 +0,0 @@
1
- class CreateSkrillTransactions < ActiveRecord::Migration
2
- def change
3
- create_table :spree_skrill_transactions do |t|
4
- t.string :email
5
- t.float :amount
6
- t.string :currency
7
- t.integer :transaction_id
8
- t.integer :customer_id
9
- t.string :payment_type
10
- t.timestamps null: true
11
- end
12
- end
13
- end
14
-
@@ -1,18 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
3
- class Skrill < Gateway
4
-
5
- def service_url
6
- "https://www.moneybookers.com/app/payment.pl"
7
- end
8
-
9
- def payment_url(opts)
10
- post = PostData.new
11
- post.merge! opts
12
-
13
- "#{service_url}?#{post.to_s}"
14
- end
15
-
16
- end
17
- end
18
- end
@@ -1,51 +0,0 @@
1
- module Spree
2
- CheckoutController.class_eval do
3
- before_filter :confirm_skrill, :only => [:update]
4
-
5
- def skrill_return
6
-
7
- unless @order.payments.where(:source_type => 'Spree::SkrillTransaction').present?
8
- payment_method = PaymentMethod.find(params[:payment_method_id])
9
- skrill_transaction = SkrillTransaction.new
10
-
11
- payment = @order.payments.create({:amount => @order.total,
12
- :source => skrill_transaction,
13
- :payment_method => payment_method},
14
- :without_protection => true)
15
- payment.started_processing!
16
- payment.pend!
17
- end
18
-
19
- @order.update_attributes({:state => "complete", :completed_at => Time.now}, :without_protection => true)
20
-
21
- until @order.state == "complete"
22
- if @order.next!
23
- @order.update!
24
- state_callback(:after)
25
- end
26
- end
27
-
28
- @order.finalize!
29
-
30
- flash.notice = Spree.t(:order_processed_successfully)
31
- redirect_to completion_route
32
- end
33
-
34
- def skrill_cancel
35
- flash[:error] = Spree.t(:payment_has_been_cancelled)
36
- redirect_to edit_order_path(@order)
37
- end
38
-
39
- private
40
- def confirm_skrill
41
- return unless (params[:state] == "payment") && params[:order] && params[:order][:payments_attributes]
42
-
43
- payment_method = PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id])
44
- if payment_method.kind_of?(BillingIntegration::Skrill::QuickCheckout)
45
- #TODO confirming payment method
46
- redirect_to edit_order_checkout_url(@order, :state => 'payment'),
47
- :notice => Spree.t(:complete_skrill_checkout)
48
- end
49
- end
50
- end
51
- end
@@ -1,39 +0,0 @@
1
- module Spree
2
- class SkrillStatusController < ApplicationController
3
- def update
4
- @order = Order.find_by_number!(params[:order_id])
5
- payment_method = PaymentMethod.find(params[:payment_method_id])
6
- skrill_transaction = SkrillTransaction.create_from_postback params
7
-
8
- payment = @order.payments.where(:state => "pending",
9
- :payment_method_id => payment_method).first
10
-
11
- if payment
12
- payment.source = skrill_transaction
13
- payment.save
14
- else
15
- payment = @order.payments.create(:amount => @order.total,
16
- :source => skrill_transaction,
17
- :payment_method => payment_method)
18
- end
19
-
20
- payment.started_processing!
21
-
22
- unless payment.completed?
23
- case params[:status]
24
- when "0"
25
- payment.pend #may already be pending
26
- when "2" #processed / captured
27
- payment.complete!
28
- when "-1", "-2"
29
- payment.failure!
30
- else
31
- raise "Unexpected payment status"
32
- end
33
- end
34
-
35
- render :text => ""
36
- end
37
-
38
- end
39
- end
@@ -1,39 +0,0 @@
1
- <fieldset>
2
- <legend><%= Spree.t(:skrill) %></legend>
3
-
4
- <table class="index">
5
- <tr>
6
- <th colspan="6"><%= Spree.t(:skrill_transaction) %></th>
7
- </tr>
8
- <tr>
9
- <td><label><%= Spree.t(:email) %>:</label></td>
10
- <td>
11
- <%= payment.source.email %>
12
- </td>
13
- </tr>
14
- <tr>
15
- <td><label><%= Spree.t(:skrill_customer_id) %>:</label></td>
16
- <td>
17
- <%= payment.source.customer_id %>
18
- </td>
19
- </tr>
20
- <tr>
21
- <td><label><%= Spree.t(:skrill_transaction_id) %>:</label></td>
22
- <td>
23
- <%= payment.source.transaction_id %>
24
- </td>
25
- </tr>
26
- <tr>
27
- <td><label><%= Spree.t(:skrill_payment_type) %>:</label></td>
28
- <td>
29
- <%= payment.source.payment_type %>
30
- </td>
31
- </tr>
32
- <tr>
33
- <td><label><%= Spree.t(:skrill_payment_currency) %>:</label></td>
34
- <td>
35
- <%= payment.source.currency %>
36
- </td>
37
- </tr>
38
- </table>
39
- </fieldset>
@@ -1,26 +0,0 @@
1
- <p data-hook="skrill_quick_checkout"></p>
2
-
3
- <%
4
- opts = {}
5
- opts[:transaction_id] = "#{@order.number}"
6
- opts[:amount] = @order.total
7
- opts[:return_url] = skrill_return_order_checkout_url(@order, :token => @order.guest_token,
8
- :payment_method_id => payment_method.id)
9
- opts[:cancel_url] = skrill_cancel_order_checkout_url(@order, :token => @order.guest_token)
10
- opts[:status_url] = skrill_url
11
- opts[:payment_method_id] = payment_method.id
12
- %>
13
-
14
- <style>
15
- iframe.skrill_frame{
16
- border: 0px;
17
- width: 500px;
18
- height: 500px;
19
- }
20
- </style>
21
-
22
- <fieldset id="skrill_payment__<%= payment_method.id %>" data-hook>
23
- <legend><%= Spree.t(:payment_information) %></legend>
24
- <iframe id="skrill_frame_<%= payment_method.id %>"
25
- class="skrill_frame" src="<%= payment_method.redirect_url @order, opts %>"></iframe>
26
- </fieldset>
@@ -1,5 +0,0 @@
1
- FactoryGirl.define do
2
- factory :skrill_quick_checkout, class: Spree::BillingIntegration::Skrill::QuickCheckout do
3
- name "Skrill - Quick Checkout"
4
- end
5
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveMerchant::Billing::Skrill do
4
- let(:url) { 'https://www.moneybookers.com/app/payment.pl' }
5
-
6
- context '.service_url' do
7
- it 'return its url' do
8
- expect(subject.service_url).to eq url
9
- end
10
- end
11
-
12
- context '.payment_url' do
13
- it 'prepend options to url' do
14
- options = { 'hi' => 'you' }
15
- expect(subject.payment_url(options)).to eq "#{url}?hi=you"
16
- end
17
- end
18
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::BillingIntegration::Skrill::QuickCheckout do
4
- let(:quick_checkout) { create(:skrill_quick_checkout) }
5
-
6
- context '.provider_class' do
7
- it 'is a Billing::Skrill class' do
8
- expect(quick_checkout.provider_class).to eq ::ActiveMerchant::Billing::Skrill
9
- end
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Spree::SkrillTransaction do
4
- let(:skrill_transaction) { create(:skrill_transaction) }
5
-
6
- context '.actions' do
7
- it { expect(subject.actions).to match_array([]) }
8
- end
9
- end