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

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/payment_product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

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

Returns the current value of accounts_on_file.

Returns:



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

def accounts_on_file
  @accounts_on_file
end

#allows_recurringtrue/false

Returns the current value of allows_recurring.

Returns:

  • (true/false)

    the current value of allows_recurring



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

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



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

def allows_tokenization
  @allows_tokenization
end

#display_hintsOnlinePayments::SDK::Domain::PaymentProductDisplayHints

Returns the current value of display_hints.

Returns:



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

def display_hints
  @display_hints
end

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

Returns the current value of display_hints_list.

Returns:



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

def display_hints_list
  @display_hints_list
end

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

Returns the current value of fields.

Returns:



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

def fields
  @fields
end

#idInteger

Returns the current value of id.

Returns:

  • (Integer)

    the current value of id



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

def id
  @id
end

#payment_methodString

Returns the current value of payment_method.

Returns:

  • (String)

    the current value of payment_method



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

def payment_method
  @payment_method
end

#payment_product302_specific_dataOnlinePayments::SDK::Domain::PaymentProduct302SpecificData

Returns the current value of payment_product302_specific_data.

Returns:



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

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:



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

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



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

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



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

def uses_redirection_to3rd_party
  @uses_redirection_to3rd_party
end

Instance Method Details

#from_hash(hash) ⇒ Object



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
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 58

def from_hash(hash)
  super
  if hash.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
  @allows_recurring = hash['allowsRecurring'] if hash.key? 'allowsRecurring'
  @allows_tokenization = hash['allowsTokenization'] if hash.key? 'allowsTokenization'
  if hash.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.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.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
  @id = hash['id'] if hash.key? 'id'
  @payment_method = hash['paymentMethod'] if hash.key? 'paymentMethod'
  if hash.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.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
  @payment_product_group = hash['paymentProductGroup'] if hash.key? 'paymentProductGroup'
  @uses_redirection_to3rd_party = hash['usesRedirectionTo3rdParty'] if hash.key? 'usesRedirectionTo3rdParty'
end

#to_hHash

Returns:

  • (Hash)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/onlinepayments/sdk/domain/payment_product.rb', line 41

def to_h
  hash = super
  hash['accountsOnFile'] = @accounts_on_file.collect(&:to_h) if @accounts_on_file
  hash['allowsRecurring'] = @allows_recurring unless @allows_recurring.nil?
  hash['allowsTokenization'] = @allows_tokenization unless @allows_tokenization.nil?
  hash['displayHints'] = @display_hints.to_h if @display_hints
  hash['displayHintsList'] = @display_hints_list.collect(&:to_h) if @display_hints_list
  hash['fields'] = @fields.collect(&:to_h) if @fields
  hash['id'] = @id unless @id.nil?
  hash['paymentMethod'] = @payment_method unless @payment_method.nil?
  hash['paymentProduct302SpecificData'] = @payment_product302_specific_data.to_h if @payment_product302_specific_data
  hash['paymentProduct320SpecificData'] = @payment_product320_specific_data.to_h if @payment_product320_specific_data
  hash['paymentProductGroup'] = @payment_product_group unless @payment_product_group.nil?
  hash['usesRedirectionTo3rdParty'] = @uses_redirection_to3rd_party unless @uses_redirection_to3rd_party.nil?
  hash
end