Module: SolidusPromotions::DiscountedAmount
- Defined in:
- app/models/concerns/solidus_promotions/discounted_amount.rb
Defined Under Namespace
Classes: NotCalculatingPromotions
Instance Method Summary collapse
-
#current_lane_discounts ⇒ Array<Spree::Adjustment,SolidusPromotions::ShippingRateDiscount>
Returns discount objects from the current promotion lane.
-
#discounted_amount ⇒ BigDecimal
(also: #discountable_amount)
Calculates the total discounted amount including adjustments from previous lanes.
Instance Method Details
#current_lane_discounts ⇒ Array<Spree::Adjustment,SolidusPromotions::ShippingRateDiscount>
Returns discount objects from the current promotion lane.
34 35 36 37 38 |
# File 'app/models/concerns/solidus_promotions/discounted_amount.rb', line 34 def current_lane_discounts raise NotCalculatingPromotions unless PromotionLane.current_lane discounts_by_lanes([PromotionLane.current_lane]) end |
#discounted_amount ⇒ BigDecimal Also known as: discountable_amount
Calculates the total discounted amount including adjustments from previous lanes.
24 25 26 |
# File 'app/models/concerns/solidus_promotions/discounted_amount.rb', line 24 def discounted_amount amount + previous_lanes_discounts.sum(&:amount) end |