Class: SolidusFriendlyPromotions::Benefits::CreateDiscountedItem
Instance Method Summary
collapse
#can_discount?, #level
#adjustment_label, #applicable_line_items, #available_calculators, #available_conditions, #can_discount?, #compute_amount, #discount, #eligible_by_applicable_conditions?, #level, #possible_conditions, #preload_relations, #to_partial_path
Instance Method Details
11
12
13
14
15
|
# File 'app/models/solidus_friendly_promotions/benefits/create_discounted_item.rb', line 11
def perform(order)
line_item = find_item(order) || create_item(order)
set_quantity(line_item, determine_item_quantity(order))
line_item.current_discounts << discount(line_item)
end
|
#remove_from(order) ⇒ Object
17
18
19
20
|
# File 'app/models/solidus_friendly_promotions/benefits/create_discounted_item.rb', line 17
def remove_from(order)
line_item = find_item(order)
order.line_items.destroy(line_item)
end
|