Class: VisaAcceptanceMergedSpec::BuyerInformation9

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/buyer_information9.rb

Overview

BuyerInformation9 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(date_of_birth: SKIP, gender: SKIP, language: SKIP, note_to_seller: SKIP, personal_identification: SKIP, additional_properties: nil) ⇒ BuyerInformation9

Returns a new instance of BuyerInformation9.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 67

def initialize(date_of_birth: SKIP, gender: SKIP, language: SKIP,
               note_to_seller: SKIP, personal_identification: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @gender = gender unless gender == SKIP
  @language = language unless language == SKIP
  @note_to_seller = note_to_seller unless note_to_seller == SKIP
  @personal_identification = personal_identification unless personal_identification == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#date_of_birthString

Recipient’s date of birth. Format: YYYYMMDD. This field is a pass-through, which means that Visa Acceptance ensures that the value is eight numeric characters but otherwise does not verify the value or modify it in any way before sending it to the processor. If the field is not required for the transaction, Visa Acceptance does not forward it to the processor.

Returns:

  • (String)


20
21
22
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 20

def date_of_birth
  @date_of_birth
end

#genderString

Customer's gender. Possible values are F (female), M (male),O (other).

Returns:

  • (String)


24
25
26
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 24

def gender
  @gender
end

#languageString

language setting of the user. Supports 2-character language codes (e.g., en, fr) and 5-character locale values (e.g., en-US, fr-CA).

Returns:

  • (String)


30
31
32
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 30

def language
  @language
end

#note_to_sellerString

Note to the recipient of the funds in this transaction

Returns:

  • (String)


34
35
36
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 34

def note_to_seller
  @note_to_seller
end

#personal_identificationArray[PersonalIdentification2]

Note to the recipient of the funds in this transaction

Returns:



38
39
40
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 38

def personal_identification
  @personal_identification
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  date_of_birth = hash.key?('dateOfBirth') ? hash['dateOfBirth'] : SKIP
  gender = hash.key?('gender') ? hash['gender'] : SKIP
  language = hash.key?('language') ? hash['language'] : SKIP
  note_to_seller = hash.key?('noteToSeller') ? hash['noteToSeller'] : SKIP
  # Parameter is an array, so we need to iterate through it
  personal_identification = nil
  unless hash['personalIdentification'].nil?
    personal_identification = []
    hash['personalIdentification'].each do |structure|
      personal_identification << (PersonalIdentification2.from_hash(structure) if structure)
    end
  end

  personal_identification = SKIP unless hash.key?('personalIdentification')

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  BuyerInformation9.new(date_of_birth: date_of_birth,
                        gender: gender,
                        language: language,
                        note_to_seller: note_to_seller,
                        personal_identification: personal_identification,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['date_of_birth'] = 'dateOfBirth'
  @_hash['gender'] = 'gender'
  @_hash['language'] = 'language'
  @_hash['note_to_seller'] = 'noteToSeller'
  @_hash['personal_identification'] = 'personalIdentification'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 52

def self.optionals
  %w[
    date_of_birth
    gender
    language
    note_to_seller
    personal_identification
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
132
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} date_of_birth: #{@date_of_birth.inspect}, gender: #{@gender.inspect},"\
  " language: #{@language.inspect}, note_to_seller: #{@note_to_seller.inspect},"\
  " personal_identification: #{@personal_identification.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



118
119
120
121
122
123
# File 'lib/visa_acceptance_merged_spec/models/buyer_information9.rb', line 118

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} date_of_birth: #{@date_of_birth}, gender: #{@gender}, language:"\
  " #{@language}, note_to_seller: #{@note_to_seller}, personal_identification:"\
  " #{@personal_identification}, additional_properties: #{@additional_properties}>"
end