spree_core 4.8.2 → 4.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/finders/spree/line_items/find_by_variant.rb +4 -2
  3. data/app/finders/spree/products/find.rb +1 -1
  4. data/app/finders/spree/variants/find.rb +30 -0
  5. data/app/models/spree/address.rb +12 -2
  6. data/app/models/spree/adjustment.rb +5 -0
  7. data/app/models/spree/asset.rb +8 -0
  8. data/app/models/spree/calculator/flat_rate.rb +3 -0
  9. data/app/models/spree/calculator/flexi_rate.rb +3 -0
  10. data/app/models/spree/calculator/percent_on_line_item.rb +3 -0
  11. data/app/models/spree/calculator/shipping/flat_rate.rb +13 -1
  12. data/app/models/spree/cms_section_image.rb +0 -6
  13. data/app/models/spree/customer_return.rb +1 -0
  14. data/app/models/spree/icon.rb +0 -6
  15. data/app/models/spree/image/configuration/active_storage.rb +0 -8
  16. data/app/models/spree/image.rb +17 -0
  17. data/app/models/spree/line_item.rb +23 -6
  18. data/app/models/spree/option_value_variant.rb +4 -0
  19. data/app/models/spree/order/currency_updater.rb +2 -2
  20. data/app/models/spree/order/webhooks.rb +19 -0
  21. data/app/models/spree/order.rb +17 -6
  22. data/app/models/spree/order_merger.rb +6 -0
  23. data/app/models/spree/payment/gateway_options.rb +4 -0
  24. data/app/models/spree/payment/webhooks.rb +15 -0
  25. data/app/models/spree/payment.rb +7 -7
  26. data/app/models/spree/price.rb +45 -0
  27. data/app/models/spree/product/webhooks.rb +17 -0
  28. data/app/models/spree/product.rb +7 -9
  29. data/app/models/spree/promotion/actions/free_shipping.rb +13 -0
  30. data/app/models/spree/promotion/rules/first_order.rb +6 -1
  31. data/app/models/spree/promotion.rb +2 -2
  32. data/app/models/spree/promotion_handler/coupon.rb +3 -2
  33. data/app/models/spree/refund.rb +14 -2
  34. data/app/models/spree/reimbursement/emails.rb +11 -0
  35. data/app/models/spree/reimbursement.rb +1 -6
  36. data/app/models/spree/role_user.rb +1 -1
  37. data/app/models/spree/shipment/emails.rb +11 -0
  38. data/app/models/spree/shipment/webhooks.rb +11 -0
  39. data/app/models/spree/shipment.rb +58 -7
  40. data/app/models/spree/shipment_handler.rb +2 -6
  41. data/app/models/spree/shipping_method.rb +6 -0
  42. data/app/models/spree/shipping_method_zone.rb +4 -2
  43. data/app/models/spree/shipping_rate.rb +1 -1
  44. data/app/models/spree/stock/package.rb +4 -0
  45. data/app/models/spree/stock/quantifier.rb +22 -4
  46. data/app/models/spree/stock_item/webhooks.rb +6 -0
  47. data/app/models/spree/stock_item.rb +1 -3
  48. data/app/models/spree/stock_location.rb +15 -0
  49. data/app/models/spree/stock_movement/webhooks.rb +6 -0
  50. data/app/models/spree/stock_movement.rb +1 -3
  51. data/app/models/spree/store.rb +1 -5
  52. data/app/models/spree/store_credit.rb +11 -12
  53. data/app/models/spree/store_favicon_image.rb +0 -6
  54. data/app/models/spree/store_logo.rb +0 -5
  55. data/app/models/spree/store_mailer_logo.rb +0 -6
  56. data/app/models/spree/tax_rate.rb +3 -1
  57. data/app/models/spree/taxon_image/configuration/active_storage.rb +0 -6
  58. data/app/models/spree/variant/webhooks.rb +6 -0
  59. data/app/models/spree/variant.rb +21 -3
  60. data/app/models/spree/wishlist.rb +9 -0
  61. data/app/presenters/spree/variants/options_presenter.rb +34 -2
  62. data/app/services/spree/cart/add_item.rb +2 -0
  63. data/app/services/spree/cart/destroy.rb +14 -4
  64. data/app/services/spree/seeds/all.rb +3 -0
  65. data/app/services/spree/seeds/payment_methods.rb +18 -0
  66. data/app/services/spree/seeds/stock_locations.rb +1 -1
  67. data/app/services/spree/seeds/zones.rb +19 -19
  68. data/config/locales/en.yml +2 -0
  69. data/db/migrate/20240623172111_add_deleted_at_to_spree_stock_locations.rb +6 -0
  70. data/db/migrate/20240725124530_add_refunder_to_spree_refunds.rb +6 -0
  71. data/lib/spree/core/controller_helpers/locale.rb +1 -0
  72. data/lib/spree/core/controller_helpers/order.rb +5 -5
  73. data/lib/spree/core/dependencies.rb +2 -1
  74. data/lib/spree/core/preferences/preferable.rb +4 -2
  75. data/lib/spree/core/preferences/preferable_class_methods.rb +3 -2
  76. data/lib/spree/core/version.rb +1 -1
  77. data/lib/spree/core/webhooks.rb +15 -7
  78. data/lib/spree/core.rb +1 -0
  79. data/lib/spree/money.rb +1 -1
  80. data/lib/spree/testing_support/authorization_helpers.rb +2 -2
  81. data/lib/spree/testing_support/common_rake.rb +1 -1
  82. data/spree_core.gemspec +1 -0
  83. metadata +31 -4
@@ -0,0 +1,6 @@
1
+ module Spree
2
+ class Variant < Spree::Base
3
+ module Webhooks
4
+ end
5
+ end
6
+ end
@@ -5,9 +5,7 @@ module Spree
5
5
 
6
6
  include Spree::MemoizedData
7
7
  include Spree::Metadata
8
- if defined?(Spree::Webhooks::HasWebhooks)
9
- include Spree::Webhooks::HasWebhooks
10
- end
8
+ include Spree::Variant::Webhooks
11
9
 
12
10
  MEMOIZED_METHODS = %w(purchasable in_stock backorderable tax_category options_text compare_at_price)
13
11
 
@@ -108,6 +106,14 @@ module Spree
108
106
  not_discontinued.not_deleted.
109
107
  for_currency_and_available_price_amount(currency)
110
108
  end
109
+
110
+ scope :with_option_value, lambda { |option_name, option_value|
111
+ option_type_ids = OptionType.where(name: option_name).ids
112
+ return none if option_type_ids.empty?
113
+
114
+ joins(:option_values).where(Spree::OptionValue.table_name => { name: option_value, option_type_id: option_type_ids })
115
+ }
116
+
111
117
  # FIXME: cost price should be represented with DisplayMoney class
112
118
  LOCALIZED_NUMBERS = %w(cost_price weight depth width height)
113
119
 
@@ -172,6 +178,18 @@ module Spree
172
178
  !!deleted_at
173
179
  end
174
180
 
181
+ # Returns an array of hashes with the option type name, value and presentation
182
+ # @return [Array<Hash>]
183
+ def options
184
+ option_values.includes(:option_type).map do |option_value|
185
+ {
186
+ name: option_value.option_type.name,
187
+ value: option_value.name,
188
+ presentation: option_value.presentation
189
+ }
190
+ end
191
+ end
192
+
175
193
  def options=(options = {})
176
194
  options.each do |option|
177
195
  next if option[:name].blank? || option[:value].blank?
@@ -15,6 +15,8 @@ module Spree
15
15
  belongs_to :store, class_name: 'Spree::Store'
16
16
 
17
17
  has_many :wished_items, class_name: 'Spree::WishedItem', dependent: :destroy
18
+ has_many :variants, through: :wished_items, source: :variant, class_name: 'Spree::Variant'
19
+ has_many :products, -> { distinct }, through: :variants, source: :product, class_name: 'Spree::Product'
18
20
 
19
21
  after_commit :ensure_default_exists_and_is_unique
20
22
  validates :name, :store, :user, presence: true
@@ -27,6 +29,13 @@ module Spree
27
29
  token
28
30
  end
29
31
 
32
+ # returns the number of wished items in the wishlist
33
+ #
34
+ # @return [Integer]
35
+ def wished_items_count
36
+ @wished_items_count ||= variant_ids.count
37
+ end
38
+
30
39
  def self.get_by_param(param)
31
40
  find_by(token: param)
32
41
  end
@@ -19,10 +19,22 @@ module Spree
19
19
  join_options(options)
20
20
  end
21
21
 
22
+ def to_hash
23
+ options = option_values
24
+ options = sort_options(options)
25
+ options = present_options_as_hash(options)
26
+
27
+ join_hash_options(options)
28
+ end
29
+
22
30
  private
23
31
 
24
32
  def sort_options(options)
25
- options.sort_by { |o| o.option_type.position }
33
+ if options.first&.association(:option_type)&.loaded?
34
+ options.sort_by { |o| o.option_type.position }
35
+ else
36
+ options.includes(:option_type).sort_by { |o| o.option_type.position }
37
+ end
26
38
  end
27
39
 
28
40
  def present_options(options)
@@ -34,7 +46,7 @@ module Spree
34
46
  end
35
47
 
36
48
  def present_color_option(option)
37
- "#{option.option_type.presentation}: #{option.name}"
49
+ "#{option.option_type.presentation}: #{option.presentation}"
38
50
  end
39
51
 
40
52
  def present_option(option)
@@ -44,6 +56,26 @@ module Spree
44
56
  def join_options(options)
45
57
  options.to_sentence(words_connector: WORDS_CONNECTOR, two_words_connector: WORDS_CONNECTOR)
46
58
  end
59
+
60
+ def present_options_as_hash(options)
61
+ options.map do |ov|
62
+ method = "present_#{ov.option_type.name}_option_as_hash"
63
+
64
+ respond_to?(method, true) ? send(method, ov) : present_option_as_hash(ov)
65
+ end
66
+ end
67
+
68
+ def present_option_as_hash(option)
69
+ {}.tap do |hash|
70
+ hash.store(option.option_type.presentation.downcase, option.presentation)
71
+ end
72
+ end
73
+
74
+ def join_hash_options(options)
75
+ return {} if options.empty?
76
+
77
+ options.inject(:merge).symbolize_keys
78
+ end
47
79
  end
48
80
  end
49
81
  end
@@ -16,6 +16,8 @@ module Spree
16
16
  options ||= {}
17
17
  quantity ||= 1
18
18
 
19
+ return failure(variant, "#{variant.name} is not available in #{order.currency}") if variant.amount_in(order.currency).nil?
20
+
19
21
  line_item = Spree::Dependencies.line_item_by_variant_finder.constantize.new.execute(order: order, variant: variant, options: options)
20
22
 
21
23
  line_item_created = line_item.nil?
@@ -7,31 +7,41 @@ module Spree
7
7
  run :check_if_can_be_destroyed
8
8
  run :cancel_shipments
9
9
  run :void_payments
10
+ run :clear_addresses
10
11
  run :destroy_order
11
12
  end
12
13
 
13
14
  private
14
15
 
15
16
  def check_if_can_be_destroyed(order:)
16
- return failure(Spree.t(:cannot_be_destroyed)) unless order&.can_be_destroyed?
17
+ return failure(false, Spree.t(:cannot_be_destroyed)) unless order&.can_be_destroyed?
17
18
 
18
19
  success(order: order)
19
20
  end
20
21
 
21
22
  def cancel_shipments(order:)
22
- order.shipments.each(&:cancel!)
23
+ order.shipments.each(&:cancel)
23
24
 
24
25
  success(order: order)
25
26
  end
26
27
 
27
28
  def void_payments(order:)
28
- order.payments.each(&:void!)
29
+ order.payments.each(&:void)
30
+
31
+ success(order: order)
32
+ end
33
+
34
+ def clear_addresses(order:)
35
+ order.ship_address = nil unless order.ship_address&.can_be_deleted?
36
+ order.bill_address = nil unless order.bill_address&.can_be_deleted?
29
37
 
30
38
  success(order: order)
31
39
  end
32
40
 
33
41
  def destroy_order(order:)
34
- order.destroy
42
+ destroyed_result = order.destroy
43
+
44
+ return failure(false, Spree.t(:cannot_be_destroyed)) unless destroyed_result.present?
35
45
 
36
46
  success(order)
37
47
  end
@@ -21,6 +21,9 @@ module Spree
21
21
  # store & stock location
22
22
  Stores.call
23
23
  StockLocations.call
24
+
25
+ # add store resources
26
+ PaymentMethods.call
24
27
  end
25
28
  end
26
29
  end
@@ -0,0 +1,18 @@
1
+ module Spree
2
+ module Seeds
3
+ class PaymentMethods
4
+ prepend Spree::ServiceModule::Base
5
+
6
+ def call
7
+ payment_method = Spree::PaymentMethod::StoreCredit.find_or_initialize_by(
8
+ name: Spree.t(:store_credit_name),
9
+ description: Spree.t(:store_credit_name),
10
+ active: true
11
+ )
12
+
13
+ payment_method.stores = Spree::Store.all if payment_method.new_record?
14
+ payment_method.save!
15
+ end
16
+ end
17
+ end
18
+ end
@@ -6,7 +6,7 @@ module Spree
6
6
  def call
7
7
  country = Spree::Store.default.default_country
8
8
  Spree::StockLocation.find_or_create_by!(
9
- name: 'default',
9
+ name: Spree.t(:default_stock_location_name),
10
10
  propagate_all_variants: false,
11
11
  country: country,
12
12
  active: true,
@@ -7,32 +7,32 @@ module Spree
7
7
  eu_vat = Spree::Zone.where(name: 'EU_VAT', description: 'Countries that make up the EU VAT zone.', kind: 'country').first_or_create!
8
8
  uk_vat = Spree::Zone.where(name: 'UK_VAT', kind: 'country').first_or_create!
9
9
  north_america = Spree::Zone.where(name: 'North America', description: 'USA + Canada', kind: 'country').first_or_create!
10
- south_america = Spree::Zone.where(name: 'South America', description: 'South America', kind: 'country').first_or_create!
10
+ Spree::Zone.where(name: 'South America', description: 'South America', kind: 'country').first_or_create!
11
11
  middle_east = Spree::Zone.where(name: 'Middle East', description: 'Middle East', kind: 'country').first_or_create!
12
12
  asia = Spree::Zone.where(name: 'Asia', description: 'Asia', kind: 'country').first_or_create!
13
13
 
14
- %w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG LT CY LU MT DK NL EE HR CZ GR).each do |name|
15
- eu_vat.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
16
- end
17
-
14
+ create_zone_members(eu_vat, %w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG LT CY LU MT DK NL EE HR CZ GR))
15
+ create_zone_members(north_america, %w(US CA))
16
+ create_zone_members(middle_east, %w(BH CY EG IR IQ IL JO KW LB OM QA SA SY TR AE YE))
17
+ create_zone_members(asia, %w(AF AM AZ BH BD BT BN KH CN CX CC GE HK IN ID IR IQ IL JP JO KZ KW KG LA LB MO MY MV MN MM NP
18
+ KP OM PK PS PH QA SA SG KR LK SY TW TJ TH TR TM AE UZ VN YE))
18
19
  uk_vat.zone_members.where(zoneable: Spree::Country.find_by(iso: 'GB')).first_or_create!
20
+ end
19
21
 
20
- %w(US CA).each do |name|
21
- north_america.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
22
- end
23
-
24
- %w(BH CY EG IR IQ IL JO KW LB OM QA SA SY TR AE YE).each do |name|
25
- middle_east.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
26
- end
27
-
28
- %w(AF AM AZ BH BD BT BN KH CN CX CC GE HK IN ID IR IQ IL JP JO KZ KW KG LA LB MO MY MV MN MM NP
29
- KP OM PK PS PH QA SA SG KR LK SY TW TJ TH TR TM AE UZ VN YE).each do |name|
30
- asia.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
31
- end
22
+ protected
32
23
 
33
- %w(AR BO BR CL CO EC FK GF GY PY PE SR UY VE).each do |name|
34
- south_america.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
24
+ def create_zone_members(zone, country_codes)
25
+ countries_ids = Spree::Country.where(iso: country_codes).ids
26
+ zone_members = countries_ids.map do |country_id|
27
+ {
28
+ zoneable_id: country_id,
29
+ zoneable_type: 'Spree::Country',
30
+ zone_id: zone.id,
31
+ created_at: Time.current,
32
+ updated_at: Time.current
33
+ }
35
34
  end
35
+ Spree::ZoneMember.insert_all(zone_members)
36
36
  end
37
37
  end
38
38
  end
@@ -576,6 +576,7 @@ en:
576
576
  alternative_phone: Alternative Phone
577
577
  amount: Amount
578
578
  and: and
579
+ apply_only_on_full_priced_items: Apply only on full priced items
579
580
  approve: approve
580
581
  approver: Approver
581
582
  approved_at: Approved at
@@ -1580,6 +1581,7 @@ en:
1580
1581
  states_required: States Required
1581
1582
  status: Status
1582
1583
  stock: Stock
1584
+ default_stock_location_name: Shop location
1583
1585
  stock_location: Stock Location
1584
1586
  stock_location_info: Stock location info
1585
1587
  stock_locations: Stock Locations
@@ -0,0 +1,6 @@
1
+ class AddDeletedAtToSpreeStockLocations < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_column :spree_stock_locations, :deleted_at, :datetime, if_not_exists: true
4
+ add_index :spree_stock_locations, :deleted_at, if_not_exists: true
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class AddRefunderToSpreeRefunds < ActiveRecord::Migration[6.1]
2
+ def change
3
+ add_column :spree_refunds, :refunder_id, :bigint, if_not_exists: true
4
+ add_index :spree_refunds, :refunder_id, if_not_exists: true
5
+ end
6
+ end
@@ -19,6 +19,7 @@ module Spree
19
19
  end
20
20
 
21
21
  def set_locale
22
+ I18n.default_locale = default_locale unless Spree.always_use_translations?
22
23
  I18n.locale = current_locale
23
24
  end
24
25
 
@@ -83,11 +83,7 @@ module Spree
83
83
  def find_order_by_token_or_user(options = {}, with_adjustments = false)
84
84
  options[:lock] ||= false
85
85
 
86
- includes = if options[:includes]
87
- { line_items: [variant: [:images, :option_values, :product]] }
88
- else
89
- {}
90
- end
86
+ includes = options[:includes] ? order_includes : {}
91
87
 
92
88
  # Find any incomplete orders for the token
93
89
  incomplete_orders = current_store.orders.incomplete.includes(includes)
@@ -104,6 +100,10 @@ module Spree
104
100
 
105
101
  order
106
102
  end
103
+
104
+ def order_includes
105
+ { line_items: [variant: [:images, :option_values, :product]] }
106
+ end
107
107
  end
108
108
  end
109
109
  end
@@ -97,7 +97,8 @@ module Spree
97
97
  credit_card_finder: 'Spree::CreditCards::Find',
98
98
  products_finder: 'Spree::Products::Find',
99
99
  taxon_finder: 'Spree::Taxons::Find',
100
- line_item_by_variant_finder: 'Spree::LineItems::FindByVariant'
100
+ line_item_by_variant_finder: 'Spree::LineItems::FindByVariant',
101
+ variant_finder: 'Spree::Variants::Find'
101
102
  }.freeze
102
103
 
103
104
  include Spree::DependenciesHelper
@@ -101,14 +101,16 @@ module Spree::Preferences::Preferable
101
101
 
102
102
  private
103
103
 
104
- def convert_preference_value(value, type)
104
+ def convert_preference_value(value, type, nullable: false)
105
105
  case type
106
106
  when :string, :text
107
107
  value.to_s
108
108
  when :password
109
109
  value.to_s
110
110
  when :decimal
111
- (value.presence || 0).to_s.to_d
111
+ decimal_value = value.presence
112
+ decimal_value ||= 0 unless nullable
113
+ decimal_value.present? ? decimal_value.to_s.to_d : decimal_value
112
114
  when :integer
113
115
  value.to_i
114
116
  when :boolean
@@ -2,10 +2,11 @@ module Spree::Preferences
2
2
  module PreferableClassMethods
3
3
  def preference(name, type, *args)
4
4
  options = args.extract_options!
5
- options.assert_valid_keys(:default, :deprecated)
5
+ options.assert_valid_keys(:default, :deprecated, :nullable)
6
6
  default = options[:default]
7
7
  default = -> { options[:default] } unless default.is_a?(Proc)
8
8
  deprecated = options[:deprecated]
9
+ nullable = options[:nullable]
9
10
 
10
11
  # cache_key will be nil for new objects, then if we check if there
11
12
  # is a pending preference before going to default
@@ -16,7 +17,7 @@ module Spree::Preferences
16
17
  end
17
18
 
18
19
  define_method preference_setter_method(name) do |value|
19
- value = convert_preference_value(value, type)
20
+ value = convert_preference_value(value, type, nullable: nullable)
20
21
  preferences[name] = value
21
22
 
22
23
  Spree::Deprecation.warn("`#{name}` is deprecated. #{deprecated}") if deprecated
@@ -1,5 +1,5 @@
1
1
  module Spree
2
- VERSION = '4.8.2'.freeze
2
+ VERSION = '4.9.0'.freeze
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -1,13 +1,21 @@
1
1
  module Spree
2
2
  module Webhooks
3
3
  def self.disable_webhooks
4
- webhooks_disabled_previously = ENV['DISABLE_SPREE_WEBHOOKS']
5
- begin
6
- ENV['DISABLE_SPREE_WEBHOOKS'] = 'true'
7
- yield
8
- ensure
9
- ENV['DISABLE_SPREE_WEBHOOKS'] = webhooks_disabled_previously
10
- end
4
+ prev_value = disabled?
5
+ RequestStore.store[:disable_spree_webhooks] = true
6
+ yield
7
+ ensure
8
+ RequestStore.store[:disable_spree_webhooks] = prev_value
9
+ end
10
+
11
+ def self.disabled?
12
+ # rubocop:disable Style/RedundantFetchBlock
13
+ RequestStore.fetch(:disable_spree_webhooks) { false }
14
+ # rubocop:enable Style/RedundantFetchBlock
15
+ end
16
+
17
+ def self.disabled=(value)
18
+ RequestStore.store[:disable_spree_webhooks] = value
11
19
  end
12
20
  end
13
21
  end
data/lib/spree/core.rb CHANGED
@@ -19,6 +19,7 @@ require 'ransack'
19
19
  require 'state_machines-activerecord'
20
20
  require 'active_storage_validations'
21
21
  require 'activerecord-typedstore'
22
+ require 'request_store'
22
23
 
23
24
  # This is required because ActiveModel::Validations#invalid? conflicts with the
24
25
  # invalid state of a Payment. In the future this should be removed.
data/lib/spree/money.rb CHANGED
@@ -28,7 +28,7 @@ module Spree
28
28
 
29
29
  def initialize(amount, options = {})
30
30
  ::Money.default_currency ||= Spree::Store.default.default_currency || 'USD'
31
- @money = Monetize.parse([amount, (options[:currency] || Spree::Store.default.default_currency)].join)
31
+ @money = Monetize.parse(amount, (options[:currency] || Spree::Store.default.default_currency))
32
32
  @options = Spree::Money.default_formatting_rules.merge(options)
33
33
  end
34
34
 
@@ -37,12 +37,12 @@ module Spree
37
37
  ability_class.register_ability(ability)
38
38
  end
39
39
 
40
- let(:user) { Spree.user_class.new }
40
+ let(:user) { Spree.admin_user_class.new }
41
41
  let(:admin_app) { Spree::OauthApplication.create!(name: 'Admin Panel', scopes: 'admin') }
42
42
  let(:admin_token) { Spree::OauthAccessToken.create!(application: admin_app, scopes: 'admin').token }
43
43
 
44
44
  before do
45
- allow(Spree.user_class).to receive(:find_by).and_return(user)
45
+ allow(Spree.admin_user_class).to receive(:find_by).and_return(user)
46
46
  if defined?(Spree::Admin)
47
47
  allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(user)
48
48
  allow_any_instance_of(Spree::Admin::BaseController).to receive(:admin_oauth_application).and_return(admin_app)
@@ -17,7 +17,7 @@ namespace :common do
17
17
  Spree::DummyGenerator.start ["--lib_name=#{ENV['LIB_NAME']}"]
18
18
 
19
19
  # install frontend libraries
20
- unless ['spree/api', 'spree/core', 'spree/sample'].include?(ENV['LIB_NAME'])
20
+ unless ['spree/api', 'spree/core', 'spree/sample', 'spree/emails'].include?(ENV['LIB_NAME'])
21
21
  system('bin/rails importmap:install')
22
22
  system('bin/rails turbo:install')
23
23
  system('bin/rails stimulus:install')
data/spree_core.gemspec CHANGED
@@ -57,4 +57,5 @@ Gem::Specification.new do |s|
57
57
  s.add_dependency 'mobility', '~> 1.2'
58
58
  s.add_dependency 'mobility-ransack', '~> 1.2'
59
59
  s.add_dependency 'friendly_id-mobility', '~> 1.0'
60
+ s.add_dependency 'request_store', '~> 1.7'
60
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.2
4
+ version: 4.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-05-29 00:00:00.000000000 Z
12
+ date: 2024-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -525,6 +525,20 @@ dependencies:
525
525
  - - "~>"
526
526
  - !ruby/object:Gem::Version
527
527
  version: '1.0'
528
+ - !ruby/object:Gem::Dependency
529
+ name: request_store
530
+ requirement: !ruby/object:Gem::Requirement
531
+ requirements:
532
+ - - "~>"
533
+ - !ruby/object:Gem::Version
534
+ version: '1.7'
535
+ type: :runtime
536
+ prerelease: false
537
+ version_requirements: !ruby/object:Gem::Requirement
538
+ requirements:
539
+ - - "~>"
540
+ - !ruby/object:Gem::Version
541
+ version: '1.7'
528
542
  description: Spree Models, Helpers, Services and core libraries
529
543
  email: hello@spreecommerce.org
530
544
  executables: []
@@ -550,6 +564,7 @@ files:
550
564
  - app/finders/spree/products/find.rb
551
565
  - app/finders/spree/stores/find_current.rb
552
566
  - app/finders/spree/taxons/find.rb
567
+ - app/finders/spree/variants/find.rb
553
568
  - app/finders/spree/variants/option_types_finder.rb
554
569
  - app/finders/spree/variants/visible_finder.rb
555
570
  - app/helpers/spree/base_helper.rb
@@ -664,6 +679,7 @@ files:
664
679
  - app/models/spree/order/emails.rb
665
680
  - app/models/spree/order/payments.rb
666
681
  - app/models/spree/order/store_credit.rb
682
+ - app/models/spree/order/webhooks.rb
667
683
  - app/models/spree/order_contents.rb
668
684
  - app/models/spree/order_inventory.rb
669
685
  - app/models/spree/order_merger.rb
@@ -672,6 +688,7 @@ files:
672
688
  - app/models/spree/payment.rb
673
689
  - app/models/spree/payment/gateway_options.rb
674
690
  - app/models/spree/payment/processing.rb
691
+ - app/models/spree/payment/webhooks.rb
675
692
  - app/models/spree/payment_capture_event.rb
676
693
  - app/models/spree/payment_method.rb
677
694
  - app/models/spree/payment_method/check.rb
@@ -680,6 +697,7 @@ files:
680
697
  - app/models/spree/preference.rb
681
698
  - app/models/spree/price.rb
682
699
  - app/models/spree/product.rb
700
+ - app/models/spree/product/webhooks.rb
683
701
  - app/models/spree/product_option_type.rb
684
702
  - app/models/spree/product_promotion_rule.rb
685
703
  - app/models/spree/product_property.rb
@@ -716,6 +734,7 @@ files:
716
734
  - app/models/spree/refund_reason.rb
717
735
  - app/models/spree/reimbursement.rb
718
736
  - app/models/spree/reimbursement/credit.rb
737
+ - app/models/spree/reimbursement/emails.rb
719
738
  - app/models/spree/reimbursement/reimbursement_type_engine.rb
720
739
  - app/models/spree/reimbursement/reimbursement_type_validator.rb
721
740
  - app/models/spree/reimbursement_performer.rb
@@ -742,6 +761,8 @@ files:
742
761
  - app/models/spree/role.rb
743
762
  - app/models/spree/role_user.rb
744
763
  - app/models/spree/shipment.rb
764
+ - app/models/spree/shipment/emails.rb
765
+ - app/models/spree/shipment/webhooks.rb
745
766
  - app/models/spree/shipment_handler.rb
746
767
  - app/models/spree/shipping_calculator.rb
747
768
  - app/models/spree/shipping_category.rb
@@ -768,8 +789,10 @@ files:
768
789
  - app/models/spree/stock/splitter/shipping_category.rb
769
790
  - app/models/spree/stock/splitter/weight.rb
770
791
  - app/models/spree/stock_item.rb
792
+ - app/models/spree/stock_item/webhooks.rb
771
793
  - app/models/spree/stock_location.rb
772
794
  - app/models/spree/stock_movement.rb
795
+ - app/models/spree/stock_movement/webhooks.rb
773
796
  - app/models/spree/stock_transfer.rb
774
797
  - app/models/spree/store.rb
775
798
  - app/models/spree/store_credit.rb
@@ -789,6 +812,7 @@ files:
789
812
  - app/models/spree/taxon_image/configuration/active_storage.rb
790
813
  - app/models/spree/taxonomy.rb
791
814
  - app/models/spree/variant.rb
815
+ - app/models/spree/variant/webhooks.rb
792
816
  - app/models/spree/wished_item.rb
793
817
  - app/models/spree/wishlist.rb
794
818
  - app/models/spree/zone.rb
@@ -851,6 +875,7 @@ files:
851
875
  - app/services/spree/seeds/all.rb
852
876
  - app/services/spree/seeds/countries.rb
853
877
  - app/services/spree/seeds/default_reimbursement_types.rb
878
+ - app/services/spree/seeds/payment_methods.rb
854
879
  - app/services/spree/seeds/roles.rb
855
880
  - app/services/spree/seeds/shipping_categories.rb
856
881
  - app/services/spree/seeds/states.rb
@@ -939,6 +964,8 @@ files:
939
964
  - db/migrate/20230512094803_rename_data_feeds_column_provider_to_type.rb
940
965
  - db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb
941
966
  - db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb
967
+ - db/migrate/20240623172111_add_deleted_at_to_spree_stock_locations.rb
968
+ - db/migrate/20240725124530_add_refunder_to_spree_refunds.rb
942
969
  - db/seeds.rb
943
970
  - lib/friendly_id/paranoia.rb
944
971
  - lib/generators/spree/custom_authentication/custom_authentication_generator.rb
@@ -1119,9 +1146,9 @@ licenses:
1119
1146
  - BSD-3-Clause
1120
1147
  metadata:
1121
1148
  bug_tracker_uri: https://github.com/spree/spree/issues
1122
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.8.2
1149
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.9.0
1123
1150
  documentation_uri: https://docs.spreecommerce.org/
1124
- source_code_uri: https://github.com/spree/spree/tree/v4.8.2
1151
+ source_code_uri: https://github.com/spree/spree/tree/v4.9.0
1125
1152
  post_install_message:
1126
1153
  rdoc_options: []
1127
1154
  require_paths: