Module: SolidusLegacyPromotions::SpreeOrderDecorator
- Includes:
- selfself::ClassMethods
- Defined in:
- app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
11 12 13 14 |
# File 'app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb', line 11 def self.prepended(base) base.has_many :order_promotions, class_name: 'Spree::OrderPromotion', dependent: :destroy base.has_many :promotions, through: :order_promotions end |
Instance Method Details
#apply_shipping_promotions(_event = nil) ⇒ Object
16 17 18 19 |
# File 'app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb', line 16 def apply_shipping_promotions(_event = nil) Spree::Config.promotions.shipping_promotion_handler_class.new(self).activate recalculate end |
#shipping_discount ⇒ Object
21 22 23 |
# File 'app/decorators/solidus_legacy_promotions/models/spree_order_decorator.rb', line 21 def shipping_discount shipment_adjustments.credit.eligible.sum(:amount) * - 1 end |