Class: Spree::Calculator::FlatPercentItemTotal
Class Method Summary
collapse
Instance Method Summary
collapse
#available?, calculators, #description, register, #to_s
Class Method Details
.description ⇒ Object
7
8
9
|
# File 'app/models/spree/calculator/flat_percent_item_total.rb', line 7
def self.description
Spree.t(:flat_percent)
end
|
Instance Method Details
#compute(line_item) ⇒ Object
11
12
13
14
|
# File 'app/models/spree/calculator/flat_percent_item_total.rb', line 11
def compute(line_item)
value = line_item.amount * BigDecimal(self.preferred_flat_percent.to_s) / 100.0
(value * 100).round.to_f / 100
end
|