Sha256: b28508dcc9ae01c47a7b3c1261bed4083725eca4904c463f4242f686675b3eda
Contents?: true
Size: 835 Bytes
Versions: 7
Compression:
Stored size: 835 Bytes
Contents
class OrderLineItem < ActiveRecord::Base belongs_to :order_txn, :class_name => 'OrderTxn' belongs_to :order_line_item_type has_many :charge_lines, :as => :charged_item belongs_to :product_instance belongs_to :product_type def get_total_charges # get all of the charge lines associated with the order_line 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 end
Version data entries
7 entries across 7 versions & 1 rubygems