Class: EME::Billing::Currency
- Inherits:
-
Object
- Object
- EME::Billing::Currency
- Defined in:
- lib/eme/billing.rb
Instance Attribute Summary collapse
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#cost_currency ⇒ Object
Returns the value of attribute cost_currency.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#payment_type ⇒ Object
Returns the value of attribute payment_type.
-
#position ⇒ Object
Returns the value of attribute position.
-
#purchase_amount ⇒ Object
Returns the value of attribute purchase_amount.
-
#purchase_amount_bonus ⇒ Object
Returns the value of attribute purchase_amount_bonus.
-
#purchase_amount_total ⇒ Object
Returns the value of attribute purchase_amount_total.
-
#purchase_currency ⇒ Object
Returns the value of attribute purchase_currency.
Instance Method Summary collapse
- #bonus ⇒ Object
-
#initialize(curr) ⇒ Currency
constructor
“VIRTUALNAME”=>“1100 EMP”, “PGCODE”=>“PAYPAL”, “CURRENCY”=>“USD”, “PAYAMT”=>10, “CASHAMT”=>1100, “CASHIDENTIFIER”=>“EMP”, “REALCASHAMT”=>1100, “BONUSCASHAMT”=>0.
- #to_s ⇒ Object
Constructor Details
#initialize(curr) ⇒ Currency
“VIRTUALNAME”=>“1100 EMP”, “PGCODE”=>“PAYPAL”, “CURRENCY”=>“USD”, “PAYAMT”=>10, “CASHAMT”=>1100, “CASHIDENTIFIER”=>“EMP”, “REALCASHAMT”=>1100, “BONUSCASHAMT”=>0
368 369 370 371 372 373 374 375 376 377 378 379 |
# 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 |
Instance Attribute Details
#cost ⇒ Object
Returns the value of attribute cost.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def cost @cost end |
#cost_currency ⇒ Object
Returns the value of attribute cost_currency.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def cost_currency @cost_currency end |
#id ⇒ Object
Returns the value of attribute id.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def name @name end |
#payment_type ⇒ Object
Returns the value of attribute payment_type.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def payment_type @payment_type end |
#position ⇒ Object
Returns the value of attribute position.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def position @position end |
#purchase_amount ⇒ Object
Returns the value of attribute purchase_amount.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def purchase_amount @purchase_amount end |
#purchase_amount_bonus ⇒ Object
Returns the value of attribute purchase_amount_bonus.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def purchase_amount_bonus @purchase_amount_bonus end |
#purchase_amount_total ⇒ Object
Returns the value of attribute purchase_amount_total.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def purchase_amount_total @purchase_amount_total end |
#purchase_currency ⇒ Object
Returns the value of attribute purchase_currency.
366 367 368 |
# File 'lib/eme/billing.rb', line 366 def purchase_currency @purchase_currency end |
Instance Method Details
#bonus ⇒ Object
398 399 400 401 |
# 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 ⇒ Object
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# 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 |