Class: Google4R::Checkout::ChargeFee

Inherits:
Object
  • Object
show all
Defined in:
lib/google4r/checkout/shared.rb

Overview

ChargeFee instances are used in the ChargeAmountNotifications

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#flatObject

The flat portion of the fee (Money)



1272
1273
1274
# File 'lib/google4r/checkout/shared.rb', line 1272

def flat
  @flat
end

#percentageObject

The percentage of the transaction value (Float)



1275
1276
1277
# File 'lib/google4r/checkout/shared.rb', line 1275

def percentage
  @percentage
end

#totalObject

The total fee (Money)



1278
1279
1280
# File 'lib/google4r/checkout/shared.rb', line 1278

def total
  @total
end

Class Method Details

.create_from_element(element) ⇒ Object



1280
1281
1282
1283
1284
1285
1286
# File 'lib/google4r/checkout/shared.rb', line 1280

def self.create_from_element(element)
  result = ChargeFee.new
  result.flat = Money.new(element.elements['flat'].text.to_f * 100, nil)
  result.percentage = element.elements['percentage'].text.to_f
  result.total = Money.new(element.elements['total'].text.to_f * 100, nil)
  result
end