Class: Ingenico::Connect::SDK::Domain::Payment::ApprovePaymentRequest

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

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

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

new_from_hash

Instance Attribute Details

#amountObject

Integer



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

def amount
  @amount
end

#direct_debit_payment_method_specific_inputObject



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

def direct_debit_payment_method_specific_input
  @direct_debit_payment_method_specific_input
end

#orderObject



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

def order
  @order
end

#sepa_direct_debit_payment_method_specific_inputObject



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

def sepa_direct_debit_payment_method_specific_input
  @sepa_direct_debit_payment_method_specific_input
end

Instance Method Details

#from_hash(hash) ⇒ Object



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

def from_hash(hash)
  super
  if hash.has_key?('amount')
    @amount = hash['amount']
  end
  if hash.has_key?('directDebitPaymentMethodSpecificInput')
    if !(hash['directDebitPaymentMethodSpecificInput'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['directDebitPaymentMethodSpecificInput']]
    end
    @direct_debit_payment_method_specific_input = Ingenico::Connect::SDK::Domain::Payment::ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput.new_from_hash(hash['directDebitPaymentMethodSpecificInput'])
  end
  if hash.has_key?('order')
    if !(hash['order'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['order']]
    end
    @order = Ingenico::Connect::SDK::Domain::Payment::OrderApprovePayment.new_from_hash(hash['order'])
  end
  if hash.has_key?('sepaDirectDebitPaymentMethodSpecificInput')
    if !(hash['sepaDirectDebitPaymentMethodSpecificInput'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['sepaDirectDebitPaymentMethodSpecificInput']]
    end
    @sepa_direct_debit_payment_method_specific_input = Ingenico::Connect::SDK::Domain::Payment::ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput.new_from_hash(hash['sepaDirectDebitPaymentMethodSpecificInput'])
  end
end

#to_hObject



29
30
31
32
33
34
35
36
# File 'lib/ingenico/connect/sdk/domain/payment/approve_payment_request.rb', line 29

def to_h
  hash = super
  add_to_hash(hash, 'amount', @amount)
  add_to_hash(hash, 'directDebitPaymentMethodSpecificInput', @direct_debit_payment_method_specific_input)
  add_to_hash(hash, 'order', @order)
  add_to_hash(hash, 'sepaDirectDebitPaymentMethodSpecificInput', @sepa_direct_debit_payment_method_specific_input)
  hash
end