Class: Ingenico::Connect::SDK::Domain::Payment::Order

Inherits:
Ingenico::Connect::SDK::DataObject show all
Defined in:
lib/ingenico/connect/sdk/domain/payment/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ingenico::Connect::SDK::DataObject

new_from_hash

Instance Attribute Details

#additional_inputObject



20
21
22
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 20

def additional_input
  @additional_input
end

#amount_of_moneyObject



23
24
25
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 23

def amount_of_money
  @amount_of_money
end

#customerObject



26
27
28
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 26

def customer
  @customer
end

#itemsObject

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

#referencesObject



34
35
36
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 34

def references
  @references
end

#shopping_cartObject



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_hObject



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