solidus_core 3.4.6 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/app/helpers/spree/products_helper.rb +1 -1
  4. data/app/models/concerns/spree/active_storage_adapter.rb +0 -17
  5. data/app/models/concerns/spree/default_price.rb +0 -15
  6. data/app/models/concerns/spree/ransackable_attributes.rb +0 -21
  7. data/app/models/spree/adjustment.rb +0 -13
  8. data/app/models/spree/carton.rb +1 -1
  9. data/app/models/spree/fulfilment_changer.rb +2 -14
  10. data/app/models/spree/option_value.rb +2 -11
  11. data/app/models/spree/order.rb +9 -21
  12. data/app/models/spree/order_updater.rb +0 -29
  13. data/app/models/spree/payment.rb +5 -37
  14. data/app/models/spree/product/scopes.rb +0 -5
  15. data/app/models/spree/product.rb +3 -10
  16. data/app/models/spree/promotion/rules/item_total.rb +0 -11
  17. data/app/models/spree/promotion.rb +7 -30
  18. data/app/models/spree/promotion_rule.rb +0 -5
  19. data/app/models/spree/taxon.rb +2 -2
  20. data/app/models/spree/taxonomy.rb +1 -1
  21. data/app/models/spree/variant/price_selector.rb +1 -14
  22. data/app/models/spree/variant.rb +1 -17
  23. data/db/migrate/20210815004823_add_unique_index_to_option_values_variants.rb +16 -0
  24. data/db/migrate/20230321161854_change_column_null_option_values_option_type_id.rb +5 -0
  25. data/db/migrate/20230322085416_remove_match_policy_from_spree_promotion.rb +5 -0
  26. data/db/migrate/20230325132905_remove_unused_columns_from_promotion_rules.rb +6 -0
  27. data/db/migrate/20230325161633_drop_unused_promo_action_line_items.rb +13 -0
  28. data/db/migrate/20230425103509_remove_taxon_position.rb +5 -0
  29. data/db/migrate/20230427095534_drop_deprecated_address_id_from_shipments.rb +11 -0
  30. data/lib/generators/solidus/install/app_templates/frontend/none.rb +1 -2
  31. data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -3
  32. data/lib/generators/solidus/install/app_templates/payment_method/paypal.rb +2 -14
  33. data/lib/generators/solidus/install/app_templates/payment_method/stripe.rb +5 -0
  34. data/lib/generators/solidus/install/install_generator.rb +59 -153
  35. data/lib/spree/app_configuration.rb +2 -82
  36. data/lib/spree/bus.rb +0 -11
  37. data/lib/spree/core/controller_helpers/auth.rb +0 -16
  38. data/lib/spree/core/engine.rb +11 -31
  39. data/lib/spree/core/validators/email.rb +0 -4
  40. data/lib/spree/core/version.rb +2 -2
  41. data/lib/spree/core.rb +0 -2
  42. data/lib/spree/migration_helpers.rb +3 -3
  43. data/lib/spree/preferences/preferable_class_methods.rb +1 -25
  44. data/lib/spree/testing_support/common_rake.rb +5 -1
  45. data/lib/spree/testing_support/dummy_app/rake_tasks.rb +4 -8
  46. data/lib/spree/testing_support/dummy_app.rb +1 -6
  47. data/lib/spree/testing_support/factories/address_factory.rb +0 -7
  48. data/lib/spree/testing_support/factories/adjustment_factory.rb +0 -11
  49. data/lib/spree/testing_support/factories/adjustment_reason_factory.rb +0 -5
  50. data/lib/spree/testing_support/factories/calculator_factory.rb +0 -5
  51. data/lib/spree/testing_support/factories/carton_factory.rb +0 -8
  52. data/lib/spree/testing_support/factories/country_factory.rb +0 -5
  53. data/lib/spree/testing_support/factories/credit_card_factory.rb +0 -5
  54. data/lib/spree/testing_support/factories/customer_return_factory.rb +0 -9
  55. data/lib/spree/testing_support/factories/image_factory.rb +0 -5
  56. data/lib/spree/testing_support/factories/inventory_unit_factory.rb +0 -10
  57. data/lib/spree/testing_support/factories/line_item_factory.rb +0 -8
  58. data/lib/spree/testing_support/factories/option_type_factory.rb +0 -8
  59. data/lib/spree/testing_support/factories/option_value_factory.rb +0 -5
  60. data/lib/spree/testing_support/factories/order_factory.rb +0 -12
  61. data/lib/spree/testing_support/factories/order_promotion_factory.rb +0 -8
  62. data/lib/spree/testing_support/factories/payment_factory.rb +0 -10
  63. data/lib/spree/testing_support/factories/payment_method_factory.rb +0 -5
  64. data/lib/spree/testing_support/factories/price_factory.rb +0 -7
  65. data/lib/spree/testing_support/factories/product_factory.rb +0 -11
  66. data/lib/spree/testing_support/factories/product_option_type_factory.rb +0 -8
  67. data/lib/spree/testing_support/factories/product_property_factory.rb +0 -8
  68. data/lib/spree/testing_support/factories/promotion_category_factory.rb +0 -5
  69. data/lib/spree/testing_support/factories/promotion_code_factory.rb +0 -8
  70. data/lib/spree/testing_support/factories/promotion_factory.rb +0 -8
  71. data/lib/spree/testing_support/factories/property_factory.rb +0 -5
  72. data/lib/spree/testing_support/factories/refund_factory.rb +0 -8
  73. data/lib/spree/testing_support/factories/refund_reason_factory.rb +0 -5
  74. data/lib/spree/testing_support/factories/reimbursement_factory.rb +0 -7
  75. data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +0 -5
  76. data/lib/spree/testing_support/factories/return_authorization_factory.rb +0 -9
  77. data/lib/spree/testing_support/factories/return_item_factory.rb +0 -9
  78. data/lib/spree/testing_support/factories/return_reason_factory.rb +0 -5
  79. data/lib/spree/testing_support/factories/role_factory.rb +0 -5
  80. data/lib/spree/testing_support/factories/shipment_factory.rb +0 -10
  81. data/lib/spree/testing_support/factories/shipping_category_factory.rb +0 -5
  82. data/lib/spree/testing_support/factories/shipping_method_factory.rb +0 -9
  83. data/lib/spree/testing_support/factories/shipping_rate_factory.rb +0 -8
  84. data/lib/spree/testing_support/factories/state_factory.rb +0 -8
  85. data/lib/spree/testing_support/factories/stock_item_factory.rb +0 -8
  86. data/lib/spree/testing_support/factories/stock_location_factory.rb +0 -9
  87. data/lib/spree/testing_support/factories/stock_movement_factory.rb +0 -7
  88. data/lib/spree/testing_support/factories/stock_package_factory.rb +0 -8
  89. data/lib/spree/testing_support/factories/store_credit_category_factory.rb +0 -5
  90. data/lib/spree/testing_support/factories/store_credit_event_factory.rb +0 -8
  91. data/lib/spree/testing_support/factories/store_credit_factory.rb +0 -9
  92. data/lib/spree/testing_support/factories/store_credit_reason_factory.rb +0 -5
  93. data/lib/spree/testing_support/factories/store_credit_type_factory.rb +0 -5
  94. data/lib/spree/testing_support/factories/store_factory.rb +0 -5
  95. data/lib/spree/testing_support/factories/tax_category_factory.rb +0 -8
  96. data/lib/spree/testing_support/factories/tax_rate_factory.rb +0 -9
  97. data/lib/spree/testing_support/factories/taxon_factory.rb +0 -7
  98. data/lib/spree/testing_support/factories/taxonomy_factory.rb +0 -5
  99. data/lib/spree/testing_support/factories/user_factory.rb +0 -9
  100. data/lib/spree/testing_support/factories/variant_factory.rb +0 -10
  101. data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +0 -8
  102. data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +0 -9
  103. data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +0 -8
  104. data/lib/spree/testing_support/factories/zone_factory.rb +0 -8
  105. data/lib/spree/testing_support/factory_bot.rb +4 -28
  106. data/lib/spree/testing_support/sequences.rb +0 -5
  107. data/solidus_core.gemspec +4 -4
  108. metadata +48 -76
  109. data/app/subscribers/spree/mailer_subscriber.rb +0 -29
  110. data/lib/generators/solidus/install/app_templates/frontend/break_down_solidus_gem.rb +0 -54
  111. data/lib/generators/solidus/install/app_templates/frontend/classic.rb +0 -16
  112. data/lib/generators/solidus/install/app_templates/payment_method/bolt.rb +0 -13
  113. data/lib/spree/core/controller_helpers/current_host.rb +0 -19
  114. data/lib/spree/event/adapters/active_support_notifications.rb +0 -67
  115. data/lib/spree/event/configuration.rb +0 -25
  116. data/lib/spree/event/subscriber.rb +0 -86
  117. data/lib/spree/event/subscriber_registry.rb +0 -92
  118. data/lib/spree/event.rb +0 -119
  119. data/lib/spree/promotion/match_policies.rb +0 -2
  120. data/lib/spree/rails_compatibility.rb +0 -106
  121. data/lib/spree/testing_support/factories.rb +0 -11
  122. data/lib/spree/testing_support.rb +0 -36
  123. data/lib/tasks/solidus/check_orders_with_invalid_email.rake +0 -18
  124. data/lib/tasks/solidus/split_promotions_with_any_match_policy.rake +0 -33
@@ -1,92 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module Event
5
- class SubscriberRegistry
6
- def initialize
7
- @registry = {}
8
- @semaphore = Mutex.new
9
- end
10
-
11
- def register(subscriber)
12
- registry[subscriber.name] ||= {}
13
- end
14
-
15
- def activate_autoloadable_subscribers
16
- require_subscriber_files
17
- activate_all_subscribers
18
- end
19
-
20
- def activate_all_subscribers
21
- registry.each_key { |subscriber_name| activate_subscriber(subscriber_name.constantize) }
22
- end
23
-
24
- def deactivate_all_subscribers
25
- registry.each_key { |subscriber_name| deactivate_subscriber(subscriber_name.constantize) }
26
- end
27
-
28
- def activate_subscriber(subscriber)
29
- return unless registry[subscriber.name]
30
-
31
- subscriber.event_actions.each do |event_action, event_name|
32
- @semaphore.synchronize do
33
- unsafe_deactivate_subscriber(subscriber, event_action)
34
-
35
- subscription = Spree::Event.subscribe(event_name) { |event| subscriber.send(event_action, event) }
36
-
37
- # deprecated mappings, to be removed when Solidus 2.10 is not supported anymore:
38
- if subscriber.respond_to?("#{event_action}_handler=")
39
- subscriber.send("#{event_action}_handler=", subscription)
40
- end
41
-
42
- registry[subscriber.name][event_action] = subscription
43
- end
44
- end
45
- end
46
-
47
- def deactivate_subscriber(subscriber, event_action_name = nil)
48
- @semaphore.synchronize do
49
- unsafe_deactivate_subscriber(subscriber, event_action_name)
50
- end
51
- end
52
-
53
- private
54
-
55
- attr_reader :registry
56
-
57
- # Loads all Solidus' core and application's event subscribers files.
58
- # The latter are loaded automatically only when the preference
59
- # Spree::Config.events.autoload_subscribers is set to a truthy value.
60
- #
61
- # Files must be placed under the directory `app/subscribers` and their
62
- # name must end with `_subscriber.rb`.
63
- #
64
- # Loading the files has the side effect of adding their module to the
65
- # list in Spree::Event.subscribers.
66
- def require_subscriber_files
67
- require_dependency(
68
- Spree::Core::Engine.root.join('app', 'subscribers', 'spree', 'mailer_subscriber.rb')
69
- )
70
-
71
- pattern = "app/subscribers/**/*_subscriber.rb"
72
-
73
- # Load application subscribers, only when the flag is set to true:
74
- if Spree::Config.events.autoload_subscribers
75
- Rails.root.glob(pattern) { |c| require_dependency(c.to_s) }
76
- end
77
- end
78
-
79
- def unsafe_deactivate_subscriber(subscriber, event_action_name = nil)
80
- to_unsubscribe = Array.wrap(event_action_name || subscriber.event_actions.keys)
81
-
82
- to_unsubscribe.each do |event_action|
83
- if (subscription = registry.dig(subscriber.name, event_action))
84
- Spree::Event.unsubscribe(subscription)
85
-
86
- registry[subscriber.name].delete(event_action)
87
- end
88
- end
89
- end
90
- end
91
- end
92
- end
data/lib/spree/event.rb DELETED
@@ -1,119 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'event/adapters/active_support_notifications'
4
- require_relative 'event/subscriber_registry'
5
- require_relative 'event/configuration'
6
- require_relative 'event/subscriber'
7
-
8
- module Spree
9
- module Event
10
- extend self
11
-
12
- delegate :activate_autoloadable_subscribers, :activate_all_subscribers, :deactivate_all_subscribers, to: :subscriber_registry
13
-
14
- # Allows to trigger events that can be subscribed using #subscribe. An
15
- # optional block can be passed that will be executed immediately. The
16
- # actual code implementation is delegated to the adapter.
17
- #
18
- # @param [String] event_name the name of the event. The suffix ".spree"
19
- # will be added automatically if not present
20
- # @param [Hash] opts a list of options to be passed to the triggered event
21
- #
22
- # @example Trigger an event named 'order_finalized'
23
- # Spree::Event.fire 'order_finalized', order: @order do
24
- # @order.complete!
25
- # end
26
- def fire(event_name, opts = {})
27
- adapter.fire normalize_name(event_name), opts do
28
- yield opts if block_given?
29
- end
30
- end
31
-
32
- # Subscribe to an event with the given name. The provided block is executed
33
- # every time the subscribed event is fired.
34
- #
35
- # @param [String, Regexp] event_name the name of the event.
36
- # When String, the suffix ".spree" will be added automatically if not present,
37
- # when using the default adapter for ActiveSupportNotifications.
38
- # When Regexp, due to the unpredictability of all possible regexp combinations,
39
- # adding the suffix is developer's responsibility (if you don't, you will
40
- # subscribe to all notifications, including internal Rails notifications
41
- # as well).
42
- #
43
- # @see Spree::Event::Adapters::ActiveSupportNotifications#normalize_name
44
- #
45
- # @return a subscription object that can be used as reference in order
46
- # to remove the subscription
47
- #
48
- # @example Subscribe to the `order_finalized` event
49
- # Spree::Event.subscribe 'order_finalized' do |event|
50
- # order = event.payload[:order]
51
- # Spree::Mailer.order_finalized(order).deliver_later
52
- # end
53
- #
54
- # @see Spree::Event#unsubscribe
55
- def subscribe(event_name, &block)
56
- name = normalize_name(event_name)
57
- listener_names << name
58
- adapter.subscribe(name, &block)
59
- end
60
-
61
- # Unsubscribes a whole event or a specific subscription object
62
- #
63
- # @param [String, Object] subscriber the event name as a string (with
64
- # or without the ".spree" suffix) or the subscription object
65
- #
66
- # @example Unsubscribe a single subscription
67
- # subscription = Spree::Event.fire 'order_finalized'
68
- # Spree::Event.unsubscribe(subscription)
69
- # @example Unsubscribe all `order_finalized` event subscriptions
70
- # Spree::Event.unsubscribe('order_finalized')
71
- # @example Unsubscribe an event by name with explicit prefix
72
- # Spree::Event.unsubscribe('order_finalized.spree')
73
- def unsubscribe(subscriber)
74
- name_or_subscriber = subscriber.is_a?(String) ? normalize_name(subscriber) : subscriber
75
- adapter.unsubscribe(name_or_subscriber)
76
- end
77
-
78
- # Lists all subscriptions currently registered under the ".spree"
79
- # namespace. Actual implementation is delegated to the adapter
80
- #
81
- # @return [Hash] an hash with event names as keys and arrays of subscriptions
82
- # as values
83
- #
84
- # @example Current subscriptions
85
- # Spree::Event.listeners
86
- # # => {"order_finalized.spree"=> [#<ActiveSupport...>],
87
- # "reimbursement_reimbursed.spree"=> [#<ActiveSupport...>]}
88
- def listeners
89
- adapter.listeners_for(listener_names)
90
- end
91
-
92
- # The adapter used by Spree::Event, defaults to
93
- # Spree::Event::Adapters::ActiveSupportNotifications
94
- #
95
- # @example Change the adapter
96
- # Spree::Config.events.adapter = "Spree::EventBus.new"
97
- #
98
- # @see Spree::AppConfiguration
99
- def adapter
100
- Spree::Config.events.adapter
101
- end
102
-
103
- # @!attribute [r] subscribers
104
- # @return <Spree::Event::SubscriberRegistry> The registry for supporting class reloading for Spree::Event::Subscriber instances
105
- def subscriber_registry
106
- Spree::Config.events.subscriber_registry
107
- end
108
-
109
- private
110
-
111
- def normalize_name(name)
112
- adapter.normalize_name(name)
113
- end
114
-
115
- def listener_names
116
- @listeners_names ||= Set.new
117
- end
118
- end
119
- end
@@ -1,2 +0,0 @@
1
- Spree::Promotion::MATCH_POLICIES = %w(all any)
2
- Spree::Deprecation.warn('Spree::Promotion::MATCH_POLICIES is deprecated')
@@ -1,106 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rails/gem_version'
4
-
5
- module Spree
6
- # Supported Rails versions compatibility
7
- #
8
- # This module is meant to wrap some Rails API changes between supported
9
- # versions. It's also meant to contain compatibility for features that we use
10
- # internally in the Solidus code base.
11
- module RailsCompatibility
12
- # Method `#to_fs`
13
- #
14
- # Available since Rails 7.0, substitutes `#to_s(format)`
15
- #
16
- # It includes:
17
- #
18
- # ActiveSupport::NumericWithFormat
19
- # ActiveSupport::RangeWithFormat
20
- # ActiveSupport::TimeWithZone
21
- # Array
22
- # Date
23
- # DateTime
24
- # Time
25
- #
26
- # See https://github.com/rails/rails/pull/43772 &
27
- # https://github.com/rails/rails/pull/44354
28
- #
29
- # TODO: Remove when deprecating Rails 6.1
30
- def self.to_fs(value, *args, **kwargs, &block)
31
- if version_gte?('7.0')
32
- value.to_fs(*args, **kwargs, &block)
33
- else
34
- value.to_s(*args, **kwargs, &block)
35
- end
36
- end
37
-
38
- # `raise_on_missing_translations` config option
39
- #
40
- # Changed from ActionView to I18n on Rails 6.1
41
- #
42
- # See https://github.com/rails/rails/pull/31571
43
- #
44
- # TODO: Remove when deprecating Rails 6.0
45
- def self.raise_on_missing_translations(value)
46
- if version_gte?('6.1')
47
- Rails.application.config.i18n.raise_on_missing_translations = value
48
- else
49
- Rails.application.config.action_view.raise_on_missing_translations = value
50
- end
51
- end
52
-
53
- # Set default image attachment adapter
54
- #
55
- # TODO: Remove when deprecating Rails 6.0
56
- def self.default_image_attachment_module
57
- if version_gte?("6.1")
58
- "Spree::Image::ActiveStorageAttachment"
59
- else
60
- "Spree::Image::PaperclipAttachment"
61
- end
62
- end
63
-
64
- # Set default taxon attachment adapter
65
- #
66
- # TODO: Remove when deprecating Rails 6.0
67
- def self.default_taxon_attachment_module
68
- if version_gte?("6.1")
69
- "Spree::Taxon::ActiveStorageAttachment"
70
- else
71
- "Spree::Taxon::PaperclipAttachment"
72
- end
73
- end
74
-
75
- # Set current host for ActiveStorage
76
- #
77
- # Changed from `#host` to `#url_options` on Rails 7
78
- #
79
- # See https://github.com/rails/rails/issues/41388
80
- #
81
- # TODO: Remove when deprecating Rails 6.1
82
- def self.active_storage_url_options_host(value)
83
- if version_gte?('7')
84
- ActiveStorage::Current.url_options = { host: value }
85
- else
86
- ActiveStorage::Current.host = value
87
- end
88
- end
89
-
90
- # Default ActiveStorage variant processor
91
- #
92
- # Changed from `:mini_magick` to `vips` on Rails 7
93
- #
94
- # See https://github.com/rails/rails/issues/42744
95
- #
96
- # TODO: Remove when deprecating Rails 6.1
97
- def self.variant_processor
98
- version_gte?('7') ? :vips : :mini_magick
99
- end
100
-
101
- def self.version_gte?(version)
102
- ::Rails.gem_version >= Gem::Version.new(version)
103
- end
104
- private_class_method :version_gte?
105
- end
106
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spree/testing_support/factory_bot'
4
-
5
- Spree::Deprecation.warn(
6
- "Please do not try to load factories directly. " \
7
- 'Use factory_bot_rails and rely on the default configuration instead.', caller(1)
8
- )
9
-
10
- Spree::TestingSupport::FactoryBot.check_version
11
- Spree::TestingSupport::FactoryBot::PATHS.each { |path| require path }
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spree/testing_support/factory_bot'
4
- require 'spree/deprecation'
5
-
6
- Spree::Deprecation.warn <<-WARN
7
- Using `require 'spree/testing_support'` is deprecated and will be removed in
8
- Solidus 4.0.
9
- WARN
10
-
11
- module Spree
12
- module TestingSupport
13
- autoload :FactoryBot, "spree/testing_support/factory_bot"
14
- autoload :SEQUENCES, "spree/testing_support/factory_bot"
15
- autoload :FACTORIES, "spree/testing_support/factory_bot"
16
-
17
- def factory_bot_paths
18
- Spree::TestingSupport::FactoryBot.definition_file_paths
19
- end
20
-
21
- def check_factory_bot_version
22
- Spree::TestingSupport::FactoryBot.check_version
23
- end
24
-
25
- def load_all_factories
26
- Spree::TestingSupport::FactoryBot.add_paths_and_load!
27
- end
28
-
29
- deprecate(
30
- factory_bot_paths: "Spree::TestingSupport::FactoryBot.definition_file_paths",
31
- check_factory_bot_version: "Spree::TestingSupport::FactoryBot.check_version",
32
- load_all_factories: "Spree::TestingSupport::FactoryBot.add_paths_and_load!",
33
- deprecator: Spree::Deprecation
34
- )
35
- end
36
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- namespace :solidus do
4
- desc 'Prints orders with invalid email (after fix for GHSA-qxmr-qxh6-2cc9)'
5
- task check_orders_with_invalid_email: :environment do
6
- matches = Spree::Order.find_each.reduce([]) do |matches, order|
7
- order.email.nil? || Spree::EmailValidator::EMAIL_REGEXP.match?(order.email) ? matches : matches + [order]
8
- end
9
- if matches.any?
10
- puts 'Email / ID / Number'
11
- puts(matches.map do |order|
12
- "#{order.email} / #{order.id} / #{order.number}"
13
- end.join("\n"))
14
- else
15
- puts 'NO MATCHES'
16
- end
17
- end
18
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- namespace :solidus do
4
- desc "Split Promotions with 'any' match policy"
5
- task split_promotions_with_any_match_policy: :environment do
6
- Spree::Promotion.where(match_policy: :any).includes(:promotion_rules).all.each do |promotion|
7
- if promotion.promotion_rules.length <= 1
8
- promotion.update!(match_policy: :all)
9
- elsif promotion.active?
10
- promotion.rules.map do |rule|
11
- new_promotion = promotion.dup
12
- new_promotion.promotion_rules = [rule]
13
- new_promotion.match_policy = "all"
14
- new_promotion.promotion_actions = promotion.actions.map do |action|
15
- new_action = action.dup
16
- if action.respond_to?(:calculator)
17
- new_action.calculator = action.calculator.dup
18
- end
19
- new_action.promotion = new_promotion
20
- new_action.save!
21
- new_action
22
- end
23
- new_promotion.expires_at = promotion.expires_at
24
- new_promotion.starts_at = Time.current
25
- new_promotion.save!
26
- end
27
- promotion.update!(expires_at: Time.current)
28
- end
29
- end
30
-
31
- Spree::Order.where(completed_at: nil).each { |order| Spree::PromotionHandler::Cart.new(order).activate }
32
- end
33
- end