10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/models/pricing_plan.rb', line 10
def get_price( rule_ctx = nil )
price = Price.new
price.pricing_plan = self
if self.is_simple_amount
price.money = Money.new(:amount => self.money_amount, :currency => self.currency)
elsif !self.pricing_calculation.nil?
rule_ctx[:pricing_plan] = self
rule_ctx[:price] = price
eval(self.pricing_calculation)
else
self.pricing_plan_components.each do |pricing_plan_component|
price_component = pricing_plan_component.get_price_component(rule_ctx)
price.components << price_component
end
end
price.description = self.description
price
end
|