solidus_core 2.11.10 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of solidus_core might be problematic. Click here for more details.

Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree.js.erb +0 -51
  3. data/app/helpers/spree/store_helper.rb +0 -11
  4. data/app/mailers/spree/carton_mailer.rb +1 -5
  5. data/app/models/concerns/spree/adjustment_source.rb +0 -15
  6. data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
  7. data/app/models/concerns/spree/soft_deletable.rb +2 -4
  8. data/app/models/concerns/spree/user_address_book.rb +0 -37
  9. data/app/models/concerns/spree/user_methods.rb +2 -11
  10. data/app/models/spree/ability.rb +0 -37
  11. data/app/models/spree/address/name.rb +2 -20
  12. data/app/models/spree/address.rb +8 -186
  13. data/app/models/spree/adjustment.rb +0 -28
  14. data/app/models/spree/base.rb +0 -53
  15. data/app/models/spree/calculator/flexi_rate.rb +0 -5
  16. data/app/models/spree/calculator.rb +0 -7
  17. data/app/models/spree/country.rb +1 -6
  18. data/app/models/spree/credit_card.rb +0 -27
  19. data/app/models/spree/customer_return.rb +1 -4
  20. data/app/models/spree/image.rb +0 -7
  21. data/app/models/spree/inventory_unit.rb +0 -21
  22. data/app/models/spree/line_item.rb +2 -45
  23. data/app/models/spree/order.rb +4 -137
  24. data/app/models/spree/order_cancellations.rb +4 -24
  25. data/app/models/spree/order_updater.rb +2 -11
  26. data/app/models/spree/payment/cancellation.rb +1 -1
  27. data/app/models/spree/payment.rb +0 -3
  28. data/app/models/spree/payment_create.rb +1 -13
  29. data/app/models/spree/payment_method/credit_card.rb +1 -3
  30. data/app/models/spree/payment_method.rb +2 -103
  31. data/app/models/spree/product/scopes.rb +0 -27
  32. data/app/models/spree/product.rb +0 -40
  33. data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
  34. data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
  35. data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
  36. data/app/models/spree/promotion/rules/taxon.rb +2 -15
  37. data/app/models/spree/promotion.rb +2 -6
  38. data/app/models/spree/promotion_action.rb +2 -9
  39. data/app/models/spree/promotion_code/batch_builder.rb +0 -14
  40. data/app/models/spree/refund.rb +0 -52
  41. data/app/models/spree/reimbursement.rb +3 -41
  42. data/app/models/spree/reimbursement_performer.rb +2 -8
  43. data/app/models/spree/reimbursement_type/credit.rb +1 -4
  44. data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
  45. data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
  46. data/app/models/spree/return_authorization.rb +1 -4
  47. data/app/models/spree/return_item.rb +3 -22
  48. data/app/models/spree/shipment.rb +1 -54
  49. data/app/models/spree/shipping_method.rb +0 -25
  50. data/app/models/spree/shipping_rate.rb +0 -2
  51. data/app/models/spree/state.rb +0 -4
  52. data/app/models/spree/stock/simple_coordinator.rb +6 -15
  53. data/app/models/spree/stock/splitter/base.rb +2 -7
  54. data/app/models/spree/stock_item.rb +1 -7
  55. data/app/models/spree/store.rb +0 -12
  56. data/app/models/spree/store_credit_category.rb +0 -32
  57. data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
  58. data/app/models/spree/tax_rate.rb +0 -27
  59. data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
  60. data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
  61. data/app/models/spree/taxon.rb +0 -11
  62. data/app/models/spree/user_address.rb +0 -5
  63. data/app/models/spree/variant.rb +2 -46
  64. data/config/locales/en.yml +0 -8
  65. data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
  66. data/lib/generators/solidus/install/install_generator.rb +12 -1
  67. data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
  68. data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
  69. data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
  70. data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
  71. data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
  72. data/lib/spree/app_configuration.rb +6 -65
  73. data/lib/spree/core/class_constantizer.rb +2 -0
  74. data/lib/spree/core/controller_helpers/auth.rb +1 -14
  75. data/lib/spree/core/controller_helpers/order.rb +2 -22
  76. data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
  77. data/lib/spree/core/controller_helpers/pricing.rb +0 -8
  78. data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
  79. data/lib/spree/core/engine.rb +0 -35
  80. data/lib/spree/core/environment_extension.rb +0 -9
  81. data/lib/spree/core/product_filters.rb +0 -40
  82. data/lib/spree/core/role_configuration.rb +0 -14
  83. data/lib/spree/core/search/base.rb +0 -26
  84. data/lib/spree/core/state_machines.rb +2 -11
  85. data/lib/spree/core/validators/email.rb +1 -1
  86. data/lib/spree/core/version.rb +1 -1
  87. data/lib/spree/core.rb +9 -8
  88. data/lib/spree/deprecation.rb +1 -1
  89. data/lib/spree/event/configuration.rb +0 -5
  90. data/lib/spree/event/subscriber.rb +0 -18
  91. data/lib/spree/event/subscriber_registry.rb +3 -1
  92. data/lib/spree/event.rb +0 -31
  93. data/lib/spree/i18n.rb +0 -22
  94. data/lib/spree/money.rb +3 -18
  95. data/lib/spree/permitted_attributes.rb +9 -54
  96. data/lib/spree/testing_support/capybara_ext.rb +0 -30
  97. data/lib/spree/testing_support/controller_requests.rb +0 -82
  98. data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
  99. data/lib/spree/testing_support/dummy_app.rb +7 -14
  100. data/lib/spree/testing_support/factories/order_factory.rb +0 -1
  101. data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
  102. data/lib/spree/testing_support/order_walkthrough.rb +0 -3
  103. data/lib/spree/testing_support/preferences.rb +0 -25
  104. data/lib/tasks/upgrade.rake +7 -5
  105. data/solidus_core.gemspec +2 -5
  106. metadata +8 -49
  107. data/app/mailers/spree/test_mailer.rb +0 -13
  108. data/app/models/concerns/spree/user_payment_source.rb +0 -26
  109. data/app/models/spree/calculator/free_shipping.rb +0 -22
  110. data/app/models/spree/calculator/percent_per_item.rb +0 -51
  111. data/app/models/spree/calculator/price_sack.rb +0 -28
  112. data/app/models/spree/gateway/bogus.rb +0 -13
  113. data/app/models/spree/gateway/bogus_simple.rb +0 -13
  114. data/app/models/spree/gateway.rb +0 -14
  115. data/app/models/spree/order/checkout.rb +0 -244
  116. data/app/models/spree/order_capturing.rb +0 -50
  117. data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
  118. data/lib/generators/spree/install/install_generator.rb +0 -15
  119. data/lib/solidus/migrations/rename_gateways.rb +0 -41
  120. data/lib/spree/core/current_store.rb +0 -24
  121. data/lib/spree/paranoia_deprecations.rb +0 -41
  122. data/lib/spree/promo/environment.rb +0 -12
  123. data/lib/spree/testing_support/bar_ability.rb +0 -19
  124. data/lib/tasks/core.rake +0 -104
  125. data/lib/tasks/email.rake +0 -12
  126. data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
  127. data/lib/tasks/migrations/migrate_address_names.rake +0 -158
  128. data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +0 -26
  129. data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
  130. data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
  131. data/lib/tasks/migrations/rename_gateways.rake +0 -23
  132. data/lib/tasks/order_capturing.rake +0 -27
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class AddApplyToAllToVariantPropertyRule < ActiveRecord::Migration[5.1]
4
- def up
4
+ def change
5
5
  add_column :spree_variant_property_rules, :apply_to_all, :boolean, default: false, null: false
6
6
  change_column :spree_variant_property_rules, :apply_to_all, :boolean, default: true
7
7
  end
@@ -15,6 +15,7 @@ module Solidus
15
15
  class_option :migrate, type: :boolean, default: true, banner: 'Run Solidus migrations'
16
16
  class_option :seed, type: :boolean, default: true, banner: 'Load seed data (migrations must be run)'
17
17
  class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations must be run)'
18
+ class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
18
19
  class_option :auto_accept, type: :boolean
19
20
  class_option :user_class, type: :string
20
21
  class_option :admin_email, type: :string
@@ -51,6 +52,16 @@ module Solidus
51
52
  template 'config/initializers/spree.rb.tt', 'config/initializers/spree.rb'
52
53
  end
53
54
 
55
+ def install_file_attachment
56
+ if options[:active_storage]
57
+ say "Installing Active Storage", :green
58
+ rake 'active_storage:install'
59
+ else
60
+ say "Installing Paperclip", :green
61
+ gsub_file 'config/initializers/spree.rb', "ActiveStorageAttachment", "PaperclipAttachment"
62
+ end
63
+ end
64
+
54
65
  def additional_tweaks
55
66
  return unless File.exist? 'public/robots.txt'
56
67
 
@@ -174,7 +185,7 @@ module Solidus
174
185
  run "spring stop" if defined?(Spring)
175
186
 
176
187
  @plugin_generators_to_run.each do |plugin_generator_name|
177
- generate "#{plugin_generator_name} --skip_migrations=false"
188
+ generate "#{plugin_generator_name} --skip_migrations=true"
178
189
  end
179
190
  end
180
191
 
@@ -10,15 +10,6 @@ Spree.config do |config|
10
10
  # from address for transactional emails
11
11
  config.mails_from = "store@example.com"
12
12
 
13
- # Use combined first and last name attribute in HTML views and API responses
14
- config.use_combined_first_and_last_name_in_address = true
15
-
16
- # Use legacy Spree::Order state machine
17
- config.use_legacy_order_state_machine = false
18
-
19
- # Use the legacy address' state validation logic
20
- config.use_legacy_address_state_validator = false
21
-
22
13
  # Uncomment to stop tracking inventory levels in the application
23
14
  # config.track_inventory_levels = false
24
15
 
@@ -27,38 +18,11 @@ Spree.config do |config|
27
18
  # any inventory changes.
28
19
  # config.inventory_cache_threshold = 3
29
20
 
30
- # Enable Paperclip adapter for attachments on images and taxons
31
- config.image_attachment_module = 'Spree::Image::PaperclipAttachment'
32
- config.taxon_attachment_module = 'Spree::Taxon::PaperclipAttachment'
33
-
34
- # Disable legacy Solidus custom CanCanCan actions aliases
35
- config.use_custom_cancancan_actions = false
21
+ # Configure adapter for attachments on products and taxons (use ActiveStorageAttachment or PaperclipAttachment)
22
+ config.image_attachment_module = 'Spree::Image::ActiveStorageAttachment'
23
+ config.taxon_attachment_module = 'Spree::Taxon::ActiveStorageAttachment'
36
24
 
37
25
  # Defaults
38
-
39
- # Set this configuration to `true` to raise an exception when
40
- # an order is populated with a line item with a mismatching
41
- # currency. The `false` value will just add a validation error
42
- # and will be the only behavior accepted in future versions.
43
- # See https://github.com/solidusio/solidus/pull/3456 for more info.
44
- config.raise_with_invalid_currency = false
45
-
46
- # Set this configuration to false to always redirect the user to
47
- # /unauthorized when needed, without trying to redirect them to
48
- # their previous location first.
49
- config.redirect_back_on_unauthorized = true
50
-
51
- # Set this configuration to `true` to allow promotions
52
- # with no associated actions to be considered active for use by customers.
53
- # See https://github.com/solidusio/solidus/pull/3749 for more info.
54
- config.consider_actionless_promotion_active = false
55
-
56
- # Set this configuration to `false` to avoid running validations when
57
- # updating an order. Be careful since you can end up having inconsistent
58
- # data in your database turning it on.
59
- # See https://github.com/solidusio/solidus/pull/3645 for more info.
60
- config.run_order_validations_on_order_updater = true
61
-
62
26
  # Permission Sets:
63
27
 
64
28
  # Uncomment and customize the following line to add custom permission sets
@@ -43,7 +43,7 @@ module Spree
43
43
  opts[:skip_test] = true
44
44
  opts[:skip_yarn] = true
45
45
  opts[:skip_bootsnap] = true
46
- opts[:skip_webpack_install] = true
46
+ opts[:skip_javascript] = true
47
47
 
48
48
  puts "Generating dummy Rails application..."
49
49
  invoke Rails::Generators::AppGenerator,
@@ -55,6 +55,7 @@ module Spree
55
55
  @database = options[:database]
56
56
 
57
57
  template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true
58
+ template "rails/storage.yml", "#{dummy_path}/config/storage/test.yml", force: true
58
59
  template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true
59
60
  template "rails/application.rb.tt", "#{dummy_path}/config/application.rb", force: true
60
61
  template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
@@ -32,6 +32,8 @@ production:
32
32
  encoding: utf8
33
33
  <% when 'postgres', 'postgresql' %>
34
34
  <% db_host = ENV['DB_HOST'] -%>
35
+ <% db_username = ENV['DB_USERNAME'] -%>
36
+ <% db_password = ENV['DB_PASSWORD'] -%>
35
37
  development:
36
38
  adapter: postgresql
37
39
  database: <%= database_prefix %><%= options[:lib_name] %>_solidus_development
@@ -43,7 +45,10 @@ development:
43
45
  test:
44
46
  adapter: postgresql
45
47
  database: <%= database_prefix %><%= options[:lib_name] %>_solidus_test
46
- username: postgres
48
+ username: <%= db_username || 'postgres' %>
49
+ <% unless db_password.blank? %>
50
+ password: <%= db_password %>
51
+ <% end %>
47
52
  min_messages: warning
48
53
  <% unless db_host.blank? %>
49
54
  host: <%= db_host %>
@@ -0,0 +1,3 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= File.expand_path("#{dummy_path}/tmp/storage", destination_root) %>
@@ -29,6 +29,8 @@ Dummy::Application.configure do
29
29
  config.action_mailer.delivery_method = :test
30
30
  ActionMailer::Base.default from: "solidus@example.com"
31
31
 
32
+ config.active_storage.service = :test
33
+
32
34
  # Raise on deprecation warnings
33
35
  if ENV['SOLIDUS_RAISE_DEPRECATIONS'].present?
34
36
  Spree::Deprecation.behavior = :raise
@@ -34,10 +34,6 @@ module Spree
34
34
  # @return [Boolean] should state/state_name be required (default: +true+)
35
35
  preference :address_requires_state, :boolean, default: true
36
36
 
37
- # @!attribute [rw] legacy
38
- # @return [Boolean] use the legacy address' state validation logic (default: +true+)
39
- preference :use_legacy_address_state_validator, :boolean, default: true
40
-
41
37
  # @!attribute [rw] admin_interface_logo
42
38
  # @return [String] URL of logo used in admin (default: +'logo/solidus.svg'+)
43
39
  preference :admin_interface_logo, :string, default: 'logo/solidus.svg'
@@ -111,16 +107,6 @@ module Spree
111
107
  # @return [Boolean]
112
108
  preference :billing_address_required, :boolean, default: false
113
109
 
114
- # @!attribute [rw] binary_inventory_cache
115
- # Only invalidate product caches when they change from in stock to out of
116
- # stock. By default, caches are invalidated on any change of inventory
117
- # quantity. Setting this to true should make operations on inventory
118
- # faster.
119
- # (default: +false+)
120
- # @deprecated - use inventory_cache_threshold instead
121
- # @return [Boolean]
122
- preference :binary_inventory_cache, :boolean, default: false
123
-
124
110
  # @!attribute [rw] can_restrict_stock_management
125
111
  # @return [Boolean] Indicates if stock management can be restricted by location
126
112
  preference :can_restrict_stock_management, :boolean, default: false
@@ -154,20 +140,11 @@ module Spree
154
140
  # @return [Integer] Customer returns to show per-page in the admin (default: +15+)
155
141
  preference :customer_returns_per_page, :integer, default: 15
156
142
 
157
- # @!attribute [rw] default_country_id
158
- # @deprecated Use the default country ISO preference instead
159
- # @return [Integer,nil] id of {Spree::Country} to be selected by default in dropdowns (default: nil)
160
- preference :default_country_id, :integer
161
-
162
143
  # @!attribute [rw] default_country_iso
163
144
  # Default customer country ISO code
164
145
  # @return [String] Two-letter ISO code of a {Spree::Country} to assumed as the country of an unidentified customer (default: "US")
165
146
  preference :default_country_iso, :string, default: 'US'
166
147
 
167
- # @!attribute [rw] use_custom_cancancan_actions
168
- # @return [Boolean] Allow to use legacy Solidus custom CanCanCan action aliases (default: +true+)
169
- preference :use_custom_cancancan_actions, :boolean, default: true
170
-
171
148
  # @!attribute [rw] generate_api_key_for_all_roles
172
149
  # @return [Boolean] Allow generating api key automatically for user
173
150
  # at role_user creation for all roles. (default: +false+)
@@ -225,23 +202,6 @@ module Spree
225
202
  # @return [Integer] Promotions to show per-page in the admin (default: +15+)
226
203
  preference :promotions_per_page, :integer, default: 15
227
204
 
228
- # @!attribute [rw] disable_actionless_promotion_validation
229
- # @return [Boolean] Promotions should have actions associated before being considered active (default: +true+)
230
- preference :consider_actionless_promotion_active, :boolean, default: true
231
-
232
- # @!attribute [rw] raise_with_invalid_currency
233
- # Whether to raise an exception if trying to set a line item currency
234
- # different from the order currency. When false a validation error
235
- # is added to the instance instead.
236
- # @return [Boolean] (default: +true+)
237
- preference :raise_with_invalid_currency, :boolean, default: true
238
-
239
- # @!attribute [rw] redirect_back_on_unauthorized
240
- # Whether to try to redirect users back when they try to access
241
- # unauthorized routes, before redirect them to /unauthorized.
242
- # @return [Boolean] (default: +false+)
243
- preference :redirect_back_on_unauthorized, :boolean, default: false
244
-
245
205
  # @!attribute [rw] require_master_price
246
206
  # @return [Boolean] Require a price on the master variant of a product (default: +true+)
247
207
  preference :require_master_price, :boolean, default: true
@@ -268,10 +228,6 @@ module Spree
268
228
  # (default: +['IT']+)
269
229
  preference :countries_that_use_nested_subregions, :array, default: ['IT']
270
230
 
271
- # @!attribute [rw] run_order_validations_on_order_updater
272
- # @return [Boolean] Whether to run validation when updating an order with the OrderUpdater
273
- preference :run_order_validations_on_order_updater, :boolean, default: false
274
-
275
231
  # @!attribute [rw] send_core_emails
276
232
  # @return [Boolean] Whether to send transactional emails (default: true)
277
233
  preference :send_core_emails, :boolean, default: true
@@ -307,21 +263,6 @@ module Spree
307
263
  # @return [] Track on_hand values for variants / products. (default: true)
308
264
  preference :track_inventory_levels, :boolean, default: true
309
265
 
310
- # @!attribute [rw] use_combined_first_and_last_name_in_address
311
- # @return [Boolean] Use Spree::Address combined first and last name in HTML views and
312
- # API responses. (default: +false+)
313
- preference :use_combined_first_and_last_name_in_address, :boolean, default: false
314
-
315
- # @!attribute [rw] use_legacy_order_state_machine
316
- # @return [Boolean] Uses the legacy order state machine from Spree::Order::Checkout
317
- # (default: +false+)
318
- preference :use_legacy_order_state_machine, :boolean, default: true
319
-
320
- # The legacy_store_credit_category_name allows to control whether the legacy
321
- # way of fetching the category should be used.
322
- #
323
- # @param [Boolean] enable/disable the legacy way of fetching the store category name
324
- preference :use_legacy_store_credit_reimbursement_category_name, :boolean, default: true
325
266
 
326
267
  # Other configurations
327
268
 
@@ -496,13 +437,13 @@ module Spree
496
437
 
497
438
  # Allows switching attachment library for Image
498
439
  #
499
- # `Spree::Image::PaperclipAttachment`
500
- # is the default and provides the classic Paperclip implementation.
440
+ # `Spree::Image::ActiveStorageAttachment`
441
+ # is the default and provides the Active Storage implementation.
501
442
  #
502
443
  # @!attribute [rw] image_attachment_module
503
444
  # @return [Module] a module that can be included into Spree::Image to allow attachments
504
445
  # Enumerable of images adhering to the present_image_class interface
505
- class_name_attribute :image_attachment_module, default: 'Spree::Image::PaperclipAttachment'
446
+ class_name_attribute :image_attachment_module, default: 'Spree::Image::ActiveStorageAttachment'
506
447
 
507
448
  # @!attribute [rw] allowed_image_mime_types
508
449
  #
@@ -514,13 +455,13 @@ module Spree
514
455
 
515
456
  # Allows switching attachment library for Taxon
516
457
  #
517
- # `Spree::Taxon::PaperclipAttachment`
518
- # is the default and provides the classic Paperclip implementation.
458
+ # `Spree::Taxon::ActiveStorageAttachment`
459
+ # is the default and provides the Active Storage implementation.
519
460
  #
520
461
  # @!attribute [rw] taxon_attachment_module
521
462
  # @return [Module] a module that can be included into Spree::Taxon to allow attachments
522
463
  # Enumerable of taxons adhering to the present_taxon_class interface
523
- class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::PaperclipAttachment'
464
+ class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::ActiveStorageAttachment'
524
465
 
525
466
  # Allows providing your own class instance for generating order numbers.
526
467
  #
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/module'
4
+
3
5
  module Spree
4
6
  module Core
5
7
  module ClassConstantizer
@@ -22,20 +22,7 @@ module Spree
22
22
  class_attribute :unauthorized_redirect
23
23
  self.unauthorized_redirect = -> do
24
24
  flash[:error] = I18n.t('spree.authorization_failure')
25
- if Spree::Config.redirect_back_on_unauthorized
26
- redirect_back(fallback_location: "/unauthorized")
27
- else
28
- Spree::Deprecation.warn <<-WARN.strip_heredoc, caller
29
- Having Spree::Config.redirect_back_on_unauthorized set
30
- to `false` is deprecated and will not be supported in Solidus 3.0.
31
-
32
- Please change this configuration to `true` and be sure that your
33
- application does not break trying to redirect back when there is
34
- an unauthorized access.
35
- WARN
36
-
37
- redirect_to "/unauthorized"
38
- end
25
+ redirect_back(fallback_location: "/unauthorized")
39
26
  end
40
27
 
41
28
  rescue_from CanCan::AccessDenied do
@@ -11,23 +11,8 @@ module Spree
11
11
 
12
12
  included do
13
13
  helper_method :current_order
14
- helper_method :simple_current_order
15
14
  end
16
15
 
17
- def simple_current_order
18
- return @simple_current_order if @simple_current_order
19
-
20
- @simple_current_order = find_order_by_token_or_user
21
-
22
- if @simple_current_order
23
- @simple_current_order.last_ip_address = ip_address
24
- return @simple_current_order
25
- else
26
- @simple_current_order = Spree::Order.new(current_order_params)
27
- end
28
- end
29
- deprecate simple_current_order: :current_order, deprecator: Spree::Deprecation
30
-
31
16
  # The current incomplete order from the guest_token for use in cart and during checkout
32
17
  def current_order(options = {})
33
18
  should_create = options[:create_order_if_necessary] || false
@@ -84,16 +69,11 @@ module Spree
84
69
  current_order_params.merge(last_ip_address: ip_address)
85
70
  end
86
71
 
87
- def find_order_by_token_or_user(options = {}, with_adjustments = false)
72
+ def find_order_by_token_or_user(options = {})
88
73
  should_lock = options[:lock] || false
89
74
 
90
75
  # Find any incomplete orders for the guest_token
91
- if with_adjustments
92
- Spree::Deprecation.warn "The second argument to find_order_by_token_or_user is deprecated, and will be removed in a future version."
93
- order = Spree::Order.incomplete.includes(:adjustments).lock(should_lock).find_by(current_order_params)
94
- else
95
- order = Spree::Order.incomplete.lock(should_lock).find_by(current_order_params)
96
- end
76
+ order = Spree::Order.incomplete.lock(should_lock).find_by(current_order_params)
97
77
 
98
78
  # Find any incomplete orders for the current user
99
79
  if order.nil? && try_spree_current_user
@@ -64,60 +64,6 @@ module Spree
64
64
  params
65
65
  end
66
66
 
67
- # This method handles the awkwardness of how the html forms are currently
68
- # set up for frontend.
69
- #
70
- # This method expects a params hash in the format of:
71
- #
72
- # {
73
- # order: {
74
- # existing_card: '123',
75
- # ...other params...
76
- # },
77
- # cvc_confirm: '456', # optional
78
- # ...other params...
79
- # }
80
- #
81
- # And this method modifies the params into the format of:
82
- #
83
- # {
84
- # order: {
85
- # payments_attributes: [
86
- # {
87
- # source_attributes: {
88
- # existing_card_id: '123',
89
- # verification_value: '456',
90
- # },
91
- # },
92
- # ]
93
- # ...other params...
94
- # },
95
- # ...other params...
96
- # }
97
- #
98
- def move_existing_card_into_payments_attributes(params)
99
- return params if params[:order].blank?
100
-
101
- card_id = params[:order][:existing_card].presence
102
- cvc_confirm = params[:cvc_confirm].presence
103
-
104
- return params if card_id.nil?
105
-
106
- params[:order][:payments_attributes] = [
107
- {
108
- source_attributes: {
109
- existing_card_id: card_id,
110
- verification_value: cvc_confirm
111
- }
112
- }
113
- ]
114
-
115
- params[:order].delete(:existing_card)
116
- params.delete(:cvc_confirm)
117
-
118
- params
119
- end
120
-
121
67
  # This method handles the awkwardness of how the html forms are currently
122
68
  # set up for frontend.
123
69
  #
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/deprecation'
4
-
5
3
  module Spree
6
4
  module Core
7
5
  module ControllerHelpers
@@ -9,18 +7,12 @@ module Spree
9
7
  extend ActiveSupport::Concern
10
8
 
11
9
  included do
12
- helper_method :current_currency
13
10
  helper_method :current_pricing_options
14
11
  end
15
12
 
16
13
  def current_pricing_options
17
14
  Spree::Config.pricing_options_class.from_context(self)
18
15
  end
19
-
20
- def current_currency
21
- current_pricing_options.currency
22
- end
23
- deprecate current_currency: :current_pricing_options, deprecator: Spree::Deprecation
24
16
  end
25
17
  end
26
18
  end