Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

module SolidusPromotions
module InMemoryOrderUpdaterPatch
# This is only needed for stores upgrading from the legacy promotion system.
# Once we've removed support for the legacy promotion system, we can remove this.
def recalculate(persist: true)
if SolidusPromotions.config.sync_order_promotions
MigrationSupport::OrderPromotionSyncer.new(order: order).call
end
super
end

Spree::InMemoryOrderUpdater.prepend self
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module SolidusPromotions
module OrderRecalculatorPatch
module OrderUpdaterPatch
# This is only needed for stores upgrading from the legacy promotion system.
# Once we've removed support for the legacy promotion system, we can remove this.
def recalculate
Expand All @@ -12,6 +12,5 @@ def recalculate
end

Spree::OrderUpdater.prepend self
Spree::InMemoryOrderUpdater.prepend self
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@
end

it_behaves_like "a successfully integrated promotion system"

it "allows in memory order recalculates without persistence" do
order = create(:order_with_line_items)
expect { Spree::InMemoryOrderUpdater.new(order).recalculate(persist: false) }.not_to raise_error
end
end
end
Loading