Class: Calculator::DistributedAmount

Inherits:
Calculator
  • Object
show all
Defined in:
app/models/spree/calculator/distributed_amount.rb

Instance Method Summary collapse

Instance Method Details

#compute_line_item(line_item) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'app/models/spree/calculator/distributed_amount.rb', line 15

def compute_line_item(line_item)
  return 0 unless line_item
  return 0 unless preferred_currency.casecmp(line_item.currency).zero?
  return 0 unless calculable.promotion.line_item_actionable?(line_item.order, line_item)
  Spree::DistributedAmountsHandler.new(
    actionable_line_items(line_item.order),
    preferred_amount
  ).amount(line_item)
end