diff --git a/promotions/app/decorators/models/solidus_promotions/adjustment_decorator.rb b/promotions/app/patches/models/solidus_promotions/adjustment_patch.rb similarity index 88% rename from promotions/app/decorators/models/solidus_promotions/adjustment_decorator.rb rename to promotions/app/patches/models/solidus_promotions/adjustment_patch.rb index 87295179251..45563819cab 100644 --- a/promotions/app/decorators/models/solidus_promotions/adjustment_decorator.rb +++ b/promotions/app/patches/models/solidus_promotions/adjustment_patch.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module SolidusPromotions - module AdjustmentDecorator + module AdjustmentPatch def self.prepended(base) base.scope :solidus_promotion, -> { where(source_type: "SolidusPromotions::Benefit") } end diff --git a/promotions/app/decorators/models/solidus_promotions/line_item_decorator.rb b/promotions/app/patches/models/solidus_promotions/line_item_patch.rb similarity index 96% rename from promotions/app/decorators/models/solidus_promotions/line_item_decorator.rb rename to promotions/app/patches/models/solidus_promotions/line_item_patch.rb index a1169f0e7ee..1e79d97009e 100644 --- a/promotions/app/decorators/models/solidus_promotions/line_item_decorator.rb +++ b/promotions/app/patches/models/solidus_promotions/line_item_patch.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module SolidusPromotions - module LineItemDecorator + module LineItemPatch def self.prepended(base) base.attr_accessor :quantity_setter base.belongs_to :managed_by_order_benefit, class_name: "SolidusPromotions::Benefit", optional: true diff --git a/promotions/app/decorators/models/solidus_promotions/order_decorator.rb b/promotions/app/patches/models/solidus_promotions/order_patch.rb similarity index 98% rename from promotions/app/decorators/models/solidus_promotions/order_decorator.rb rename to promotions/app/patches/models/solidus_promotions/order_patch.rb index 08cc180e030..75e79bfa36d 100644 --- a/promotions/app/decorators/models/solidus_promotions/order_decorator.rb +++ b/promotions/app/patches/models/solidus_promotions/order_patch.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module SolidusPromotions - module OrderDecorator + module OrderPatch module ClassMethods def allowed_ransackable_associations super + ["solidus_promotions", "solidus_order_promotions"] diff --git a/promotions/app/decorators/models/solidus_promotions/order_recalculator_decorator.rb b/promotions/app/patches/models/solidus_promotions/order_recalculator_patch.rb similarity index 92% rename from promotions/app/decorators/models/solidus_promotions/order_recalculator_decorator.rb rename to promotions/app/patches/models/solidus_promotions/order_recalculator_patch.rb index ff497e9dba0..d8820d54e21 100644 --- a/promotions/app/decorators/models/solidus_promotions/order_recalculator_decorator.rb +++ b/promotions/app/patches/models/solidus_promotions/order_recalculator_patch.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module SolidusPromotions - module OrderRecalculatorDecorator + module OrderRecalculatorPatch # 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 diff --git a/promotions/app/decorators/models/solidus_promotions/shipment_decorator.rb b/promotions/app/patches/models/solidus_promotions/shipment_patch.rb similarity index 90% rename from promotions/app/decorators/models/solidus_promotions/shipment_decorator.rb rename to promotions/app/patches/models/solidus_promotions/shipment_patch.rb index 9df47adb33e..c73b14f7da1 100644 --- a/promotions/app/decorators/models/solidus_promotions/shipment_decorator.rb +++ b/promotions/app/patches/models/solidus_promotions/shipment_patch.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module SolidusPromotions - module ShipmentDecorator + module ShipmentPatch Spree::Shipment.prepend SolidusPromotions::DiscountableAmount def reset_current_discounts diff --git a/promotions/app/decorators/models/solidus_promotions/shipping_rate_decorator.rb b/promotions/app/patches/models/solidus_promotions/shipping_rate_patch.rb similarity index 95% rename from promotions/app/decorators/models/solidus_promotions/shipping_rate_decorator.rb rename to promotions/app/patches/models/solidus_promotions/shipping_rate_patch.rb index c0687fa6948..69d232062e1 100644 --- a/promotions/app/decorators/models/solidus_promotions/shipping_rate_decorator.rb +++ b/promotions/app/patches/models/solidus_promotions/shipping_rate_patch.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module SolidusPromotions - module ShippingRateDecorator + module ShippingRatePatch def self.prepended(base) base.class_eval do has_many :discounts, diff --git a/promotions/lib/solidus_promotions/engine.rb b/promotions/lib/solidus_promotions/engine.rb index 29df050ba6d..a69aa708f28 100644 --- a/promotions/lib/solidus_promotions/engine.rb +++ b/promotions/lib/solidus_promotions/engine.rb @@ -2,10 +2,13 @@ require "solidus_core" require "solidus_support" +require "flickwerk" module SolidusPromotions class Engine < Rails::Engine include SolidusSupport::EngineExtensions + include Flickwerk + Flickwerk.aliases["Spree::Config.order_recalculator_class"] = Spree::Config.order_recalculator_class_name isolate_namespace ::SolidusPromotions