Class: OnlinePayments::SDK::Domain::Surcharge
- Inherits:
-
OnlinePayments::SDK::DataObject
- Object
- OnlinePayments::SDK::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 OnlinePayments::SDK::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
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 37 def from_hash(hash) super if hash.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 @payment_product_id = hash['paymentProductId'] if hash.key? 'paymentProductId' @result = hash['result'] if hash.key? 'result' if hash.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.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.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
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/onlinepayments/sdk/domain/surcharge.rb', line 26 def to_h hash = super hash['netAmount'] = @net_amount.to_h if @net_amount hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil? hash['result'] = @result unless @result.nil? hash['surchargeAmount'] = @surcharge_amount.to_h if @surcharge_amount hash['surchargeRate'] = @surcharge_rate.to_h if @surcharge_rate hash['totalAmount'] = @total_amount.to_h if @total_amount hash end |