solidus_core 2.11.16 → 3.0.0.rc2
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree.js.erb +0 -51
- data/app/helpers/spree/store_helper.rb +0 -11
- data/app/mailers/spree/carton_mailer.rb +1 -5
- data/app/models/concerns/spree/active_storage_adapter/attachment.rb +11 -13
- data/app/models/concerns/spree/active_storage_adapter.rb +0 -2
- data/app/models/concerns/spree/adjustment_source.rb +0 -15
- data/app/models/concerns/spree/calculated_adjustments.rb +0 -18
- data/app/models/concerns/spree/soft_deletable.rb +2 -4
- data/app/models/concerns/spree/user_address_book.rb +0 -37
- data/app/models/concerns/spree/user_methods.rb +2 -11
- data/app/models/spree/ability.rb +0 -37
- data/app/models/spree/address/name.rb +2 -20
- data/app/models/spree/address.rb +8 -187
- data/app/models/spree/adjustment.rb +0 -28
- data/app/models/spree/base.rb +12 -48
- data/app/models/spree/calculator/flexi_rate.rb +0 -5
- data/app/models/spree/calculator.rb +0 -11
- data/app/models/spree/country.rb +1 -6
- data/app/models/spree/credit_card.rb +0 -27
- data/app/models/spree/customer_return.rb +1 -4
- data/app/models/spree/image/active_storage_attachment.rb +2 -10
- data/app/models/spree/image/paperclip_attachment.rb +1 -1
- data/app/models/spree/image.rb +0 -7
- data/app/models/spree/inventory_unit.rb +0 -21
- data/app/models/spree/line_item.rb +2 -45
- data/app/models/spree/order.rb +4 -137
- data/app/models/spree/order_cancellations.rb +4 -24
- data/app/models/spree/order_shipping.rb +9 -6
- data/app/models/spree/order_updater.rb +2 -11
- data/app/models/spree/payment/cancellation.rb +3 -22
- data/app/models/spree/payment.rb +0 -3
- data/app/models/spree/payment_create.rb +1 -13
- data/app/models/spree/payment_method/bogus_credit_card.rb +9 -13
- data/app/models/spree/payment_method/credit_card.rb +1 -3
- data/app/models/spree/payment_method/simple_bogus_credit_card.rb +4 -4
- data/app/models/spree/payment_method.rb +2 -106
- data/app/models/spree/product/scopes.rb +0 -27
- data/app/models/spree/product.rb +0 -39
- data/app/models/spree/promotion/actions/create_adjustment.rb +0 -3
- data/app/models/spree/promotion/actions/create_item_adjustments.rb +0 -3
- data/app/models/spree/promotion/actions/create_quantity_adjustments.rb +0 -3
- data/app/models/spree/promotion/rules/taxon.rb +2 -15
- data/app/models/spree/promotion.rb +2 -6
- data/app/models/spree/promotion_action.rb +2 -12
- data/app/models/spree/promotion_code/batch_builder.rb +0 -14
- data/app/models/spree/promotion_code.rb +2 -2
- data/app/models/spree/promotion_rule.rb +0 -4
- data/app/models/spree/refund.rb +0 -60
- data/app/models/spree/reimbursement.rb +3 -41
- data/app/models/spree/reimbursement_performer.rb +2 -8
- data/app/models/spree/reimbursement_type/credit.rb +1 -4
- data/app/models/spree/reimbursement_type/reimbursement_helpers.rb +1 -2
- data/app/models/spree/reimbursement_type/store_credit.rb +1 -4
- data/app/models/spree/return_authorization.rb +1 -4
- data/app/models/spree/return_item.rb +1 -19
- data/app/models/spree/shipment.rb +1 -54
- data/app/models/spree/shipping_method.rb +0 -25
- data/app/models/spree/shipping_rate.rb +0 -2
- data/app/models/spree/state.rb +0 -4
- data/app/models/spree/stock/simple_coordinator.rb +1 -20
- data/app/models/spree/stock/splitter/base.rb +2 -7
- data/app/models/spree/stock_item.rb +1 -7
- data/app/models/spree/store.rb +0 -12
- data/app/models/spree/store_credit.rb +0 -8
- data/app/models/spree/store_credit_category.rb +0 -32
- data/app/models/spree/tax_calculator/shipping_rate.rb +1 -12
- data/app/models/spree/tax_rate.rb +0 -27
- data/app/models/spree/taxon/active_storage_attachment.rb +0 -5
- data/app/models/spree/taxon/paperclip_attachment.rb +0 -5
- data/app/models/spree/taxon.rb +0 -11
- data/app/models/spree/user_address.rb +0 -5
- data/app/models/spree/variant.rb +2 -46
- data/config/locales/en.yml +0 -8
- data/db/migrate/20180416083007_add_apply_to_all_to_variant_property_rule.rb +1 -1
- data/lib/generators/solidus/install/install_generator.rb +13 -2
- data/lib/generators/solidus/install/templates/config/initializers/spree.rb.tt +3 -39
- data/lib/generators/spree/dummy/dummy_generator.rb +2 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +6 -1
- data/lib/generators/spree/dummy/templates/rails/storage.yml +3 -0
- data/lib/generators/spree/dummy/templates/rails/test.rb +2 -0
- data/lib/spree/app_configuration.rb +6 -73
- data/lib/spree/core/class_constantizer.rb +2 -0
- data/lib/spree/core/controller_helpers/auth.rb +1 -14
- data/lib/spree/core/controller_helpers/order.rb +2 -22
- data/lib/spree/core/controller_helpers/payment_parameters.rb +0 -54
- data/lib/spree/core/controller_helpers/pricing.rb +0 -8
- data/lib/spree/core/controller_helpers/strong_parameters.rb +0 -4
- data/lib/spree/core/engine.rb +0 -43
- data/lib/spree/core/environment_extension.rb +0 -9
- data/lib/spree/core/product_filters.rb +0 -40
- data/lib/spree/core/role_configuration.rb +0 -14
- data/lib/spree/core/search/base.rb +0 -26
- data/lib/spree/core/state_machines.rb +2 -11
- data/lib/spree/core/validators/email.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +9 -8
- data/lib/spree/event/configuration.rb +0 -5
- data/lib/spree/event/subscriber.rb +0 -18
- data/lib/spree/event/subscriber_registry.rb +3 -1
- data/lib/spree/event.rb +0 -31
- data/lib/spree/i18n.rb +0 -22
- data/lib/spree/money.rb +3 -18
- data/lib/spree/permitted_attributes.rb +3 -60
- data/lib/spree/testing_support/blacklist_urls.rb +1 -1
- data/lib/spree/testing_support/capybara_ext.rb +0 -30
- data/lib/spree/testing_support/controller_requests.rb +0 -82
- data/lib/spree/testing_support/dummy_app/migrations.rb +0 -3
- data/lib/spree/testing_support/dummy_app.rb +6 -16
- data/lib/spree/testing_support/factories/order_factory.rb +0 -1
- data/lib/spree/testing_support/factories/refund_factory.rb +0 -1
- data/lib/spree/testing_support/order_walkthrough.rb +0 -3
- data/lib/spree/testing_support/preferences.rb +0 -25
- data/lib/spree/testing_support.rb +1 -1
- data/lib/tasks/migrations/migrate_default_billing_addresses_to_address_book.rake +20 -15
- data/solidus_core.gemspec +1 -24
- metadata +9 -74
- data/app/mailers/spree/test_mailer.rb +0 -13
- data/app/models/concerns/spree/user_payment_source.rb +0 -26
- data/app/models/spree/calculator/free_shipping.rb +0 -22
- data/app/models/spree/calculator/percent_per_item.rb +0 -51
- data/app/models/spree/calculator/price_sack.rb +0 -28
- data/app/models/spree/gateway/bogus.rb +0 -13
- data/app/models/spree/gateway/bogus_simple.rb +0 -13
- data/app/models/spree/gateway.rb +0 -14
- data/app/models/spree/order/checkout.rb +0 -244
- data/app/models/spree/order_capturing.rb +0 -50
- data/app/models/spree/promotion_handler/free_shipping.rb +0 -9
- data/lib/generators/spree/install/install_generator.rb +0 -15
- data/lib/solidus/migrations/rename_gateways.rb +0 -41
- data/lib/spree/core/current_store.rb +0 -24
- data/lib/spree/paranoia_deprecations.rb +0 -41
- data/lib/spree/preferences/persistable.rb +0 -23
- data/lib/spree/promo/environment.rb +0 -12
- data/lib/spree/testing_support/bar_ability.rb +0 -19
- data/lib/spree/testing_support/fixtures/file.txt +0 -1
- data/lib/tasks/core.rake +0 -104
- data/lib/tasks/email.rake +0 -12
- data/lib/tasks/migrations/copy_order_bill_address_to_credit_card.rake +0 -119
- data/lib/tasks/migrations/migrate_shipping_rate_taxes.rake +0 -22
- data/lib/tasks/migrations/migrate_user_addresses.rake +0 -34
- data/lib/tasks/migrations/rename_gateways.rake +0 -23
- data/lib/tasks/order_capturing.rake +0 -27
- data/lib/tasks/solidus/check_orders_with_invalid_email.rake +0 -18
|
@@ -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
|
|
|
@@ -171,10 +182,10 @@ module Solidus
|
|
|
171
182
|
end
|
|
172
183
|
|
|
173
184
|
bundle_cleanly{ run "bundle install" } if @plugins_to_be_installed.any?
|
|
174
|
-
run "spring stop"
|
|
185
|
+
run "spring stop"
|
|
175
186
|
|
|
176
187
|
@plugin_generators_to_run.each do |plugin_generator_name|
|
|
177
|
-
generate "#{plugin_generator_name} --skip_migrations=
|
|
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
|
-
#
|
|
31
|
-
config.image_attachment_module = 'Spree::Image::
|
|
32
|
-
config.taxon_attachment_module = 'Spree::Taxon::
|
|
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[:
|
|
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 %>
|
|
@@ -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,31 +437,23 @@ module Spree
|
|
|
496
437
|
|
|
497
438
|
# Allows switching attachment library for Image
|
|
498
439
|
#
|
|
499
|
-
# `Spree::Image::
|
|
500
|
-
# is the default and provides the
|
|
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::
|
|
506
|
-
|
|
507
|
-
# @!attribute [rw] allowed_image_mime_types
|
|
508
|
-
#
|
|
509
|
-
# Defines which MIME types are allowed for images
|
|
510
|
-
# `%w(image/jpeg image/jpg image/png image/gif).freeze` is the default.
|
|
511
|
-
#
|
|
512
|
-
# @return [Array]
|
|
513
|
-
class_name_attribute :allowed_image_mime_types, default: %w(image/jpeg image/jpg image/png image/gif).freeze
|
|
446
|
+
class_name_attribute :image_attachment_module, default: 'Spree::Image::ActiveStorageAttachment'
|
|
514
447
|
|
|
515
448
|
# Allows switching attachment library for Taxon
|
|
516
449
|
#
|
|
517
|
-
# `Spree::Taxon::
|
|
518
|
-
# is the default and provides the
|
|
450
|
+
# `Spree::Taxon::ActiveStorageAttachment`
|
|
451
|
+
# is the default and provides the Active Storage implementation.
|
|
519
452
|
#
|
|
520
453
|
# @!attribute [rw] taxon_attachment_module
|
|
521
454
|
# @return [Module] a module that can be included into Spree::Taxon to allow attachments
|
|
522
455
|
# Enumerable of taxons adhering to the present_taxon_class interface
|
|
523
|
-
class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::
|
|
456
|
+
class_name_attribute :taxon_attachment_module, default: 'Spree::Taxon::ActiveStorageAttachment'
|
|
524
457
|
|
|
525
458
|
# Allows providing your own class instance for generating order numbers.
|
|
526
459
|
#
|
|
@@ -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
|
-
|
|
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 = {}
|
|
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
|
-
|
|
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
|
data/lib/spree/core/engine.rb
CHANGED
|
@@ -56,41 +56,6 @@ module Spree
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
config.after_initialize do
|
|
59
|
-
if Spree::Config.raise_with_invalid_currency == true
|
|
60
|
-
Spree::Deprecation.warn(
|
|
61
|
-
'Spree::Config.raise_with_invalid_currency set to true is ' \
|
|
62
|
-
'deprecated. Please note that by switching this value, ' \
|
|
63
|
-
'Spree::LineItem::CurrencyMismatch will not be raised anymore.',
|
|
64
|
-
caller
|
|
65
|
-
)
|
|
66
|
-
end
|
|
67
|
-
if Spree::Config.consider_actionless_promotion_active == true
|
|
68
|
-
Spree::Deprecation.warn(
|
|
69
|
-
'Spree::Config.consider_actionless_promotion_active set to true is ' \
|
|
70
|
-
'deprecated. Please note that by switching this value, ' \
|
|
71
|
-
'promotions with no actions will be considered active.',
|
|
72
|
-
caller
|
|
73
|
-
)
|
|
74
|
-
end
|
|
75
|
-
if Spree::Config.run_order_validations_on_order_updater != true
|
|
76
|
-
Spree::Deprecation.warn(
|
|
77
|
-
'Spree::Config.run_order_validations_on_order_updater set to false is ' \
|
|
78
|
-
'deprecated and will not be possibile in Solidus 3.0. Please switch this ' \
|
|
79
|
-
'value to true and check that everything works as expected.',
|
|
80
|
-
caller
|
|
81
|
-
)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
if Spree::Config.use_legacy_address_state_validator != false
|
|
85
|
-
Spree::Deprecation.warn(<<~DEPRECATION.squish, caller)
|
|
86
|
-
Spree::Config.use_legacy_address_state_validator set to true has been
|
|
87
|
-
deprecated and will be removed in Solidus 3.0. The Spree::Address state
|
|
88
|
-
validation has been extracted into a configurable external class.
|
|
89
|
-
Switch Spree::Config.use_legacy_address_state_validator to false to start
|
|
90
|
-
using the external validation class.
|
|
91
|
-
DEPRECATION
|
|
92
|
-
end
|
|
93
|
-
|
|
94
59
|
# Load in mailer previews for apps to use in development.
|
|
95
60
|
# We need to make sure we call `Preview.all` before requiring our
|
|
96
61
|
# previews, otherwise any previews the app attempts to add need to be
|
|
@@ -103,14 +68,6 @@ module Spree
|
|
|
103
68
|
end
|
|
104
69
|
end
|
|
105
70
|
end
|
|
106
|
-
|
|
107
|
-
config.after_initialize do
|
|
108
|
-
if defined?(Spree::Auth::Engine) &&
|
|
109
|
-
Gem::Version.new(Spree::Auth::VERSION) < Gem::Version.new('2.5.4') &&
|
|
110
|
-
defined?(Spree::UsersController)
|
|
111
|
-
Spree::UsersController.protect_from_forgery with: :exception
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
71
|
end
|
|
115
72
|
end
|
|
116
73
|
end
|
|
@@ -22,15 +22,6 @@ module Spree
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
-
|
|
26
|
-
def add_class(name)
|
|
27
|
-
Spree::Deprecation.warn(
|
|
28
|
-
'This method is deprecated. ' \
|
|
29
|
-
"Please use `#{self.class}.add_class_set(#{name.inspect})` instead.",
|
|
30
|
-
caller,
|
|
31
|
-
)
|
|
32
|
-
singleton_class.send(:add_class_set, name)
|
|
33
|
-
end
|
|
34
25
|
end
|
|
35
26
|
end
|
|
36
27
|
end
|
|
@@ -153,46 +153,6 @@ module Spree
|
|
|
153
153
|
labels: brands.sort.map { |key| [key, key] }
|
|
154
154
|
}
|
|
155
155
|
end
|
|
156
|
-
|
|
157
|
-
# Provide filtering on the immediate children of a taxon
|
|
158
|
-
#
|
|
159
|
-
# This doesn't fit the pattern of the examples above, so there's a few changes.
|
|
160
|
-
# Firstly, it uses an existing scope which was not built for filtering - and so
|
|
161
|
-
# has no need of a conditions mapping, and secondly, it has a mapping of name
|
|
162
|
-
# to the argument type expected by the other scope.
|
|
163
|
-
#
|
|
164
|
-
# This technique is useful for filtering on objects (by passing ids) or with a
|
|
165
|
-
# scope that can be used directly (eg. testing only ever on a single property).
|
|
166
|
-
#
|
|
167
|
-
# This scope selects products in any of the active taxons or their children.
|
|
168
|
-
#
|
|
169
|
-
def self.taxons_below(taxon)
|
|
170
|
-
Spree::Deprecation.warn "taxons_below is deprecated in solidus_core. Please add it to your own application to continue using it."
|
|
171
|
-
return Spree::Core::ProductFilters.all_taxons if taxon.nil?
|
|
172
|
-
{
|
|
173
|
-
name: 'Taxons under ' + taxon.name,
|
|
174
|
-
scope: :taxons_id_in_tree_any,
|
|
175
|
-
labels: taxon.children.sort_by(&:position).map { |element| [element.name, element.id] },
|
|
176
|
-
conds: nil
|
|
177
|
-
}
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
# Filtering by the list of all taxons
|
|
181
|
-
#
|
|
182
|
-
# Similar idea as above, but we don't want the descendants' products, hence
|
|
183
|
-
# it uses one of the auto-generated scopes from Ransack.
|
|
184
|
-
#
|
|
185
|
-
# idea: expand the format to allow nesting of labels?
|
|
186
|
-
def self.all_taxons
|
|
187
|
-
Spree::Deprecation.warn "all_taxons is deprecated in solidus_core. Please add it to your own application to continue using it."
|
|
188
|
-
taxons = Spree::Taxonomy.all.flat_map { |element| [element.root] + element.root.descendants }
|
|
189
|
-
{
|
|
190
|
-
name: 'All taxons',
|
|
191
|
-
scope: :taxons_id_equals_any,
|
|
192
|
-
labels: taxons.sort_by(&:name).map { |element| [element.name, element.id] },
|
|
193
|
-
conds: nil # not needed
|
|
194
|
-
}
|
|
195
|
-
end
|
|
196
156
|
end
|
|
197
157
|
end
|
|
198
158
|
end
|
|
@@ -31,20 +31,6 @@ module Spree
|
|
|
31
31
|
|
|
32
32
|
attr_accessor :roles
|
|
33
33
|
|
|
34
|
-
class << self
|
|
35
|
-
def instance
|
|
36
|
-
Spree::Deprecation.warn "Spree::RoleConfiguration.instance is DEPRECATED use Spree::Config.roles instead"
|
|
37
|
-
Spree::Config.roles
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Yields the instance of the singleton, used for configuration
|
|
41
|
-
# @yieldparam instance [Spree::RoleConfiguration]
|
|
42
|
-
def configure
|
|
43
|
-
Spree::Deprecation.warn "Spree::RoleConfiguration.configure is deprecated. Call Spree::Config.roles.assign_permissions instead"
|
|
44
|
-
yield(Spree::Config.roles)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
34
|
# Given a CanCan::Ability, and a user, determine what permissions sets can
|
|
49
35
|
# be activated on the ability, then activate them.
|
|
50
36
|
#
|
|
@@ -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 Search
|
|
@@ -16,17 +14,6 @@ module Spree
|
|
|
16
14
|
prepare(params)
|
|
17
15
|
end
|
|
18
16
|
|
|
19
|
-
def current_currency=(currency)
|
|
20
|
-
self.pricing_options = Spree::Config.pricing_options_class.new(
|
|
21
|
-
pricing_options.desired_attributes.merge(currency: currency)
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def current_currency
|
|
26
|
-
pricing_options.currency
|
|
27
|
-
end
|
|
28
|
-
deprecate :current_currency, :current_currency=, deprecator: Spree::Deprecation
|
|
29
|
-
|
|
30
17
|
def retrieve_products
|
|
31
18
|
@products = get_base_scope
|
|
32
19
|
curr_page = @properties[:page] || 1
|
|
@@ -37,19 +24,6 @@ module Spree
|
|
|
37
24
|
@products = @products.page(curr_page).per(@properties[:per_page])
|
|
38
25
|
end
|
|
39
26
|
|
|
40
|
-
def method_missing(name)
|
|
41
|
-
if @properties.key?(name)
|
|
42
|
-
Spree::Deprecation.warn "Accessing Searcher's #{name} property using #{self.class.name}##{name} is deprecated without replacement"
|
|
43
|
-
@properties[name]
|
|
44
|
-
else
|
|
45
|
-
super
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def respond_to_missing?(name)
|
|
50
|
-
@properties.key?(name) || super(name)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
27
|
protected
|
|
54
28
|
|
|
55
29
|
def get_base_scope
|