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



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

def additional_input
  @additional_input
end

#amount_of_moneyObject



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

def amount_of_money
  @amount_of_money
end

#customerObject



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

def customer
  @customer
end

#itemsObject

Array of LineItem

Deprecated; Use ShoppingCart.items instead



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

def items
  @items
end

#referencesObject



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

def references
  @references
end

#sellerObject



38
39
40
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 38

def seller
  @seller
end

#shopping_cartObject



41
42
43
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 41

def shopping_cart
  @shopping_cart
end

Instance Method Details

#from_hash(hash) ⇒ Object



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
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 55

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?('seller')
    if !(hash['seller'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['seller']]
    end
    @seller = Ingenico::Connect::SDK::Domain::Payment::Seller.new_from_hash(hash['seller'])
  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



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ingenico/connect/sdk/domain/payment/order.rb', line 43

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, 'seller', @seller)
  add_to_hash(hash, 'shoppingCart', @shopping_cart)
  hash
end