Class: Ingenico::Connect::SDK::Domain::Payment::Order
- Inherits:
-
Ingenico::Connect::SDK::DataObject
- Object
- Ingenico::Connect::SDK::DataObject
- Ingenico::Connect::SDK::Domain::Payment::Order
- Defined in:
- lib/ingenico/connect/sdk/domain/payment/order.rb
Overview
Class Order
Instance Attribute Summary collapse
- #additional_input ⇒ Object
- #amount_of_money ⇒ Object
- #customer ⇒ Object
-
#items ⇒ Object
Array of LineItem.
- #references ⇒ Object
Instance Method Summary collapse
Methods inherited from Ingenico::Connect::SDK::DataObject
Instance Attribute Details
#additional_input ⇒ Object
20 21 22 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 20 def additional_input @additional_input end |
#amount_of_money ⇒ Object
23 24 25 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 23 def amount_of_money @amount_of_money end |
#customer ⇒ Object
26 27 28 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 26 def customer @customer end |
#items ⇒ Object
Array of LineItem
29 30 31 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 29 def items @items end |
#references ⇒ Object
32 33 34 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 32 def references @references end |
Instance Method Details
#from_hash(hash) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 44 def from_hash(hash) super if hash.has_key?('additionalInput') if !(hash['additionalInput'].is_a? Hash) raise TypeError, "value '%s' is not a Hash" % [hash['additionalInput']] end @additional_input = Ingenico::Connect::SDK::Domain::Payment::AdditionalOrderInput.new_from_hash(hash['additionalInput']) end if hash.has_key?('amountOfMoney') if !(hash['amountOfMoney'].is_a? Hash) raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] end @amount_of_money = Ingenico::Connect::SDK::Domain::Definitions::AmountOfMoney.new_from_hash(hash['amountOfMoney']) end if hash.has_key?('customer') if !(hash['customer'].is_a? Hash) raise TypeError, "value '%s' is not a Hash" % [hash['customer']] end @customer = Ingenico::Connect::SDK::Domain::Payment::Customer.new_from_hash(hash['customer']) end if hash.has_key?('items') if !(hash['items'].is_a? Array) raise TypeError, "value '%s' is not an Array" % [hash['items']] end @items = [] hash['items'].each do |e| @items << Ingenico::Connect::SDK::Domain::Payment::LineItem.new_from_hash(e) end end if hash.has_key?('references') if !(hash['references'].is_a? Hash) raise TypeError, "value '%s' is not a Hash" % [hash['references']] end @references = Ingenico::Connect::SDK::Domain::Payment::OrderReferences.new_from_hash(hash['references']) end end |
#to_h ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 34 def to_h hash = super add_to_hash(hash, 'additionalInput', @additional_input) add_to_hash(hash, 'amountOfMoney', @amount_of_money) add_to_hash(hash, 'customer', @customer) add_to_hash(hash, 'items', @items) add_to_hash(hash, 'references', @references) hash end |