Class: Spree::Promotion::Actions::CreateItemAdjustments
Instance Method Summary
collapse
Methods inherited from Base
page
#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#compute_amount(line_item) ⇒ Object
17
18
19
20
|
# File 'app/models/spree/promotion/actions/create_item_adjustments.rb', line 17
def compute_amount(line_item)
return 0 unless promotion.line_item_actionable?(line_item.order, line_item)
[line_item.amount, compute(line_item)].min * -1
end
|
10
11
12
13
14
15
|
# File 'app/models/spree/promotion/actions/create_item_adjustments.rb', line 10
def perform(options = {})
order, promotion = options[:order], options[:promotion]
create_unique_adjustments(order, order.line_items) do |line_item|
promotion.line_item_actionable?(order, line_item)
end
end
|