Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Removed dead code and compatibility shims Rails 8.1 no longer needs
Claude7a6c03fccb1f
diff --git a/spree/core/app/models/spree/calculator/flat_percent_item_total.rb b/spree/core/app/models/spree/calculator/flat_percent_item_total.rbindex 3c58fe9ee4..f10a54fe10 100644--- a/spree/core/app/models/spree/calculator/flat_percent_item_total.rb+++ b/spree/core/app/models/spree/calculator/flat_percent_item_total.rb@@ -1,5 +1,3 @@-require_dependency 'spree/calculator'-module Spreeclass Calculator::FlatPercentItemTotal < Calculatorpreference :flat_percent, :decimal, default: 0diff --git a/spree/core/app/models/spree/calculator/flat_rate.rb b/spree/core/app/models/spree/calculator/flat_rate.rbindex 53125b39ec..fa80c055be 100644--- a/spree/core/app/models/spree/calculator/flat_rate.rb+++ b/spree/core/app/models/spree/calculator/flat_rate.rb@@ -1,5 +1,3 @@-require_dependency 'spree/calculator'-module Spreeclass Calculator::FlatRate < Calculatorpreference :amount, :decimal, default: 0diff --git a/spree/core/app/models/spree/calculator/flexi_rate.rb b/spree/core/app/models/spree/calculator/flexi_rate.rbindex 4fcd344389..ea46d318b4 100644--- a/spree/core/app/models/spree/calculator/flexi_rate.rb+++ b/spree/core/app/models/spree/calculator/flexi_rate.rb@@ -1,5 +1,3 @@-require_dependency 'spree/calculator'-module Spreeclass Calculator::FlexiRate < Calculatorpreference :first_item, :decimal, default: 0.0diff --git a/spree/core/app/models/spree/calculator/price_sack.rb b/spree/core/app/models/spree/calculator/price_sack.rbindex b9c6f29889..091e762a42 100644--- a/spree/core/app/models/spree/calculator/price_sack.rb+++ b/spree/core/app/models/spree/calculator/price_sack.rb@@ -1,5 +1,3 @@-require_dependency 'spree/calculator'-module Spreeclass Calculator::PriceSack < Calculatorpreference :minimal_amount, :decimal, default: 0diff --git a/spree/core/app/models/spree/calculator/shipping/digital_delivery.rb b/spree/core/app/models/spree/calculator/shipping/digital_delivery.rbindex a4ed6df2b0..6210ecece7 100644--- a/spree/core/app/models/spree/calculator/shipping/digital_delivery.rb+++ b/spree/core/app/models/spree/calculator/shipping/digital_delivery.rb@@ -1,5 +1,3 @@-require_dependency 'spree/shipping_calculator'-module Spreemodule Calculator::Shippingclass DigitalDelivery < ShippingCalculatordiff --git a/spree/core/app/models/spree/calculator/shipping/flat_percent_item_total.rb b/spree/core/app/models/spree/calculator/shipping/flat_percent_item_total.rbindex aef369d19f..08b63138e5 100644--- a/spree/core/app/models/spree/calculator/shipping/flat_percent_item_total.rb+++ b/spree/core/app/models/spree/calculator/shipping/flat_percent_item_total.rb@@ -1,5 +1,3 @@-require_dependency 'spree/shipping_calculator'-module Spreemodule Calculator::Shippingclass FlatPercentItemTotal < ShippingCalculatordiff --git a/spree/core/app/models/spree/calculator/shipping/flat_rate.rb b/spree/core/app/models/spree/calculator/shipping/flat_rate.rbindex 5bc0f57e89..4fc74a4b27 100644--- a/spree/core/app/models/spree/calculator/shipping/flat_rate.rb+++ b/spree/core/app/models/spree/calculator/shipping/flat_rate.rb@@ -1,5 +1,3 @@-require_dependency 'spree/shipping_calculator'-module Spreemodule Calculator::Shippingclass FlatRate < ShippingCalculatordiff --git a/spree/core/app/models/spree/calculator/shipping/flexi_rate.rb b/spree/core/app/models/spree/calculator/shipping/flexi_rate.rbindex e6621c7cdc..1675fea360 100644--- a/spree/core/app/models/spree/calculator/shipping/flexi_rate.rb+++ b/spree/core/app/models/spree/calculator/shipping/flexi_rate.rb@@ -1,5 +1,3 @@-require_dependency 'spree/shipping_calculator'-module Spreemodule Calculator::Shippingclass FlexiRate < ShippingCalculatordiff --git a/spree/core/app/models/spree/calculator/shipping/per_item.rb b/spree/core/app/models/spree/calculator/shipping/per_item.rbindex 5816c63300..b98835d6ef 100644--- a/spree/core/app/models/spree/calculator/shipping/per_item.rb+++ b/spree/core/app/models/spree/calculator/shipping/per_item.rb@@ -1,5 +1,3 @@-require_dependency 'spree/shipping_calculator'-module Spreemodule Calculator::Shippingclass PerItem < ShippingCalculatordiff --git a/spree/core/app/models/spree/calculator/shipping/price_sack.rb b/spree/core/app/models/spree/calculator/shipping/price_sack.rbindex 70aa315c67..6157cb7854 100644--- a/spree/core/app/models/spree/calculator/shipping/price_sack.rb+++ b/spree/core/app/models/spree/calculator/shipping/price_sack.rb@@ -1,5 +1,3 @@-require_dependency 'spree/shipping_calculator'-module Spreemodule Calculator::Shippingclass PriceSack < ShippingCalculatordiff --git a/spree/core/app/models/spree/calculator/tiered_flat_rate.rb b/spree/core/app/models/spree/calculator/tiered_flat_rate.rbindex 761b393a60..8873d4fb35 100644--- a/spree/core/app/models/spree/calculator/tiered_flat_rate.rb+++ b/spree/core/app/models/spree/calculator/tiered_flat_rate.rb@@ -1,5 +1,3 @@-require_dependency 'spree/calculator'-module Spreeclass Calculator::TieredFlatRate < Calculatorpreference :base_amount, :decimal, default: 0diff --git a/spree/core/app/models/spree/calculator/tiered_percent.rb b/spree/core/app/models/spree/calculator/tiered_percent.rbindex d0257766e8..528ee32e66 100644--- a/spree/core/app/models/spree/calculator/tiered_percent.rb+++ b/spree/core/app/models/spree/calculator/tiered_percent.rb@@ -1,5 +1,3 @@-require_dependency 'spree/calculator'-module Spreeclass Calculator::TieredPercent < Calculatorpreference :base_percent, :decimal, default: 0diff --git a/spree/core/app/models/spree/catalog.rb b/spree/core/app/models/spree/catalog.rbindex 092c58c14a..a049d4e2b2 100644--- a/spree/core/app/models/spree/catalog.rb+++ b/spree/core/app/models/spree/catalog.rb@@ -288,14 +288,10 @@ module Spreenew_ids = product_ids.uniq.select { |id| allowed_ids.include?(id) && !taken_ids.include?(id) }return 0 if new_ids.empty?- now = Time.current-rows = new_ids.map do |product_id|{catalog_id: id,- product_id: product_id,- created_at: now,- updated_at: now+ product_id: product_id}enddiff --git a/spree/core/app/models/spree/customer_group.rb b/spree/core/app/models/spree/customer_group.rbindex 0bfbbbd33c..00e58c02a9 100644--- a/spree/core/app/models/spree/customer_group.rb+++ b/spree/core/app/models/spree/customer_group.rb@@ -48,7 +48,6 @@ module Spree# Get existing user IDs to avoid duplicatesexisting_user_ids = customer_group_users.where(customer_id: user_ids).pluck(:customer_id).map(&:to_s).to_set- now = Time.currentuser_type = Spree.customer_class.to_srecords_to_insert = user_ids.filter_map do |user_id|@@ -57,9 +56,7 @@ module Spree{customer_group_id: id,user_id: user_id,- user_type: user_type,- created_at: now,- updated_at: now+ user_type: user_type}enddiff --git a/spree/core/app/models/spree/data_feed/google.rb b/spree/core/app/models/spree/data_feed/google.rbindex 85b596b937..c716151fa5 100644--- a/spree/core/app/models/spree/data_feed/google.rb+++ b/spree/core/app/models/spree/data_feed/google.rb@@ -1,5 +1,3 @@-require_dependency 'spree/data_feed'-module Spreeclass DataFeed::Google < DataFeedclass << selfdiff --git a/spree/core/app/models/spree/digital_link.rb b/spree/core/app/models/spree/digital_link.rbindex adbc4b5c42..ef23b0f8e5 100644--- a/spree/core/app/models/spree/digital_link.rb+++ b/spree/core/app/models/spree/digital_link.rb@@ -4,11 +4,7 @@ module Spreepublishes_lifecycle_events- if Rails::VERSION::STRING >= '7.1.0'- has_secure_token on: :save- else- has_secure_token- end+ has_secure_token on: :saveif defined?(Spree::Security::DigitalLinks)include Spree::Security::DigitalLinksdiff --git a/spree/core/app/models/spree/fulfillment.rb b/spree/core/app/models/spree/fulfillment.rbindex ea36d1a6fb..f3efe76805 100644--- a/spree/core/app/models/spree/fulfillment.rb+++ b/spree/core/app/models/spree/fulfillment.rb@@ -1,5 +1,3 @@-require 'ostruct'-module Spreeclass Fulfillment < Spree.base_classhas_prefix_id :fuldiff --git a/spree/core/app/models/spree/fulfillment_item.rb b/spree/core/app/models/spree/fulfillment_item.rbindex 7163d1b5e6..3d2c0e3c46 100644--- a/spree/core/app/models/spree/fulfillment_item.rb+++ b/spree/core/app/models/spree/fulfillment_item.rb@@ -15,11 +15,7 @@ module Spreebelongs_to :line_item, class_name: 'Spree::LineItem'end- scope :backordered, -> { where status: 'backordered' }- scope :on_hand, -> { where status: 'on_hand' }scope :on_hand_or_backordered, -> { where status: ['backordered', 'on_hand'] }- scope :shipped, -> { where status: 'shipped' }- scope :returned, -> { where status: 'returned' }scope :backordered_per_variant, ->(stock_level) doincludes(:fulfillment, :order).where.not(Spree::Fulfillment.table_name => { status: 'canceled' }).diff --git a/spree/core/app/models/spree/import.rb b/spree/core/app/models/spree/import.rbindex 0631dc6a97..f1abeb0928 100644--- a/spree/core/app/models/spree/import.rb+++ b/spree/core/app/models/spree/import.rb@@ -191,12 +191,6 @@ module SpreeSpree.import_retry_failed_rows_workflow.call(import: self).success?end- # Returns true if the import is in mapping state- # @return [Boolean]- def mapping?- status == 'mapping'- end-# Returns true if the import is processing or completed mapping# @return [Boolean]def processing?diff --git a/spree/core/app/models/spree/import_mapping.rb b/spree/core/app/models/spree/import_mapping.rbindex 324eaffb27..67d6e54342 100644--- a/spree/core/app/models/spree/import_mapping.rb+++ b/spree/core/app/models/spree/import_mapping.rb@@ -5,7 +5,7 @@ module Spree## Associations#- belongs_to :import, class_name: 'Spree::Import', inverse_of: :mappings, required: true+ belongs_to :import, class_name: 'Spree::Import', inverse_of: :mappings## Validations@@ -17,7 +17,6 @@ module Spree## Scopes#- scope :required, -> { where(schema_field: import.required_fields) }scope :mapped, -> { where.not(file_column: [nil, '']) }# Returns true if the mapping is requireddiff --git a/spree/core/app/models/spree/import_row.rb b/spree/core/app/models/spree/import_row.rbindex 8c1d2932c5..6f4b887d64 100644--- a/spree/core/app/models/spree/import_row.rb+++ b/spree/core/app/models/spree/import_row.rb@@ -41,8 +41,6 @@ module Spree# Scopes#scope :pending_and_failed, -> { where(status: %i[pending failed]) }- scope :completed, -> { where(status: :completed) }- scope :failed, -> { where(status: :failed) }scope :processed, -> { where(status: %i[completed failed]) }# Rows still legitimately blocking import completion: `pending` (not started) or# `processing` with a recent updated_at (worker still alive). Orphaned `processing`diff --git a/spree/core/app/models/spree/invitation.rb b/spree/core/app/models/spree/invitation.rbindex 37378cc2c7..1c83f483e5 100644--- a/spree/core/app/models/spree/invitation.rb+++ b/spree/core/app/models/spree/invitation.rb@@ -32,8 +32,6 @@ module Spree## Scopes#- scope :pending, -> { where(status: 'pending') }- scope :accepted, -> { where(status: 'accepted') }scope :not_expired, -> { where('expires_at > ?', Time.current) }#diff --git a/spree/core/app/models/spree/payment.rb b/spree/core/app/models/spree/payment.rbindex 5422ae884a..9dcafb8646 100644--- a/spree/core/app/models/spree/payment.rb+++ b/spree/core/app/models/spree/payment.rb@@ -1,5 +1,3 @@-require_dependency 'spree/payment/processing'-module Spreeclass Payment < Spree.base_classhas_prefix_id :py # Stripe: py_diff --git a/spree/core/app/models/spree/payment/processing.rb b/spree/core/app/models/spree/payment/processing.rbindex b80e28f4e6..3ea69d9753 100644--- a/spree/core/app/models/spree/payment/processing.rb+++ b/spree/core/app/models/spree/payment/processing.rb@@ -1,5 +1,3 @@-require_dependency 'spree/payment/gateway_options'-module Spreeclass Payment < Spree.base_class# Gateway mechanics shared by the payments workflows and the paymentdiff --git a/spree/core/app/models/spree/preference.rb b/spree/core/app/models/spree/preference.rbindex 5d32482608..9bf1042ec8 100644--- a/spree/core/app/models/spree/preference.rb+++ b/spree/core/app/models/spree/preference.rb@@ -1,9 +1,5 @@class Spree::Preference < Spree.base_class- if Rails::VERSION::STRING >= '7.1.0'- serialize :value, coder: YAML- else- serialize :value- end+ serialize :value, coder: YAMLvalidates :key, presence: true,uniqueness: { case_sensitive: false, allow_blank: true, scope: spree_base_uniqueness_scope }diff --git a/spree/core/app/models/spree/price_list.rb b/spree/core/app/models/spree/price_list.rbindex 33ca67240f..a80487af38 100644--- a/spree/core/app/models/spree/price_list.rb+++ b/spree/core/app/models/spree/price_list.rb@@ -314,8 +314,6 @@ module Spree.pluck(:variant_id, :currency).to_set- now = Time.current-prices_to_insert = variant_ids.flat_map do |variant_id|currencies.filter_map do |currency|next if existing.include?([variant_id, currency])@@ -325,9 +323,7 @@ module Spreecurrency: currency,amount: nil,min_quantity: 1,- price_list_id: id,- created_at: now,- updated_at: now+ price_list_id: id}endenddiff --git a/spree/core/app/models/spree/promotion.rb b/spree/core/app/models/spree/promotion.rbindex 03759a44f1..2fa8b66202 100644--- a/spree/core/app/models/spree/promotion.rb+++ b/spree/core/app/models/spree/promotion.rb@@ -262,7 +262,7 @@ module Spreeenddef products- rules.where(type: %w[Spree::Promotion::Rules::Product Spree::Promotion::Rules::Product]).map(&:products).flatten.uniq+ rules.where(type: 'Spree::Promotion::Rules::Product').map(&:products).flatten.uniqenddef usage_limit_exceeded?(promotable)diff --git a/spree/core/app/models/spree/promotion/rules/category.rb b/spree/core/app/models/spree/promotion/rules/category.rbindex c88b86dabb..3763bdc907 100644--- a/spree/core/app/models/spree/promotion/rules/category.rb+++ b/spree/core/app/models/spree/promotion/rules/category.rb@@ -47,10 +47,6 @@ module Spree#after_save :add_categories- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible_category_ids@eligible_category_ids ||= promotion_rule_categories.pluck(:category_id)enddiff --git a/spree/core/app/models/spree/promotion/rules/channel.rb b/spree/core/app/models/spree/promotion/rules/channel.rbindex a91b88c351..0eafa94b14 100644--- a/spree/core/app/models/spree/promotion/rules/channel.rb+++ b/spree/core/app/models/spree/promotion/rules/channel.rb@@ -14,10 +14,6 @@ module Spreescope: ->(rule) { rule.promotion.store.channels })- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def channelsreturn Spree::Channel.none if preferred_channel_ids.blank?diff --git a/spree/core/app/models/spree/promotion/rules/country.rb b/spree/core/app/models/spree/promotion/rules/country.rbindex b784d0b5d0..ec12dc4090 100644--- a/spree/core/app/models/spree/promotion/rules/country.rb+++ b/spree/core/app/models/spree/promotion/rules/country.rb@@ -15,10 +15,6 @@ module Spreepreference :country_id, :integer # legacy single-country shortcutpreference :country_code, :string # legacy ISO-based shortcut- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def countriesisos = configured_country_codes.presence || [configured_country_code].compact_blankisos = [legacy_country_code(preferred_country_id)].compact_blank if isos.blank? && preferred_country_id.present?diff --git a/spree/core/app/models/spree/promotion/rules/currency.rb b/spree/core/app/models/spree/promotion/rules/currency.rbindex 435e892e02..1641e4f94d 100644--- a/spree/core/app/models/spree/promotion/rules/currency.rb+++ b/spree/core/app/models/spree/promotion/rules/currency.rb@@ -5,10 +5,6 @@ module Spreeclass Currency < Spree::PromotionRulepreference :currency, :string- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible?(order, options = {})return true if order.currency == preferred_currencydiff --git a/spree/core/app/models/spree/promotion/rules/customer_group.rb b/spree/core/app/models/spree/promotion/rules/customer_group.rbindex d2b945a2b6..5bb768facd 100644--- a/spree/core/app/models/spree/promotion/rules/customer_group.rb+++ b/spree/core/app/models/spree/promotion/rules/customer_group.rb@@ -15,10 +15,6 @@ module Spreescope: ->(rule) { rule.promotion.store.customer_groups })- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def customer_groupsreturn Spree::CustomerGroup.none if preferred_customer_group_ids.blank?diff --git a/spree/core/app/models/spree/promotion/rules/first_order.rb b/spree/core/app/models/spree/promotion/rules/first_order.rbindex 74ba02d45d..2efc88b919 100644--- a/spree/core/app/models/spree/promotion/rules/first_order.rb+++ b/spree/core/app/models/spree/promotion/rules/first_order.rb@@ -4,10 +4,6 @@ module Spreeclass FirstOrder < Spree::PromotionRuleattr_reader :user, :email, :store- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible?(order, options = {})@user = order.try(:customer) || options[:user]@email = if options[:email].present?diff --git a/spree/core/app/models/spree/promotion/rules/item_total.rb b/spree/core/app/models/spree/promotion/rules/item_total.rbindex a7415533ad..222daca2e9 100644--- a/spree/core/app/models/spree/promotion/rules/item_total.rb+++ b/spree/core/app/models/spree/promotion/rules/item_total.rb@@ -12,10 +12,6 @@ module SpreeOPERATORS_MIN = ['gt', 'gte']OPERATORS_MAX = ['lt', 'lte']- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible?(order, options = {})item_total = order.item_total - order.gift_amount(promotion: promotion, own_gift_only: options.fetch(:own_gift_only, false))diff --git a/spree/core/app/models/spree/promotion/rules/market.rb b/spree/core/app/models/spree/promotion/rules/market.rbindex b8e55ec4ac..e745ee5d80 100644--- a/spree/core/app/models/spree/promotion/rules/market.rb+++ b/spree/core/app/models/spree/promotion/rules/market.rb@@ -14,10 +14,6 @@ module Spreescope: ->(rule) { rule.promotion.store.markets })- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def marketsreturn Spree::Market.none if preferred_market_ids.blank?diff --git a/spree/core/app/models/spree/promotion/rules/one_use_per_user.rb b/spree/core/app/models/spree/promotion/rules/one_use_per_user.rbindex bbc48d07ba..22401650a8 100644--- a/spree/core/app/models/spree/promotion/rules/one_use_per_user.rb+++ b/spree/core/app/models/spree/promotion/rules/one_use_per_user.rb@@ -2,10 +2,6 @@ module Spreeclass Promotionmodule Rulesclass OneUsePerUser < Spree::PromotionRule- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible?(order, _options = {})if order.customer.present?if promotion.used_by?(order.customer, [order])diff --git a/spree/core/app/models/spree/promotion/rules/option_value.rb b/spree/core/app/models/spree/promotion/rules/option_value.rbindex 896c261470..060240e9e0 100644--- a/spree/core/app/models/spree/promotion/rules/option_value.rb+++ b/spree/core/app/models/spree/promotion/rules/option_value.rb@@ -13,9 +13,6 @@ module Spree# @param promotable [Object]# @return [Boolean]- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end# @return [ActiveRecord::Relation<Spree::OptionValue>]def option_valuesdiff --git a/spree/core/app/models/spree/promotion/rules/product.rb b/spree/core/app/models/spree/promotion/rules/product.rbindex 0aef705fbe..ff05967e18 100644--- a/spree/core/app/models/spree/promotion/rules/product.rb+++ b/spree/core/app/models/spree/promotion/rules/product.rb@@ -49,10 +49,6 @@ module Spree@eligible_product_ids ||= product_promotion_rules.pluck(:product_id)end- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible?(order, _options = {})return true if eligible_product_ids.empty?diff --git a/spree/core/app/models/spree/promotion/rules/user.rb b/spree/core/app/models/spree/promotion/rules/user.rbindex 81ff434768..180b44a251 100644--- a/spree/core/app/models/spree/promotion/rules/user.rb+++ b/spree/core/app/models/spree/promotion/rules/user.rb@@ -33,10 +33,6 @@ module Spree#after_save :add_users- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible_user_ids@eligible_user_ids ||= promotion_rule_users.pluck(:customer_id)enddiff --git a/spree/core/app/models/spree/promotion/rules/user_logged_in.rb b/spree/core/app/models/spree/promotion/rules/user_logged_in.rbindex 4259da0991..08e1a15786 100644--- a/spree/core/app/models/spree/promotion/rules/user_logged_in.rb+++ b/spree/core/app/models/spree/promotion/rules/user_logged_in.rb@@ -8,10 +8,6 @@ module Spree'customer_logged_in'end- def applicable?(promotable)- promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)- end-def eligible?(order, _options = {})unless order.customer.present?eligibility_errors.add(:base, eligibility_error_message(:no_user_specified))diff --git a/spree/core/app/models/spree/promotion_action.rb b/spree/core/app/models/spree/promotion_action.rbindex 6708cf20bb..cebfa020ea 100644--- a/spree/core/app/models/spree/promotion_action.rb+++ b/spree/core/app/models/spree/promotion_action.rb@@ -66,9 +66,9 @@ module Spreewhen :line_item%w[Spree::Promotion::Actions::CreateItemAdjustments Spree::Promotion::Actions::CreateLineItems]when :fulfillment- %w[Spree::Promotion::Actions::FreeShipping Spree::Promotion::Actions::FreeShipping]+ %w[Spree::Promotion::Actions::FreeShipping]when :order- %w[Spree::Promotion::Actions::CreateAdjustment Spree::Promotion::Actions::CreateAdjustment]+ %w[Spree::Promotion::Actions::CreateAdjustment]else[]enddiff --git a/spree/core/app/models/spree/promotion_rule.rb b/spree/core/app/models/spree/promotion_rule.rbindex 7b3c5a01c2..4ae3df3454 100644--- a/spree/core/app/models/spree/promotion_rule.rb+++ b/spree/core/app/models/spree/promotion_rule.rb@@ -17,8 +17,8 @@ module Spreeall.select { |rule| rule.applicable?(promotable) }end- def applicable?(_promotable)- raise 'applicable? should be implemented in a sub-class of Spree::PromotionRule'+ def applicable?(promotable)+ promotable.is_a?(Spree::Order) || promotable.is_a?(Spree::Cart)enddef eligible?(_promotable, _options = {})diff --git a/spree/core/app/models/spree/wishlist.rb b/spree/core/app/models/spree/wishlist.rbindex 8fc794bdbd..ccd9c3bdb5 100644--- a/spree/core/app/models/spree/wishlist.rb+++ b/spree/core/app/models/spree/wishlist.rb@@ -6,11 +6,7 @@ module Spreepublishes_lifecycle_events- if Rails::VERSION::STRING >= '7.1.0'- has_secure_token on: :save- else- has_secure_token- end+ has_secure_token on: :savebelongs_to :customer, class_name: "::#{Spree.customer_class}", touch: trueinclude Spree::DeprecatedCustomerAliasdiff --git a/spree/core/app/services/spree/categories/add_products.rb b/spree/core/app/services/spree/categories/add_products.rbindex 941801e131..ed3c5648e1 100644--- a/spree/core/app/services/spree/categories/add_products.rb+++ b/spree/core/app/services/spree/categories/add_products.rb@@ -19,9 +19,7 @@ module Spree{category_id: category_id,product_id: product_id,- position: (position += 1),- created_at: Time.current,- updated_at: Time.current+ position: (position += 1)}endenddiff --git a/spree/core/app/services/spree/collections/add_products.rb b/spree/core/app/services/spree/collections/add_products.rbindex ff68d0be30..877b563628 100644--- a/spree/core/app/services/spree/collections/add_products.rb+++ b/spree/core/app/services/spree/collections/add_products.rb@@ -18,9 +18,7 @@ module Spree{collection_id: collection_id,product_id: product_id,- position: (position += 1),- created_at: Time.current,- updated_at: Time.current+ position: (position += 1)}endenddiff --git a/spree/core/app/services/spree/collections/regenerate_products.rb b/spree/core/app/services/spree/collections/regenerate_products.rbindex 4bb4bd8876..298cadafb3 100644--- a/spree/core/app/services/spree/collections/regenerate_products.rb+++ b/spree/core/app/services/spree/collections/regenerate_products.rb@@ -57,9 +57,7 @@ module Spree{product_id: product_id,collection_id: collection.id,- position: position,- created_at: Time.current,- updated_at: Time.current+ position: position}endenddiff --git a/spree/core/app/services/spree/coupon_codes/bulk_generate.rb b/spree/core/app/services/spree/coupon_codes/bulk_generate.rbindex 5f61ce4cf2..8a7b6b1aa6 100644--- a/spree/core/app/services/spree/coupon_codes/bulk_generate.rb+++ b/spree/core/app/services/spree/coupon_codes/bulk_generate.rb@@ -4,13 +4,10 @@ module Spreeprepend Spree::ServiceModule::Basedef call(promotion:, quantity: 10)- coupon_codes = []-Spree::CouponCode.transaction do- quantity.times do- coupon_codes << coupon_attributes(promotion).merge(code: create_code(promotion.code_prefix))- end- Spree::CouponCode.insert_all coupon_codes+ Spree::CouponCode.insert_all(+ Array.new(quantity) { { promotion_id: promotion.id, code: create_code(promotion.code_prefix) } }+ )endsuccess(promotion.reload.coupon_codes)@@ -24,14 +21,6 @@ module Spreebreak code unless Spree::CouponCode.exists?(code: code)endend-- def coupon_attributes(promotion)- {- promotion_id: promotion.id,- created_at: Time.current,- updated_at: Time.current- }- endendendenddiff --git a/spree/core/app/services/spree/products/auto_match_collections.rb b/spree/core/app/services/spree/products/auto_match_collections.rbindex dd289dfdc9..c11fa6f075 100644--- a/spree/core/app/services/spree/products/auto_match_collections.rb+++ b/spree/core/app/services/spree/products/auto_match_collections.rb@@ -65,9 +65,7 @@ module Spree{collection_id: collection.id,product_id: product.id,- position: position,- created_at: Time.current,- updated_at: Time.current+ position: position}endenddiff --git a/spree/core/app/services/spree/stores/provision_defaults.rb b/spree/core/app/services/spree/stores/provision_defaults.rbindex 92f4788e18..048382591a 100644--- a/spree/core/app/services/spree/stores/provision_defaults.rb+++ b/spree/core/app/services/spree/stores/provision_defaults.rb@@ -167,15 +167,12 @@ module Spreemissing = isos - existing.reload.pluck(:country_code)return if missing.empty?- now = Time.currentSpree::DeliveryZoneMember.insert_all(missing.map do |iso|{delivery_zone_id: zone.id,member_type: 'country',- country_code: iso,- created_at: now,- updated_at: now+ country_code: iso}end)diff --git a/spree/core/lib/spree/core.rb b/spree/core/lib/spree/core.rbindex 2d7adcb036..445b3d4e40 100644--- a/spree/core/lib/spree/core.rb+++ b/spree/core/lib/spree/core.rb@@ -1,4 +1,3 @@-require 'ostruct'require 'action_controller/railtie'require 'action_view/railtie'require 'active_job/railtie'@@ -120,7 +119,7 @@ module Spreeenddef self.queues- @@queues ||= OpenStruct.new(+ @@queues ||= ActiveSupport::OrderedOptions.new.update(default: :default,events: :default,exports: :default,@@ -152,7 +151,7 @@ module Spree# @deprecated Renamed with the stock level rename in 6.0; removed in 6.1.#- # The writer matters as much as the reader here: this is an OpenStruct, so+ # The writer matters as much as the reader here: these are ordered options, so# an existing initializer assigning the old name would quietly define a# field nobody reads and its jobs would fall back to the default queue.queues.define_singleton_method(:stock_location_stock_items) dodiff --git a/spree/core/lib/spree/core/engine.rb b/spree/core/lib/spree/core/engine.rbindex 2d020ae3e1..c418cc5383 100644--- a/spree/core/lib/spree/core/engine.rb+++ b/spree/core/lib/spree/core/engine.rb@@ -37,12 +37,6 @@ module Spree:taxon_rules,:collection_rules,:time_based_collection_rules,- :themes,- :theme_layout_sections,- :pages,- :page_sections,- :page_blocks,- :reports,:translatable_resources,:taggable_types,:actor_classes,@@ -58,16 +52,10 @@ module SpreePromoEnvironment = Struct.new(:rules, :actions)PricingEnvironment = Struct.new(:rules)OrderRoutingEnvironment = Struct.new(:strategies, :rules)- # Spree::Validators, not a Struct: the sets carry register/unregister so- # a host can drop a core rule (see Spree.validators.addresses).- SpreeValidators = Spree::ValidatorsCustomFieldsEnvironment = Struct.new(:types, :enabled_resources)isolate_namespace Spreeengine_name 'spree'- # Add app/subscribers to autoload paths- config.paths.add 'app/subscribers', eager_load: true-# Register bundled ActionMailer previews so they show up at /rails/mailers# without the host app having to copy any files.initializer 'spree.mailer_previews' do |app|@@ -77,14 +65,30 @@ module Spreeendinitializer 'spree.environment', before: :load_config_initializers do |app|- app.config.spree = Environment.new(SpreeCalculators.new, SpreeValidators.new, Spree::Core::Configuration.new, Spree::Core::Dependencies.new)+ # Spree::Validators, not a Struct: the sets carry register/unregister so+ # a host can drop a core rule (see Spree.validators.addresses).+ app.config.spree = Environment.new(SpreeCalculators.new, Spree::Validators.new, Spree::Core::Configuration.new, Spree::Core::Dependencies.new)++ # Registries are seeded before application initializers so extensions+ # and host apps can append their own entries from initializer files.+ # Core's defaults are concatenated in after_initialize below.+ %i[subscribers actor_classes commission_rules delivery_method_rules seller_requirements+ delivery_rate_providers tax_providers pricing_providers inventory_providers+ payout_providers digital_asset_providers delivery_profile_types].each do |registry|+ app.config.spree[registry] = []+ end+ app.config.spree.line_item_comparison_hooks = Set.new+ app.config.spree.order_routing = OrderRoutingEnvironment.new([], [])+ app.config.spree.custom_fields = CustomFieldsEnvironment.new([], [])+ app.config.spree.promotions = PromoEnvironment.new([])+ app.config.spree.pricing = PricingEnvironment.new([])app.config.active_record.yaml_column_permitted_classes ||= []app.config.active_record.yaml_column_permitted_classes.concat([Symbol, BigDecimal, ActiveSupport::HashWithIndifferentAccess, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone, Time])Spree::Config = app.config.spree.preferences- Spree::RuntimeConfig = app.config.spree.preferences # for compatibilitySpree::Dependencies = app.config.spree.dependenciesSpree::Deprecation = ActiveSupport::Deprecation.new('6.0', 'Spree')+ app.deprecators[:spree] = Spree::Deprecationend# Runs after initializers so an explicitly assigned preference — which@@ -105,34 +109,12 @@ module Spreeapp.middleware.use ::I18n::Middlewareend- initializer 'spree.register.subscribers', before: :load_config_initializers do |app|- # Initialize subscribers array early so engines can add subscribers via initializers- app.config.spree.subscribers = []- end-- # Seeded before application initializers so an extension registering an- # actor class has something to append to. The defaults are unioned in- # after initialization, where Spree.admin_user_class is finally known.- initializer 'spree.register.actor_classes', before: :load_config_initializers do |app|- app.config.spree.actor_classes = []- end-- initializer 'spree.register.calculators', before: :after_initialize do |app|- end-# Seeded before application initializers so a host's# `config/initializers/spree.rb` can register custom generators.initializer 'spree.register.number_generators', before: :load_config_initializers do |app|app.config.spree.number_generators = Spree::NumberGenerators::Registry.newend- initializer 'spree.register.stock_splitters', before: :load_config_initializers do |app|- end-- initializer 'spree.register.line_item_comparison_hooks', before: :load_config_initializers do |app|- app.config.spree.line_item_comparison_hooks = Set.new- end-# The one eligibility rule core ships: a per-market return window,# bypassed by staff. Registered before application initializers so a# store can unregister it in its own initializer.@@ -141,78 +123,6 @@ module SpreeSpree.hooks.register('exchanges.create.validate', 'Spree::Returns::EligibilityValidator')end- initializer 'spree.register.payment_methods', after: 'acts_as_list.insert_into_active_record' do |app|- end-- initializer 'spree.register.adjustable_adjusters' do |app|- end-- # Seed the order routing registries early so engines and apps can append- # their own strategies / rule kinds from initializer files. Core's defaults- # are concatenated in after_initialize below.- initializer 'spree.register.order_routing', before: :load_config_initializers do |app|- app.config.spree.order_routing = OrderRoutingEnvironment.new- app.config.spree.order_routing.strategies = []- app.config.spree.order_routing.rules = []- end-- # Seeded early for the same reason as order routing: initializer files- # append custom rule kinds. Core defaults concatenate in after_initialize.- initializer 'spree.register.commission_rules', before: :load_config_initializers do |app|- app.config.spree.commission_rules = []- end-- initializer 'spree.register.delivery_method_rules', before: :load_config_initializers do |app|- app.config.spree.delivery_method_rules = []- end-- # Seeded early like the other kind registries: an initializer file adds- # a marketplace's own requirement kinds, core's concatenate after.- initializer 'spree.register.seller_requirements', before: :load_config_initializers do |app|- app.config.spree.seller_requirements = []- end-- initializer 'spree.register.delivery_rate_providers', before: :load_config_initializers do |app|- app.config.spree.delivery_rate_providers = []- end-- # Same reason again: a tax provider gem, or a host app, registers its- # engine from an initializer file. Core's Internal concatenates below.- initializer 'spree.register.tax_providers', before: :load_config_initializers do |app|- app.config.spree.tax_providers = []- end-- # Same reason as the tax providers above: a connector gem registers its- # engine from an initializer file, and core's Internal concatenates below.- initializer 'spree.register.pricing_providers', before: :load_config_initializers do |app|- app.config.spree.pricing_providers = []- end-- initializer 'spree.register.inventory_providers', before: :load_config_initializers do |app|- app.config.spree.inventory_providers = []- end-- # How sellers get paid. A provider gem — the Stripe Connect one, or a- # marketplace's own — registers from an initializer file; core's- # record-only System concatenates below.- initializer 'spree.register.payout_providers', before: :load_config_initializers do |app|- app.config.spree.payout_providers = []- end-- initializer 'spree.register.digital_asset_providers', before: :load_config_initializers do |app|- app.config.spree.digital_asset_providers = []- end-- initializer 'spree.register.delivery_profile_types', before: :load_config_initializers do |app|- app.config.spree.delivery_profile_types = []- end-- initializer 'spree.register.custom_fields' do |app|- app.config.spree.custom_fields = CustomFieldsEnvironment.new- app.config.spree.custom_fields.types = []- app.config.spree.custom_fields.enabled_resources = []- end-# Seed the reporting vocabulary before app initializers so applications# and extensions can register their own metrics/dimensions in# config/initializers (see docs/plans/6.0-analytics-semantic-layer.md).@@ -221,22 +131,6 @@ module SpreeSpree::Reporting::DefaultVocabulary.install(app.config.spree.reporting)end- # We need to define promotions rules here so extensions and existing apps- # can add their custom classes on their initializer files- initializer 'spree.promo.environment' do |app|- app.config.spree.promotions = PromoEnvironment.new- app.config.spree.promotions.rules = []- end-- initializer 'spree.promo.register.promotion.calculators' do |app|- end-- # Pricing configuration for price lists and price rules- initializer 'spree.pricing.environment', after: 'spree.environment' do |app|- app.config.spree.pricing = PricingEnvironment.new- app.config.spree.pricing.rules = []- end-# Country and subdivision names are translated by the countries gem, which# only loads the locales it is told about. This runs after initialization# because Spree.available_locales reads i18n configuration that is not@@ -291,7 +185,6 @@ module SpreeSpree::Collection]-# The fallback engine when a market names none (see docs/plans/6.0-tax-provider.md).# Assigned only if an initializer file has not already named one — an app# that picks its own default must keep it.@@ -353,7 +246,6 @@ module Spree'deutsche_post' => { name: 'Deutsche Post DHL', url: 'https://www.dhl.de/de/privatkunden/pakete-empfangen/verfolgen.html?piececode=:tracking' }}-# Quoting strategies selectable on a delivery method. Internal prices# through the method's calculator; carrier gems append theirs.Rails.application.config.spree.delivery_rate_providers.concat [@@ -640,9 +532,6 @@ module Spree)end- initializer 'spree.promo.register.promotions.actions' do |app|- end-# filter sensitive information during logginginitializer 'spree.params.filter' do |app|app.config.filter_parameters += [diff --git a/spree/core/spec/models/spree/calculator/shipping.rb b/spree/core/spec/models/spree/calculator/shipping.rbindex 71c3c0f756..b497597301 100644--- a/spree/core/spec/models/spree/calculator/shipping.rb+++ b/spree/core/spec/models/spree/calculator/shipping.rb@@ -1,5 +1,3 @@-require_dependency 'spree/calculator'-module Spreeclass Calculator::Shipping < Calculatordef compute(content_items); enddiff --git a/spree/core/spree_core.gemspec b/spree/core/spree_core.gemspecindex dac32aa814..284ade67ae 100644--- a/spree/core/spree_core.gemspec+++ b/spree/core/spree_core.gemspec@@ -57,7 +57,6 @@ Gem::Specification.new do |s|s.add_dependency 'name_of_person', '~> 1.1's.add_dependency 'nokogiri', '~> 1.18's.add_dependency 'oj', '~> 3.16'- s.add_dependency 'ostruct's.add_dependency 'paranoia', '>= 2.4's.add_dependency 'loofah', '~> 2.21's.add_dependency 'rails-html-sanitizer', '~> 1.6'diff --git a/spree/emails/lib/spree/emails/engine.rb b/spree/emails/lib/spree/emails/engine.rbindex 23d616b8a3..db9693bfc7 100644--- a/spree/emails/lib/spree/emails/engine.rb+++ b/spree/emails/lib/spree/emails/engine.rb@@ -6,9 +6,6 @@ module Spreeisolate_namespace Spreeengine_name 'spree_emails'- # Add app/subscribers to autoload paths- config.paths.add 'app/subscribers', eager_load: true-# Register bundled ActionMailer previews so they show up at /rails/mailers# without the host app having to copy any files.initializer 'spree_emails.mailer_previews' do |app|diff --git a/spree/providers/meilisearch/lib/spree_meilisearch/engine.rb b/spree/providers/meilisearch/lib/spree_meilisearch/engine.rbindex 533a8adf2c..687bc2b704 100644--- a/spree/providers/meilisearch/lib/spree_meilisearch/engine.rb+++ b/spree/providers/meilisearch/lib/spree_meilisearch/engine.rb@@ -4,14 +4,6 @@ module SpreeMeilisearchclass Engine < Rails::Engineengine_name 'spree_meilisearch'- # Gem name and module disagree on word boundaries (spree_meilisearch →- # SpreeMeilisearch), so Zeitwerk needs telling once.- initializer 'spree_meilisearch.inflections', before: :set_autoload_paths do- Rails.autoloaders.each do |autoloader|- autoloader.inflector.inflect('spree_meilisearch' => 'SpreeMeilisearch')- end- end-config.after_initialize do# The document shape is Meilisearch's own — one document per locale and# currency, plus per-grouping membership documents carrying the position adiff --git a/spree/providers/stripe/lib/spree_stripe/engine.rb b/spree/providers/stripe/lib/spree_stripe/engine.rbindex 012614d4eb..7fb055ddde 100644--- a/spree/providers/stripe/lib/spree_stripe/engine.rb+++ b/spree/providers/stripe/lib/spree_stripe/engine.rb@@ -5,12 +5,6 @@ module SpreeStripeisolate_namespace Spreeengine_name 'spree_stripe'- config.paths.add 'app/subscribers', eager_load: true-- config.generators do |g|- g.test_framework :rspec- end-# Core assigns the payment method registry in its own after_initialize, so# appending has to happen in a later one — engine callbacks run in load order.config.after_initialize do