class EME::Billing::Currency
Attributes
cost[RW]
cost_currency[RW]
id[RW]
name[RW]
payment_type[RW]
position[RW]
purchase_amount[RW]
purchase_amount_bonus[RW]
purchase_amount_total[RW]
purchase_currency[RW]
Public Class Methods
new(curr)
click to toggle source
{“SORTNO”=>1, “VIRTUALNAME”=>“1100 EMP”, “PGCODE”=>“PAYPAL”, “CURRENCY”=>“USD”, “PAYAMT”=>10, “CASHAMT”=>1100, “CASHIDENTIFIER”=>“EMP”, “REALCASHAMT”=>1100, “BONUSCASHAMT”=>0}
# File lib/eme/billing.rb, line 368 def initialize(curr) @id = curr["CURRENCYID"] @name = curr["VIRTUALNAME"] @payment_type = curr["PGCODE"] @position = curr["SORTNO"] @cost = curr["PAYAMT"] @cost_currency = curr["CURRENCY"] @purchase_amount_total = curr["CASHAMT"] @purchase_amount = curr["REALCASHAMT"] @purchase_amount_bonus = curr["BONUSCASHAMT"] @purchase_currency = curr["CASHIDENTIFIER"] end
Public Instance Methods
bonus()
click to toggle source
# File lib/eme/billing.rb, line 398 def bonus return 0 if @purchase_amount_total == 0 || @purchase_amount == 0 (@purchase_amount_bonus.to_f * 100.0 / @purchase_amount).to_i end
to_s()
click to toggle source
# File lib/eme/billing.rb, line 381 def to_s <<-CURR Currency #{self.object_id} \tid: #{@id} \tname: #{@name} \tpayment_type: #{@payment_type} \tposition: #{@position} \tcost: #{@cost} \tcost_currency: #{@cost_currency} \tpurchase_amount: #{@purchase_amount} \tpurchase_amount_total: #{@purchase_amount_total} \tpurchase_amount_bonus: #{@purchase_amount_bonus} \tpurchase_currency: #{@purchase_currency} \tbonus: #{bonus} CURR end