Class: Spree::Promotion::Actions::CreateAdjustment
Class Method Summary
collapse
Instance Method Summary
collapse
#free_shipping?, human_description, #human_description, human_name, #human_name, #key
Class Method Details
.additional_permitted_attributes ⇒ Object
10
11
12
|
# File 'app/models/spree/promotion/actions/create_adjustment.rb', line 10
def self.additional_permitted_attributes
[calculator: [:type, { preferences: {} }]]
end
|
Instance Method Details
#compute_amount(order) ⇒ Object
20
21
22
|
# File 'app/models/spree/promotion/actions/create_adjustment.rb', line 20
def compute_amount(order)
[order_total(order), compute(order)].min * -1
end
|
#order_total(order) ⇒ Object
24
25
26
|
# File 'app/models/spree/promotion/actions/create_adjustment.rb', line 24
def order_total(order)
order.item_total + order.ship_total - order.shipping_discount
end
|
14
15
16
17
18
|
# File 'app/models/spree/promotion/actions/create_adjustment.rb', line 14
def perform(options = {})
order = options[:order]
create_unique_adjustment(order, order)
end
|