Class: Spree::Promotion::Actions::CreateAdjustment

Inherits:
Spree::PromotionAction show all
Includes:
AdjustmentSource, CalculatedAdjustments
Defined in:
app/models/spree/promotion/actions/create_adjustment.rb

Instance Method Summary collapse

Methods inherited from Base

page, spree_base_scopes

Methods included from Spree::Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

#compute_amount(order) ⇒ Object



15
16
17
# File 'app/models/spree/promotion/actions/create_adjustment.rb', line 15

def compute_amount(order)
  [(order.item_total + order.ship_total - order.shipping_discount), compute(order)].min * -1
end

#perform(options = {}) ⇒ Object



10
11
12
13
# File 'app/models/spree/promotion/actions/create_adjustment.rb', line 10

def perform(options = {})
  order = options[:order]
  create_unique_adjustment(order, order)
end