Class: OnlinePayments::SDK::Domain::Surcharge
- Inherits:
-
DataObject
- Object
- DataObject
- OnlinePayments::SDK::Domain::Surcharge
- Defined in:
- lib/onlinepayments/sdk/domain/surcharge.rb
Instance Attribute Summary collapse
-
#net_amount ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
The current value of net_amount.
-
#payment_product_id ⇒ Integer
The current value of payment_product_id.
-
#result ⇒ String
The current value of result.
-
#surcharge_amount ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
The current value of surcharge_amount.
-
#surcharge_rate ⇒ OnlinePayments::SDK::Domain::SurchargeRate
The current value of surcharge_rate.
-
#total_amount ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
The current value of total_amount.
Instance Method Summary collapse
Methods inherited from DataObject
Instance Attribute Details
#net_amount ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
Returns the current value of net_amount.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 17 def net_amount @net_amount end |
#payment_product_id ⇒ Integer
Returns the current value of payment_product_id.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 17 def payment_product_id @payment_product_id end |
#result ⇒ String
Returns the current value of result.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 17 def result @result end |
#surcharge_amount ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
Returns the current value of surcharge_amount.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 17 def surcharge_amount @surcharge_amount end |
#surcharge_rate ⇒ OnlinePayments::SDK::Domain::SurchargeRate
Returns the current value of surcharge_rate.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 17 def surcharge_rate @surcharge_rate end |
#total_amount ⇒ OnlinePayments::SDK::Domain::AmountOfMoney
Returns the current value of total_amount.
17 18 19 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 17 def total_amount @total_amount end |
Instance Method Details
#from_hash(hash) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 43 def from_hash(hash) super if hash.has_key? 'netAmount' raise TypeError, "value '%s' is not a Hash" % [hash['netAmount']] unless hash['netAmount'].is_a? Hash @net_amount = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['netAmount']) end if hash.has_key? 'paymentProductId' @payment_product_id = hash['paymentProductId'] end if hash.has_key? 'result' @result = hash['result'] end if hash.has_key? 'surchargeAmount' raise TypeError, "value '%s' is not a Hash" % [hash['surchargeAmount']] unless hash['surchargeAmount'].is_a? Hash @surcharge_amount = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['surchargeAmount']) end if hash.has_key? 'surchargeRate' raise TypeError, "value '%s' is not a Hash" % [hash['surchargeRate']] unless hash['surchargeRate'].is_a? Hash @surcharge_rate = OnlinePayments::SDK::Domain::SurchargeRate.new_from_hash(hash['surchargeRate']) end if hash.has_key? 'totalAmount' raise TypeError, "value '%s' is not a Hash" % [hash['totalAmount']] unless hash['totalAmount'].is_a? Hash @total_amount = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['totalAmount']) end end |
#to_h ⇒ Hash
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 32 def to_h hash = super hash['netAmount'] = @net_amount.to_h unless @net_amount.nil? hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil? hash['result'] = @result unless @result.nil? hash['surchargeAmount'] = @surcharge_amount.to_h unless @surcharge_amount.nil? hash['surchargeRate'] = @surcharge_rate.to_h unless @surcharge_rate.nil? hash['totalAmount'] = @total_amount.to_h unless @total_amount.nil? hash end |