Class: Ingenico::Connect::SDK::Domain::Payment::LineItem

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

new_from_hash

Instance Attribute Details

#amount_of_moneyObject



18
19
20
# File 'lib/ingenico/connect/sdk/domain/payment/line_item.rb', line 18

def amount_of_money
  @amount_of_money
end

#invoice_dataObject



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

def invoice_data
  @invoice_data
end

#level3_interchange_informationObject



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

def level3_interchange_information
  @level3_interchange_information
end

#order_line_detailsObject



29
30
31
# File 'lib/ingenico/connect/sdk/domain/payment/line_item.rb', line 29

def order_line_details
  @order_line_details
end

Instance Method Details

#from_hash(hash) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ingenico/connect/sdk/domain/payment/line_item.rb', line 40

def from_hash(hash)
  super
  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?('invoiceData')
    if !(hash['invoiceData'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['invoiceData']]
    end
    @invoice_data = Ingenico::Connect::SDK::Domain::Payment::LineItemInvoiceData.new_from_hash(hash['invoiceData'])
  end
  if hash.has_key?('level3InterchangeInformation')
    if !(hash['level3InterchangeInformation'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['level3InterchangeInformation']]
    end
    @level3_interchange_information = Ingenico::Connect::SDK::Domain::Payment::LineItemLevel3InterchangeInformation.new_from_hash(hash['level3InterchangeInformation'])
  end
  if hash.has_key?('orderLineDetails')
    if !(hash['orderLineDetails'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['orderLineDetails']]
    end
    @order_line_details = Ingenico::Connect::SDK::Domain::Payment::OrderLineDetails.new_from_hash(hash['orderLineDetails'])
  end
end

#to_hObject



31
32
33
34
35
36
37
38
# File 'lib/ingenico/connect/sdk/domain/payment/line_item.rb', line 31

def to_h
  hash = super
  add_to_hash(hash, 'amountOfMoney', @amount_of_money)
  add_to_hash(hash, 'invoiceData', @invoice_data)
  add_to_hash(hash, 'level3InterchangeInformation', @level3_interchange_information)
  add_to_hash(hash, 'orderLineDetails', @order_line_details)
  hash
end