solidus_core 4.7.2 → 4.8.0
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/LICENSE +3 -0
- data/app/helpers/spree/base_helper.rb +3 -3
- data/app/helpers/spree/core/controller_helpers/auth.rb +1 -1
- data/app/helpers/spree/core/controller_helpers/common.rb +2 -2
- data/app/helpers/spree/core/controller_helpers/timezone.rb +55 -0
- data/app/helpers/spree/products_helper.rb +2 -2
- data/app/jobs/spree/base_job.rb +1 -1
- data/app/mailers/spree/base_mailer.rb +2 -2
- data/app/models/spree/address.rb +1 -1
- data/app/models/spree/adjustment.rb +1 -1
- data/app/models/spree/calculator/flat_rate.rb +2 -2
- data/app/models/spree/calculator/shipping/flat_rate.rb +1 -1
- data/app/models/spree/calculator/shipping/flexi_rate.rb +1 -1
- data/app/models/spree/calculator/shipping/per_item.rb +1 -1
- data/app/models/spree/calculator/shipping/price_sack.rb +1 -1
- data/app/models/spree/calculator.rb +1 -1
- data/app/models/spree/country.rb +1 -1
- data/app/models/spree/customer_return.rb +7 -0
- data/app/models/spree/exchange.rb +4 -1
- data/app/models/spree/image/active_storage_attachment.rb +15 -0
- data/app/models/spree/image/paperclip_attachment.rb +3 -0
- data/app/models/spree/image.rb +4 -0
- data/app/models/spree/log_entry.rb +26 -22
- data/app/models/spree/money.rb +2 -2
- data/app/models/spree/order/payments.rb +1 -1
- data/app/models/spree/order.rb +15 -17
- data/app/models/spree/order_cancellations.rb +1 -0
- data/app/models/spree/order_mutex.rb +1 -1
- data/app/models/spree/order_shipping.rb +17 -0
- data/app/models/spree/order_updater.rb +1 -1
- data/app/models/spree/payment_method/bogus_credit_card.rb +4 -0
- data/app/models/spree/payment_method/check.rb +4 -2
- data/app/models/spree/payment_method.rb +1 -1
- data/app/models/spree/price.rb +1 -1
- data/app/models/spree/product.rb +1 -1
- data/app/models/spree/product_option_type.rb +2 -0
- data/app/models/spree/refund.rb +17 -0
- data/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb +1 -1
- data/app/models/spree/return_item.rb +1 -1
- data/app/models/spree/shipment.rb +5 -3
- data/app/models/spree/stock/inventory_unit_builder.rb +1 -0
- data/app/models/spree/stock/simple_coordinator.rb +9 -2
- data/app/models/spree/store.rb +8 -1
- data/app/models/spree/store_credit.rb +1 -1
- data/app/models/spree/tax_calculator/default.rb +2 -0
- data/app/models/spree/variant/pricing_options.rb +1 -1
- data/app/models/spree/variant.rb +3 -3
- data/config/locales/en.yml +13 -0
- data/db/default/spree/states.rb +1 -1
- data/db/migrate/20260924120000_add_address_to_spree_stores.rb +9 -0
- data/lib/generators/solidus/install/app_templates/authentication/existing.rb +0 -2
- data/lib/generators/solidus/install/app_templates/frontend/starter.rb +19 -1
- data/lib/generators/solidus/install/app_templates/payment_method/paypal.rb +2 -1
- data/lib/generators/solidus/install/install_generator.rb +7 -7
- data/lib/spree/app_configuration.rb +51 -0
- data/lib/spree/core/search/base.rb +3 -1
- data/lib/spree/core/version.rb +2 -2
- data/lib/spree/core.rb +0 -1
- data/lib/spree/permitted_attributes.rb +3 -2
- data/lib/spree/testing_support/capybara_ext.rb +0 -10
- data/lib/spree/testing_support/factories/calculator_factory.rb +6 -0
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_factory.rb +4 -0
- data/lib/spree/testing_support/order_walkthrough.rb +1 -1
- data/solidus_core.gemspec +3 -3
- metadata +13 -11
|
@@ -5,5 +5,7 @@ module Spree
|
|
|
5
5
|
belongs_to :product, class_name: "Spree::Product", inverse_of: :product_option_types, touch: true
|
|
6
6
|
belongs_to :option_type, class_name: "Spree::OptionType", inverse_of: :product_option_types
|
|
7
7
|
acts_as_list scope: :product
|
|
8
|
+
|
|
9
|
+
delegate :name, :presentation, :option_values, to: :option_type
|
|
8
10
|
end
|
|
9
11
|
end
|
data/app/models/spree/refund.rb
CHANGED
|
@@ -15,6 +15,7 @@ module Spree
|
|
|
15
15
|
validates :amount, presence: true, numericality: {greater_than: 0}
|
|
16
16
|
|
|
17
17
|
validate :amount_is_less_than_or_equal_to_allowed_amount, on: :create
|
|
18
|
+
validate :payment_is_in_refundable_state, on: :create
|
|
18
19
|
|
|
19
20
|
attr_reader :perform_response
|
|
20
21
|
|
|
@@ -91,6 +92,22 @@ module Spree
|
|
|
91
92
|
end
|
|
92
93
|
end
|
|
93
94
|
|
|
95
|
+
def payment_is_in_refundable_state
|
|
96
|
+
return if payment.nil? || Spree::Config.refundable_payment_states.include?(payment.state)
|
|
97
|
+
|
|
98
|
+
if Spree::Config.require_refundable_payment_state
|
|
99
|
+
errors.add(:payment, :not_refundable)
|
|
100
|
+
else
|
|
101
|
+
Spree.deprecator.warn(
|
|
102
|
+
"Creating a refund for a payment in the '#{payment.state}' state is deprecated " \
|
|
103
|
+
"and will become a validation error in Solidus 5.0. Refunds should only be created " \
|
|
104
|
+
"for payments in one of these states: #{Spree::Config.refundable_payment_states.join(", ")}. " \
|
|
105
|
+
"Set `Spree::Config.require_refundable_payment_state = true` to adopt the new " \
|
|
106
|
+
"behavior early."
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
94
111
|
def update_order
|
|
95
112
|
payment.order.recalculate
|
|
96
113
|
end
|
|
@@ -5,7 +5,7 @@ module Spree
|
|
|
5
5
|
module EligibilityValidator
|
|
6
6
|
class TimeSincePurchase < Spree::ReturnItem::EligibilityValidator::BaseValidator
|
|
7
7
|
def eligible_for_return?
|
|
8
|
-
if (@return_item.inventory_unit.order.completed_at + Spree::Config
|
|
8
|
+
if (@return_item.inventory_unit.order.completed_at + Spree::Config.return_eligibility_number_of_days.days) > Time.current
|
|
9
9
|
true
|
|
10
10
|
else
|
|
11
11
|
add_error(:number_of_days, I18n.t("spree.return_item_time_period_ineligible"))
|
|
@@ -55,7 +55,7 @@ module Spree
|
|
|
55
55
|
def can_transition_from_pending_to_ready?
|
|
56
56
|
order.can_ship? &&
|
|
57
57
|
inventory_units.all? { |iu| iu.shipped? || iu.allow_ship? || iu.canceled? } &&
|
|
58
|
-
(order.paid? || !Spree::Config
|
|
58
|
+
(order.paid? || !Spree::Config.require_payment_to_ship)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def can_transition_from_canceled_to_ready?
|
|
@@ -83,7 +83,7 @@ module Spree
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def currency
|
|
86
|
-
order ? order.currency : Spree::Config
|
|
86
|
+
order ? order.currency : Spree::Config.currency
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
# @return [BigDecimal] the amount of this shipment, taking into
|
|
@@ -229,6 +229,8 @@ module Spree
|
|
|
229
229
|
self.state =
|
|
230
230
|
if shipped?
|
|
231
231
|
"shipped"
|
|
232
|
+
elsif inventory_units.none?
|
|
233
|
+
"pending"
|
|
232
234
|
elsif order.canceled? || inventory_units.all?(&:canceled?)
|
|
233
235
|
"canceled"
|
|
234
236
|
elsif !order.can_ship?
|
|
@@ -267,7 +269,7 @@ module Spree
|
|
|
267
269
|
def to_package
|
|
268
270
|
package = Stock::Package.new(stock_location)
|
|
269
271
|
package.shipment = self
|
|
270
|
-
inventory_units.includes(variant: :product).joins(:variant).group_by(&:state).each do |state, state_inventory_units|
|
|
272
|
+
inventory_units.not_canceled.includes(variant: :product).joins(:variant).group_by(&:state).each do |state, state_inventory_units|
|
|
271
273
|
package.add_multiple state_inventory_units, state.to_sym
|
|
272
274
|
end
|
|
273
275
|
package
|
|
@@ -12,7 +12,7 @@ module Spree
|
|
|
12
12
|
# * Combine allocated and on hand inventory into a single shipment per-location
|
|
13
13
|
#
|
|
14
14
|
# Allocation logic can be changed using a custom class (as
|
|
15
|
-
# configured in Spree::Config
|
|
15
|
+
# configured in Spree::Config.stock.allocator_class)
|
|
16
16
|
#
|
|
17
17
|
# After allocation, splitters are run on each Package (as configured in
|
|
18
18
|
# Spree::Config.environment.stock_splitters)
|
|
@@ -27,7 +27,14 @@ module Spree
|
|
|
27
27
|
:filtered_stock_locations, :inventory_units_by_variant, :desired,
|
|
28
28
|
:availability, :allocator, :packages
|
|
29
29
|
|
|
30
|
-
def initialize(order,
|
|
30
|
+
def initialize(order, inventory_units_deprecated = nil, inventory_units: nil)
|
|
31
|
+
if inventory_units_deprecated
|
|
32
|
+
Spree.deprecator.warn "Using the `inventory_units` positional " \
|
|
33
|
+
"argument is deprecated in favor of using the keyword argument. "
|
|
34
|
+
|
|
35
|
+
inventory_units ||= inventory_units_deprecated
|
|
36
|
+
end
|
|
37
|
+
|
|
31
38
|
@order = order
|
|
32
39
|
@inventory_units =
|
|
33
40
|
inventory_units || Spree::Config.stock.inventory_unit_builder_class.new(order).units
|
data/app/models/spree/store.rb
CHANGED
|
@@ -17,6 +17,8 @@ module Spree
|
|
|
17
17
|
|
|
18
18
|
has_many :orders, class_name: "Spree::Order"
|
|
19
19
|
|
|
20
|
+
belongs_to :address, class_name: "Spree::Address", optional: true, validate: true
|
|
21
|
+
|
|
20
22
|
validates :code, presence: true, uniqueness: {allow_blank: true, case_sensitive: true}
|
|
21
23
|
validates :name, presence: true
|
|
22
24
|
validates :url, presence: true
|
|
@@ -25,7 +27,7 @@ module Spree
|
|
|
25
27
|
self.allowed_ransackable_attributes = %w[name url code]
|
|
26
28
|
|
|
27
29
|
before_save :ensure_default_exists_and_is_unique
|
|
28
|
-
before_destroy :validate_not_default
|
|
30
|
+
before_destroy :validate_not_default, prepend: true
|
|
29
31
|
|
|
30
32
|
enum :reverse_charge_status, {
|
|
31
33
|
disabled: 0,
|
|
@@ -51,6 +53,10 @@ module Spree
|
|
|
51
53
|
end
|
|
52
54
|
end
|
|
53
55
|
|
|
56
|
+
def address_attributes=(attributes)
|
|
57
|
+
self.address = Spree::Address.immutable_merge(address, attributes)
|
|
58
|
+
end
|
|
59
|
+
|
|
54
60
|
def self.default
|
|
55
61
|
where(default: true).first || new
|
|
56
62
|
end
|
|
@@ -73,6 +79,7 @@ module Spree
|
|
|
73
79
|
def validate_not_default
|
|
74
80
|
if default
|
|
75
81
|
errors.add(:base, :cannot_destroy_default_store)
|
|
82
|
+
throw :abort
|
|
76
83
|
end
|
|
77
84
|
end
|
|
78
85
|
end
|
|
@@ -209,7 +209,7 @@ class Spree::StoreCredit < Spree::PaymentSource
|
|
|
209
209
|
def create_credit_record(amount, action_attributes = {})
|
|
210
210
|
# Setting credit_to_new_allocation to true will create a new allocation anytime #credit is called
|
|
211
211
|
# If it is not set, it will update the store credit's amount in place
|
|
212
|
-
credit = if Spree::Config
|
|
212
|
+
credit = if Spree::Config.credit_to_new_allocation
|
|
213
213
|
Spree::StoreCredit.new(create_credit_record_params(amount))
|
|
214
214
|
else
|
|
215
215
|
self.amount_used = amount_used - amount
|
|
@@ -23,6 +23,8 @@ module Spree
|
|
|
23
23
|
#
|
|
24
24
|
# @return [Spree::Tax::OrderTax] the calculated taxes for the order
|
|
25
25
|
def calculate
|
|
26
|
+
ActiveRecord::Associations::Preloader.new(records: order.line_items, associations: {variant: :product}).call
|
|
27
|
+
|
|
26
28
|
Spree::Tax::OrderTax.new(
|
|
27
29
|
order_id: order.id,
|
|
28
30
|
order_taxes: order_rates,
|
|
@@ -54,7 +54,7 @@ module Spree
|
|
|
54
54
|
# @return [Spree::Variant::PricingOptions] pricing options for pricing a line item
|
|
55
55
|
def self.from_context(context)
|
|
56
56
|
new(
|
|
57
|
-
currency: context.current_store.try!(:default_currency).presence || Spree::Config
|
|
57
|
+
currency: context.current_store.try!(:default_currency).presence || Spree::Config.currency,
|
|
58
58
|
country_iso: context.current_store.try!(:cart_tax_country_iso).presence
|
|
59
59
|
)
|
|
60
60
|
end
|
data/app/models/spree/variant.rb
CHANGED
|
@@ -400,17 +400,17 @@ module Spree
|
|
|
400
400
|
|
|
401
401
|
# Ensures a new variant takes the product master price when price is not supplied
|
|
402
402
|
def set_price
|
|
403
|
-
self.price = product.master.price if price.nil? && Spree::Config
|
|
403
|
+
self.price = product.master.price if price.nil? && Spree::Config.require_master_price && !is_master?
|
|
404
404
|
end
|
|
405
405
|
|
|
406
406
|
def check_price
|
|
407
|
-
if price.nil? && Spree::Config
|
|
407
|
+
if price.nil? && Spree::Config.require_master_price && is_master?
|
|
408
408
|
errors.add :price, "Must supply price for variant or master.price for product."
|
|
409
409
|
end
|
|
410
410
|
end
|
|
411
411
|
|
|
412
412
|
def set_cost_currency
|
|
413
|
-
self.cost_currency = Spree::Config
|
|
413
|
+
self.cost_currency = Spree::Config.currency if cost_currency.blank?
|
|
414
414
|
end
|
|
415
415
|
|
|
416
416
|
def create_stock_items
|
data/config/locales/en.yml
CHANGED
|
@@ -158,6 +158,9 @@ en:
|
|
|
158
158
|
display_on: Display
|
|
159
159
|
name: Name
|
|
160
160
|
preference_source: Preference Source
|
|
161
|
+
preferred_server: Server
|
|
162
|
+
preferred_test_mode: Test Mode
|
|
163
|
+
store_ids: Stores
|
|
161
164
|
type: Type
|
|
162
165
|
spree/price:
|
|
163
166
|
amount: Price
|
|
@@ -191,6 +194,7 @@ en:
|
|
|
191
194
|
sku: Master SKU
|
|
192
195
|
slug: Slug
|
|
193
196
|
tax_category: Tax Category
|
|
197
|
+
taxon_ids: Categories
|
|
194
198
|
weight: Weight
|
|
195
199
|
width: Width
|
|
196
200
|
spree/product_property:
|
|
@@ -395,12 +399,15 @@ en:
|
|
|
395
399
|
tax_code: Tax Code
|
|
396
400
|
spree/tax_rate:
|
|
397
401
|
amount: Rate
|
|
402
|
+
calculator_type: Calculator
|
|
398
403
|
expires_at: Expiration Date
|
|
399
404
|
included_in_price: Included in Price
|
|
405
|
+
level: Tax Rate Level
|
|
400
406
|
name: Name
|
|
401
407
|
show_rate_in_label: Show Rate in Label
|
|
402
408
|
starts_at: Start Date
|
|
403
409
|
tax_categories: Tax Categories
|
|
410
|
+
tax_category_ids: Tax Categories
|
|
404
411
|
spree/taxon:
|
|
405
412
|
description: Description
|
|
406
413
|
icon: Icon
|
|
@@ -408,6 +415,7 @@ en:
|
|
|
408
415
|
meta_keywords: Meta Keywords
|
|
409
416
|
meta_title: Meta Title
|
|
410
417
|
name: Name
|
|
418
|
+
parent_id: Parent Category
|
|
411
419
|
permalink: Permalink
|
|
412
420
|
position: Position
|
|
413
421
|
spree/taxonomy:
|
|
@@ -495,6 +503,8 @@ en:
|
|
|
495
503
|
attributes:
|
|
496
504
|
amount:
|
|
497
505
|
greater_than_allowed: is greater than the allowed amount.
|
|
506
|
+
payment:
|
|
507
|
+
not_refundable: cannot be refunded in its current state.
|
|
498
508
|
spree/reimbursement:
|
|
499
509
|
attributes:
|
|
500
510
|
base:
|
|
@@ -1130,6 +1140,7 @@ en:
|
|
|
1130
1140
|
choose_currency: Choose Currency
|
|
1131
1141
|
choose_dashboard_locale: Choose Dashboard Locale
|
|
1132
1142
|
choose_dashboard_theme: Choose Dashboard Theme
|
|
1143
|
+
choose_dashboard_timezone: Choose Dashboard Timezone
|
|
1133
1144
|
choose_location: Choose Location
|
|
1134
1145
|
choose_reason: Choose Reason
|
|
1135
1146
|
city: City
|
|
@@ -1942,6 +1953,7 @@ en:
|
|
|
1942
1953
|
payment_could_not_be_created: Payment could not be created.
|
|
1943
1954
|
payment_identifier: Payment Identifier
|
|
1944
1955
|
payment_information: Payment Information
|
|
1956
|
+
payment_is_not_refundable: This payment cannot be refunded in its current state.
|
|
1945
1957
|
payment_method: Payment Method
|
|
1946
1958
|
payment_method_not_supported: That payment method is unsupported. Please choose another one.
|
|
1947
1959
|
payment_method_settings_warning: If you are changing the payment method type, you must save first before you can edit the payment method settings
|
|
@@ -2093,6 +2105,7 @@ en:
|
|
|
2093
2105
|
return_items: Return Items
|
|
2094
2106
|
return_items_cannot_be_associated_with_multiple_orders: Return items cannot be associated with multiple orders.
|
|
2095
2107
|
return_items_cannot_be_created_for_inventory_units_that_are_already_awaiting_exchange: Return items cannot be created for inventory units that are already awaiting exchange.
|
|
2108
|
+
return_items_must_have_shipped_inventory_units: Return items can only be created for shipped inventory units.
|
|
2096
2109
|
return_number: Return Number
|
|
2097
2110
|
return_quantity: Return Quantity
|
|
2098
2111
|
return_reasons: Return Reasons
|
data/db/default/spree/states.rb
CHANGED
|
@@ -13,7 +13,7 @@ ActiveRecord::Base.transaction do
|
|
|
13
13
|
carmen_country = Carmen::Country.coded(country.iso)
|
|
14
14
|
next unless carmen_country.subregions?
|
|
15
15
|
|
|
16
|
-
if Spree::Config
|
|
16
|
+
if Spree::Config.countries_that_use_nested_subregions.include? country.iso
|
|
17
17
|
create_states(carmen_country.subregions.flat_map(&:subregions), country)
|
|
18
18
|
else
|
|
19
19
|
create_states(carmen_country.subregions, country)
|
|
@@ -4,9 +4,7 @@ begin
|
|
|
4
4
|
user_class.classify.constantize
|
|
5
5
|
rescue NameError
|
|
6
6
|
say_status :error, "Can't find an existing user class named #{user_class.classify}, plese set up one before using this authentication option.", :red
|
|
7
|
-
# rubocop:disable Rails/Exit
|
|
8
7
|
abort
|
|
9
|
-
# rubocop:enable Rails/Exit
|
|
10
8
|
end
|
|
11
9
|
|
|
12
10
|
generate "spree:custom_user #{user_class.shellescape}"
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
template =
|
|
4
|
+
ENV["SOLIDUS_STOREFRONT_TEMPLATE"] ||
|
|
5
|
+
begin
|
|
6
|
+
version = Spree.solidus_version if defined?(Spree) && Spree.respond_to?(:solidus_version)
|
|
7
|
+
gem_version = version ? Gem::Version.new(version) : nil
|
|
8
|
+
|
|
9
|
+
ref =
|
|
10
|
+
if gem_version && !gem_version.prerelease?
|
|
11
|
+
"v#{gem_version.segments[0, 2].join(".")}"
|
|
12
|
+
else
|
|
13
|
+
"main"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
"https://github.com/solidusio/solidus/raw/#{ref}/storefront/template.rb"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
apply template
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
unless Bundler.locked_gems.dependencies["solidus_paypal_commerce_platform"]
|
|
2
|
-
|
|
2
|
+
# The released gem uses the old enum syntax and breaks on recent Ruby/Rails, so install from GitHub.
|
|
3
|
+
bundle_command "add solidus_paypal_commerce_platform --github solidusio/solidus_paypal_commerce_platform"
|
|
3
4
|
end
|
|
4
5
|
|
|
5
6
|
generate "solidus_paypal_commerce_platform:install --migrate=#{options[:migrate]}"
|
|
@@ -126,7 +126,7 @@ module Solidus
|
|
|
126
126
|
def install_file_attachment
|
|
127
127
|
if options[:active_storage]
|
|
128
128
|
say_status :assets, "Active Storage", :green
|
|
129
|
-
rake "active_storage:install"
|
|
129
|
+
rake "active_storage:install", abort_on_failure: true
|
|
130
130
|
else
|
|
131
131
|
say_status :assets, "Paperclip", :green
|
|
132
132
|
gsub_file "config/initializers/spree.rb", "::ActiveStorageAttachment", "::PaperclipAttachment"
|
|
@@ -158,19 +158,19 @@ module Solidus
|
|
|
158
158
|
|
|
159
159
|
def install_migrations
|
|
160
160
|
say_status :copying, "migrations"
|
|
161
|
-
rake "railties:install:migrations"
|
|
161
|
+
rake "railties:install:migrations", abort_on_failure: true
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
def create_database
|
|
165
165
|
say_status :creating, "database"
|
|
166
|
-
rake "db:create"
|
|
166
|
+
rake "db:create", abort_on_failure: true
|
|
167
167
|
end
|
|
168
168
|
|
|
169
169
|
def run_migrations
|
|
170
170
|
if @run_migrations
|
|
171
171
|
say_status :running, "migrations"
|
|
172
172
|
|
|
173
|
-
rake "db:migrate"
|
|
173
|
+
rake "db:migrate", abort_on_failure: true
|
|
174
174
|
else
|
|
175
175
|
say_status :skipping, "migrations (don't forget to run rake db:migrate)"
|
|
176
176
|
end
|
|
@@ -178,8 +178,8 @@ module Solidus
|
|
|
178
178
|
|
|
179
179
|
def install_subcomponents
|
|
180
180
|
apply_template_for :authentication, @selected_authentication
|
|
181
|
-
apply_template_for :frontend, @selected_frontend
|
|
182
181
|
apply_template_for :payment_method, @selected_payment_method
|
|
182
|
+
apply_template_for :frontend, @selected_frontend
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
def install_solidus_admin
|
|
@@ -200,7 +200,7 @@ module Solidus
|
|
|
200
200
|
rake_options << "ADMIN_EMAIL=#{options[:admin_email]}" if options[:admin_email]
|
|
201
201
|
rake_options << "ADMIN_PASSWORD=#{options[:admin_password]}" if options[:admin_password]
|
|
202
202
|
|
|
203
|
-
rake("db:seed #{rake_options.join(" ")}")
|
|
203
|
+
rake("db:seed #{rake_options.join(" ")}", abort_on_failure: true)
|
|
204
204
|
else
|
|
205
205
|
say_status :skipping, "seed data (you can always run rake db:seed)"
|
|
206
206
|
end
|
|
@@ -209,7 +209,7 @@ module Solidus
|
|
|
209
209
|
def load_sample_data
|
|
210
210
|
if @load_sample_data
|
|
211
211
|
say_status :loading, "sample data"
|
|
212
|
-
rake "spree_sample:load"
|
|
212
|
+
rake "spree_sample:load", abort_on_failure: true
|
|
213
213
|
else
|
|
214
214
|
say_status :skipping, "sample data (you can always run rake spree_sample:load)"
|
|
215
215
|
end
|
|
@@ -70,11 +70,25 @@ module Spree
|
|
|
70
70
|
|
|
71
71
|
# @!attribute [rw] allow_return_item_amount_editing
|
|
72
72
|
# @return [Boolean] Determines whether an admin is allowed to change a return item's pre-calculated amount (default: +false+)
|
|
73
|
+
# @deprecated Unused since a6755a7f0f; remove it from your initializer.
|
|
73
74
|
preference :allow_return_item_amount_editing, :boolean, default: false
|
|
75
|
+
msg = "`Spree::Config.allow_return_item_amount_editing` has had no effect since commit a6755a7f0f; remove it from your initializer."
|
|
76
|
+
deprecate(
|
|
77
|
+
allow_return_item_amount_editing: msg,
|
|
78
|
+
"allow_return_item_amount_editing=": msg,
|
|
79
|
+
deprecator: Spree.deprecator
|
|
80
|
+
)
|
|
74
81
|
|
|
75
82
|
# @!attribute [rw] alternative_billing_phone
|
|
76
83
|
# @return [Boolean] Request an extra phone number for bill address (default: +false+)
|
|
84
|
+
# @deprecated Unused since c40d4cbeef; remove it from your initializer.
|
|
77
85
|
preference :alternative_billing_phone, :boolean, default: false
|
|
86
|
+
msg = "`Spree::Config.alternative_billing_phone` has had no effect since commit c40d4cbeef; remove it from your initializer."
|
|
87
|
+
deprecate(
|
|
88
|
+
alternative_billing_phone: msg,
|
|
89
|
+
"alternative_billing_phone=": msg,
|
|
90
|
+
deprecator: Spree.deprecator
|
|
91
|
+
)
|
|
78
92
|
|
|
79
93
|
# @!attribute [rw] alternative_shipping_phone
|
|
80
94
|
# @return [Boolean] Request an extra phone number for shipping address (default: +false+)
|
|
@@ -94,7 +108,14 @@ module Spree
|
|
|
94
108
|
|
|
95
109
|
# @!attribute [rw] auto_capture_exchanges
|
|
96
110
|
# @return [Boolean] Automatically capture the credit card (as opposed to just authorize and capture later) (default: +false+)
|
|
111
|
+
# @deprecated Unused since ca63667027; remove it from your initializer.
|
|
97
112
|
preference :auto_capture_exchanges, :boolean, default: false
|
|
113
|
+
msg = "`Spree::Config.auto_capture_exchanges` has had no effect since commit ca63667027; remove it from your initializer."
|
|
114
|
+
deprecate(
|
|
115
|
+
auto_capture_exchanges: msg,
|
|
116
|
+
"auto_capture_exchanges=": msg,
|
|
117
|
+
deprecator: Spree.deprecator
|
|
118
|
+
)
|
|
98
119
|
|
|
99
120
|
# @!attribute [rw] automatic_default_address
|
|
100
121
|
# The default value of true preserves existing backwards compatible feature of
|
|
@@ -142,7 +163,14 @@ module Spree
|
|
|
142
163
|
|
|
143
164
|
# @!attribute [rw] customer_returns_per_page
|
|
144
165
|
# @return [Integer] Customer returns to show per-page in the admin (default: +15+)
|
|
166
|
+
# @deprecated Unused since 834a24a695; remove it from your initializer.
|
|
145
167
|
preference :customer_returns_per_page, :integer, default: 15
|
|
168
|
+
msg = "`Spree::Config.customer_returns_per_page` has had no effect since commit 834a24a695; remove it from your initializer."
|
|
169
|
+
deprecate(
|
|
170
|
+
customer_returns_per_page: msg,
|
|
171
|
+
"customer_returns_per_page=": msg,
|
|
172
|
+
deprecator: Spree.deprecator
|
|
173
|
+
)
|
|
146
174
|
|
|
147
175
|
# @!attribute [rw] default_country_iso
|
|
148
176
|
# Default customer country ISO code
|
|
@@ -207,7 +235,14 @@ module Spree
|
|
|
207
235
|
|
|
208
236
|
# @!attribute [rw] order_capturing_time_window
|
|
209
237
|
# @return [Integer] the number of days to look back for fully-shipped/cancelled orders in order to charge for them
|
|
238
|
+
# @deprecated Unused since 9c5107fcae; remove it from your initializer.
|
|
210
239
|
preference :order_capturing_time_window, :integer, default: 14
|
|
240
|
+
msg = "`Spree::Config.order_capturing_time_window` has had no effect since commit 9c5107fcae; remove it from your initializer."
|
|
241
|
+
deprecate(
|
|
242
|
+
order_capturing_time_window: msg,
|
|
243
|
+
"order_capturing_time_window=": msg,
|
|
244
|
+
deprecator: Spree.deprecator
|
|
245
|
+
)
|
|
211
246
|
|
|
212
247
|
# @!attribute [rw] order_mutex_max_age
|
|
213
248
|
# @return [Integer] Max age of {Spree::OrderMutex} in seconds (default: 2 minutes)
|
|
@@ -250,10 +285,18 @@ module Spree
|
|
|
250
285
|
# @return [Boolean] Whether to recalculate cart prices when recalculating (default: +false+)
|
|
251
286
|
versioned_preference :recalculate_cart_prices, :boolean, initial_value: false, boundaries: {"5.0.0.alpha" => true}
|
|
252
287
|
|
|
288
|
+
# @!attribute [rw] refundable_payment_states
|
|
289
|
+
# @return [Array<String>] Payment states in which refunds may be created (default: +["completed", "pending"]+)
|
|
290
|
+
preference :refundable_payment_states, :array, default: %w[completed pending]
|
|
291
|
+
|
|
253
292
|
# @!attribute [rw] require_master_price
|
|
254
293
|
# @return [Boolean] Require a price on the master variant of a product (default: +true+)
|
|
255
294
|
preference :require_master_price, :boolean, default: true
|
|
256
295
|
|
|
296
|
+
# @!attribute [rw] require_refundable_payment_state
|
|
297
|
+
# @return [Boolean] Whether creating a refund for a payment outside Spree::Config.refundable_payment_states is a validation error rather than a deprecation warning (default: +false+)
|
|
298
|
+
versioned_preference :require_refundable_payment_state, :boolean, initial_value: false, boundaries: {"5.0.0.alpha" => true}
|
|
299
|
+
|
|
257
300
|
# @!attribute [rw] require_payment_to_ship
|
|
258
301
|
# @return [Boolean] Allows shipments to be ready to ship regardless of the order being paid if false (default: +true+)
|
|
259
302
|
preference :require_payment_to_ship, :boolean, default: true # Allows shipments to be ready to ship regardless of the order being paid if false
|
|
@@ -354,7 +397,15 @@ module Spree
|
|
|
354
397
|
# Spree::Variant::VatPriceGenerator.
|
|
355
398
|
class_name_attribute :variant_vat_prices_generator_class, default: "Spree::Variant::VatPriceGenerator"
|
|
356
399
|
|
|
400
|
+
# @!attribute [rw] allocator_class
|
|
401
|
+
# @deprecated Never read; use Spree::Config.stock.allocator_class instead.
|
|
357
402
|
class_name_attribute :allocator_class, default: "Spree::Stock::Allocator::OnHandFirst"
|
|
403
|
+
msg = "`Spree::Config.allocator_class` has never been read; the stock allocator is configured with `Spree::Config.stock.allocator_class`."
|
|
404
|
+
deprecate(
|
|
405
|
+
allocator_class: msg,
|
|
406
|
+
"allocator_class=": msg,
|
|
407
|
+
deprecator: Spree.deprecator
|
|
408
|
+
)
|
|
358
409
|
|
|
359
410
|
class_name_attribute :shipping_rate_sorter_class, default: "Spree::Stock::ShippingRateSorter"
|
|
360
411
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "kaminari/activerecord"
|
|
4
|
+
|
|
3
5
|
module Spree
|
|
4
6
|
module Core
|
|
5
7
|
module Search
|
|
@@ -93,7 +95,7 @@ module Spree
|
|
|
93
95
|
@properties[:include_images] = params[:include_images]
|
|
94
96
|
|
|
95
97
|
per_page = params[:per_page].to_i
|
|
96
|
-
@properties[:per_page] = (per_page > 0) ? per_page : Spree::Config
|
|
98
|
+
@properties[:per_page] = (per_page > 0) ? per_page : Spree::Config.products_per_page
|
|
97
99
|
@properties[:page] = (params[:page].to_i <= 0) ? 1 : params[:page].to_i
|
|
98
100
|
end
|
|
99
101
|
end
|
data/lib/spree/core/version.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Spree
|
|
4
|
-
VERSION = "4.
|
|
4
|
+
VERSION = "4.8.0"
|
|
5
5
|
|
|
6
6
|
def self.solidus_version = VERSION
|
|
7
7
|
|
|
8
8
|
def self.minimum_required_rails_version = "7.2"
|
|
9
9
|
|
|
10
|
-
def self.previous_solidus_minor_version = "4.
|
|
10
|
+
def self.previous_solidus_minor_version = "4.7"
|
|
11
11
|
|
|
12
12
|
def self.solidus_gem_version = Gem::Version.new(solidus_version)
|
|
13
13
|
end
|
data/lib/spree/core.rb
CHANGED
|
@@ -125,7 +125,8 @@ module Spree
|
|
|
125
125
|
@@store_attributes = [:name, :url, :seo_title, :meta_keywords,
|
|
126
126
|
:meta_description, :default_currency,
|
|
127
127
|
:mail_from_address, :cart_tax_country_iso,
|
|
128
|
-
:bcc_email, :reverse_charge_status
|
|
128
|
+
:bcc_email, :reverse_charge_status,
|
|
129
|
+
address_attributes:]
|
|
129
130
|
|
|
130
131
|
@@taxonomy_attributes = [:name]
|
|
131
132
|
|
|
@@ -138,7 +139,7 @@ module Spree
|
|
|
138
139
|
# by changing a user with higher priveleges' email to one a lower-priveleged
|
|
139
140
|
# admin owns. Creating a user with an email is handled separate at the
|
|
140
141
|
# controller level.
|
|
141
|
-
@@user_attributes = [:password, :password_confirmation, customer_metadata: {}]
|
|
142
|
+
@@user_attributes = [:password, :password_confirmation, :timezone, customer_metadata: {}]
|
|
142
143
|
|
|
143
144
|
@@variant_attributes = [
|
|
144
145
|
:name, :presentation, :cost_price, :lock_version,
|
|
@@ -118,16 +118,6 @@ module Spree
|
|
|
118
118
|
# find the original.
|
|
119
119
|
find("label:not(.select2-offscreen)", text: /#{Regexp.escape(text)}/i, match: :one)
|
|
120
120
|
end
|
|
121
|
-
|
|
122
|
-
def dialog(parent: "body", **options)
|
|
123
|
-
within(parent) do
|
|
124
|
-
find("dialog", visible: :all, **options)
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def turbo_frame_modal
|
|
129
|
-
dialog(parent: find("turbo-frame", visible: :all))
|
|
130
|
-
end
|
|
131
121
|
end
|
|
132
122
|
end
|
|
133
123
|
end
|
|
@@ -22,4 +22,10 @@ FactoryBot.define do
|
|
|
22
22
|
factory :shipping_no_amount_calculator, class: "Spree::Calculator::Shipping::FlatRate" do
|
|
23
23
|
preferred_amount { 0 }
|
|
24
24
|
end
|
|
25
|
+
|
|
26
|
+
factory :flexi_rate_calculator, class: "Spree::Calculator::Shipping::FlexiRate" do
|
|
27
|
+
preferred_first_item { 10.0 }
|
|
28
|
+
preferred_additional_item { 5.0 }
|
|
29
|
+
preferred_max_items { 100 }
|
|
30
|
+
end
|
|
25
31
|
end
|
|
@@ -18,7 +18,7 @@ module Spree
|
|
|
18
18
|
# A shipping method must exist for rates to be displayed on checkout page
|
|
19
19
|
::FactoryBot.create(:shipping_method, zones: [@zone]).tap do |sm|
|
|
20
20
|
sm.calculator.preferred_amount = 10
|
|
21
|
-
sm.calculator.preferred_currency = Spree::Config
|
|
21
|
+
sm.calculator.preferred_currency = Spree::Config.currency
|
|
22
22
|
sm.calculator.save
|
|
23
23
|
end
|
|
24
24
|
|