12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/models/order_line_item.rb', line 12
def get_total_charges
total_hash = Hash.new
charge_lines.each do |charge|
cur_money = charge.money
cur_total = total_hash[cur_money.currency.internal_identifier]
if (cur_total.nil?)
cur_total = cur_money.clone
else
cur_total.amount = 0 if cur_total.amount.nil?
cur_total.amount += cur_money.amount if !cur_money.amount.nil?
end
total_hash[cur_money.currency.internal_identifier] = cur_total
end
return total_hash.values
end
|