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
Instance Attribute Summary collapse
- #additional_input ⇒ Object
- #amount_of_money ⇒ Object
- #customer ⇒ Object
-
#items ⇒ Object
Array of LineItem.
- #references ⇒ Object
- #shopping_cart ⇒ 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
Deprecated; Use ShoppingCart.items instead
31 32 33 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 31 def items @items end |
#references ⇒ Object
34 35 36 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 34 def references @references end |
#shopping_cart ⇒ Object
37 38 39 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 37 def shopping_cart @shopping_cart end |
Instance Method Details
#from_hash(hash) ⇒ Object
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 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 50 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 if hash.has_key?('shoppingCart') if !(hash['shoppingCart'].is_a? Hash) raise TypeError, "value '%s' is not a Hash" % [hash['shoppingCart']] end @shopping_cart = Ingenico::Connect::SDK::Domain::Payment::ShoppingCart.new_from_hash(hash['shoppingCart']) end end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 39 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) add_to_hash(hash, 'shoppingCart', @shopping_cart) hash end |