Class: OnlinePayments::SDK::Domain::PaymentProduct

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/payment_product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#accounts_on_fileArray<OnlinePayments::SDK::Domain::AccountOnFile>

Returns the current value of accounts_on_file.

Returns:



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def accounts_on_file
  @accounts_on_file
end

#allows_authenticationtrue/false

Returns the current value of allows_authentication.

Returns:

  • (true/false)

    the current value of allows_authentication



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def allows_authentication
  @allows_authentication
end

#allows_recurringtrue/false

Returns the current value of allows_recurring.

Returns:

  • (true/false)

    the current value of allows_recurring



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def allows_recurring
  @allows_recurring
end

#allows_tokenizationtrue/false

Returns the current value of allows_tokenization.

Returns:

  • (true/false)

    the current value of allows_tokenization



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def allows_tokenization
  @allows_tokenization
end

#display_hintsOnlinePayments::SDK::Domain::PaymentProductDisplayHints

Returns the current value of display_hints.

Returns:



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def display_hints
  @display_hints
end

#display_hints_listArray<OnlinePayments::SDK::Domain::PaymentProductDisplayHints>

Returns the current value of display_hints_list.

Returns:



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def display_hints_list
  @display_hints_list
end

#fieldsArray<OnlinePayments::SDK::Domain::PaymentProductField>

Returns the current value of fields.

Returns:



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def fields
  @fields
end

#idInteger

Returns the current value of id.

Returns:

  • (Integer)

    the current value of id



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def id
  @id
end

#payment_methodString

Returns the current value of payment_method.

Returns:

  • (String)

    the current value of payment_method



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def payment_method
  @payment_method
end

#payment_product302_specific_dataOnlinePayments::SDK::Domain::PaymentProduct302SpecificData

Returns the current value of payment_product302_specific_data.

Returns:



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def payment_product302_specific_data
  @payment_product302_specific_data
end

#payment_product320_specific_dataOnlinePayments::SDK::Domain::PaymentProduct320SpecificData

Returns the current value of payment_product320_specific_data.

Returns:



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def payment_product320_specific_data
  @payment_product320_specific_data
end

#payment_product_groupString

Returns the current value of payment_product_group.

Returns:

  • (String)

    the current value of payment_product_group



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def payment_product_group
  @payment_product_group
end

#uses_redirection_to3rd_partytrue/false

Returns the current value of uses_redirection_to3rd_party.

Returns:

  • (true/false)

    the current value of uses_redirection_to3rd_party



27
28
29
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 27

def uses_redirection_to3rd_party
  @uses_redirection_to3rd_party
end

Instance Method Details

#from_hash(hash) ⇒ Object



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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 74

def from_hash(hash)
  super
  if hash.has_key? 'accountsOnFile'
    raise TypeError, "value '%s' is not an Array" % [hash['accountsOnFile']] unless hash['accountsOnFile'].is_a? Array
    @accounts_on_file = []
    hash['accountsOnFile'].each do |e|
      @accounts_on_file << OnlinePayments::SDK::Domain::AccountOnFile.new_from_hash(e)
    end
  end
  if hash.has_key? 'allowsAuthentication'
    @allows_authentication = hash['allowsAuthentication']
  end
  if hash.has_key? 'allowsRecurring'
    @allows_recurring = hash['allowsRecurring']
  end
  if hash.has_key? 'allowsTokenization'
    @allows_tokenization = hash['allowsTokenization']
  end
  if hash.has_key? 'displayHints'
    raise TypeError, "value '%s' is not a Hash" % [hash['displayHints']] unless hash['displayHints'].is_a? Hash
    @display_hints = OnlinePayments::SDK::Domain::PaymentProductDisplayHints.new_from_hash(hash['displayHints'])
  end
  if hash.has_key? 'displayHintsList'
    raise TypeError, "value '%s' is not an Array" % [hash['displayHintsList']] unless hash['displayHintsList'].is_a? Array
    @display_hints_list = []
    hash['displayHintsList'].each do |e|
      @display_hints_list << OnlinePayments::SDK::Domain::PaymentProductDisplayHints.new_from_hash(e)
    end
  end
  if hash.has_key? 'fields'
    raise TypeError, "value '%s' is not an Array" % [hash['fields']] unless hash['fields'].is_a? Array
    @fields = []
    hash['fields'].each do |e|
      @fields << OnlinePayments::SDK::Domain::PaymentProductField.new_from_hash(e)
    end
  end
  if hash.has_key? 'id'
    @id = hash['id']
  end
  if hash.has_key? 'paymentMethod'
    @payment_method = hash['paymentMethod']
  end
  if hash.has_key? 'paymentProduct302SpecificData'
    raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct302SpecificData']] unless hash['paymentProduct302SpecificData'].is_a? Hash
    @payment_product302_specific_data = OnlinePayments::SDK::Domain::PaymentProduct302SpecificData.new_from_hash(hash['paymentProduct302SpecificData'])
  end
  if hash.has_key? 'paymentProduct320SpecificData'
    raise TypeError, "value '%s' is not a Hash" % [hash['paymentProduct320SpecificData']] unless hash['paymentProduct320SpecificData'].is_a? Hash
    @payment_product320_specific_data = OnlinePayments::SDK::Domain::PaymentProduct320SpecificData.new_from_hash(hash['paymentProduct320SpecificData'])
  end
  if hash.has_key? 'paymentProductGroup'
    @payment_product_group = hash['paymentProductGroup']
  end
  if hash.has_key? 'usesRedirectionTo3rdParty'
    @uses_redirection_to3rd_party = hash['usesRedirectionTo3rdParty']
  end
end

#to_hHash

Returns:

  • (Hash)


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 56

def to_h
  hash = super
  hash['accountsOnFile'] = @accounts_on_file.collect{|val| val.to_h} unless @accounts_on_file.nil?
  hash['allowsAuthentication'] = @allows_authentication unless @allows_authentication.nil?
  hash['allowsRecurring'] = @allows_recurring unless @allows_recurring.nil?
  hash['allowsTokenization'] = @allows_tokenization unless @allows_tokenization.nil?
  hash['displayHints'] = @display_hints.to_h unless @display_hints.nil?
  hash['displayHintsList'] = @display_hints_list.collect{|val| val.to_h} unless @display_hints_list.nil?
  hash['fields'] = @fields.collect{|val| val.to_h} unless @fields.nil?
  hash['id'] = @id unless @id.nil?
  hash['paymentMethod'] = @payment_method unless @payment_method.nil?
  hash['paymentProduct302SpecificData'] = @payment_product302_specific_data.to_h unless @payment_product302_specific_data.nil?
  hash['paymentProduct320SpecificData'] = @payment_product320_specific_data.to_h unless @payment_product320_specific_data.nil?
  hash['paymentProductGroup'] = @payment_product_group unless @payment_product_group.nil?
  hash['usesRedirectionTo3rdParty'] = @uses_redirection_to3rd_party unless @uses_redirection_to3rd_party.nil?
  hash
end