Class: CyberSourceMergedSpec::RecipientInformation3

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/recipient_information3.rb

Overview

RecipientInformation3 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(first_name: SKIP, middle_name: SKIP, last_name: SKIP, address1: SKIP, locality: SKIP, administrative_area: SKIP, country: SKIP, postal_code: SKIP, phone_number: SKIP, alias_name: SKIP, nationality: SKIP, country_of_birth: SKIP, occupation: SKIP, email: SKIP, additional_properties: nil) ⇒ RecipientInformation3

Returns a new instance of RecipientInformation3.



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 141

def initialize(first_name: SKIP, middle_name: SKIP, last_name: SKIP,
               address1: SKIP, locality: SKIP, administrative_area: SKIP,
               country: SKIP, postal_code: SKIP, phone_number: SKIP,
               alias_name: SKIP, nationality: SKIP, country_of_birth: SKIP,
               occupation: SKIP, email: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @first_name = first_name unless first_name == SKIP
  @middle_name = middle_name unless middle_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @address1 = address1 unless address1 == SKIP
  @locality = locality unless locality == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  @country = country unless country == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @alias_name = alias_name unless alias_name == SKIP
  @nationality = nationality unless nationality == SKIP
  @country_of_birth = country_of_birth unless country_of_birth == SKIP
  @occupation = occupation unless occupation == SKIP
  @email = email unless email == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address1String

The street address of the recipient This field is applicable for AFT and OCT transactions. Only alpha numeric values are supported. Special characters not in the standard ASCII character set are not supported and will be stripped before being sent to sent to the processor.

Returns:

  • (String)


42
43
44
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 42

def address1
  @address1
end

#administrative_areaString

The state or province of the recipient. This field is applicable for AFT and OCT transactions when the recipient country is US or CA. Else it is optional. Must be a two character value

Returns:

  • (String)


57
58
59
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 57

def administrative_area
  @administrative_area
end

#alias_nameString

Account owner alias name.

Returns:

  • (String)


78
79
80
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 78

def alias_name
  @alias_name
end

#countryString

The country associated with the address of the recipient. This field is applicable for AFT and OCT transactions. Must be a two character ISO country code. For example, see [ISO Country Code](https://developer.cybersource.com/docs/cybs/en-us/country-codes/refe rence/all/na/country-codes/country-codes.html)

Returns:

  • (String)


66
67
68
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 66

def country
  @country
end

#country_of_birthString

Account Owner Country of Birth

Returns:

  • (String)


86
87
88
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 86

def country_of_birth
  @country_of_birth
end

#emailString

Account Owner email address

Returns:

  • (String)


94
95
96
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 94

def email
  @email
end

#first_nameString

First name of the recipient.
This field is applicable for AFT & OCT transactions. Only alpha numeric values are supported. Special characters not in the standard ASCII character set, are not supported and will be stripped before being sent to sent to the processor.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 18

def first_name
  @first_name
end

#last_nameString

Last name of the recipient. This field is applicable for AFT & OCT transactions. Only alpha numeric values are supported. Special characters not in the standard ASCII character set, are not supported and will be stripped before being sent to sent to the processor.

Returns:

  • (String)


34
35
36
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 34

def last_name
  @last_name
end

#localityString

The city of the recipient. This field is applicable for AFT and OCT transactions. Only alpha numeric values are supported. Special characters not in the standard ASCII character set are not supported and will be stripped before being sent to sent to the processor.

Returns:

  • (String)


50
51
52
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 50

def locality
  @locality
end

#middle_nameString

Middle name of the recipient.
This field is applicable for AFT & OCT transactions. Only alpha numeric values are supported. Special characters not in the standard ASCII character set, are not supported and will be stripped before being sent to sent to the processor.

Returns:

  • (String)


26
27
28
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 26

def middle_name
  @middle_name
end

#nationalityString

Account Owner Nationality

Returns:

  • (String)


82
83
84
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 82

def nationality
  @nationality
end

#occupationString

Account Owner Occupation

Returns:

  • (String)


90
91
92
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 90

def occupation
  @occupation
end

#phone_numberString

Recipient phone number. Required only for FDCCompass.

Returns:

  • (String)


74
75
76
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 74

def phone_number
  @phone_number
end

#postal_codeString

Recipient postal code. Required only for FDCCompass.

Returns:

  • (String)


70
71
72
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 70

def postal_code
  @postal_code
end

Class Method Details

.from_element(root) ⇒ Object



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 213

def self.from_element(root)
  first_name = XmlUtilities.from_element(root, 'firstName', String)
  middle_name = XmlUtilities.from_element(root, 'middleName', String)
  last_name = XmlUtilities.from_element(root, 'lastName', String)
  address1 = XmlUtilities.from_element(root, 'address1', String)
  locality = XmlUtilities.from_element(root, 'locality', String)
  administrative_area = XmlUtilities.from_element(root,
                                                  'administrativeArea',
                                                  String)
  country = XmlUtilities.from_element(root, 'country', String)
  postal_code = XmlUtilities.from_element(root, 'postalCode', String)
  phone_number = XmlUtilities.from_element(root, 'phoneNumber', String)
  alias_name = XmlUtilities.from_element(root, 'aliasName', String)
  nationality = XmlUtilities.from_element(root, 'nationality', String)
  country_of_birth = XmlUtilities.from_element(root, 'countryOfBirth',
                                               String)
  occupation = XmlUtilities.from_element(root, 'occupation', String)
  email = XmlUtilities.from_element(root, 'email', String)

  new(first_name: first_name,
      middle_name: middle_name,
      last_name: last_name,
      address1: address1,
      locality: locality,
      administrative_area: administrative_area,
      country: country,
      postal_code: postal_code,
      phone_number: phone_number,
      alias_name: alias_name,
      nationality: nationality,
      country_of_birth: country_of_birth,
      occupation: occupation,
      email: email,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 167

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  middle_name = hash.key?('middleName') ? hash['middleName'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  address1 = hash.key?('address1') ? hash['address1'] : SKIP
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : SKIP
  alias_name = hash.key?('aliasName') ? hash['aliasName'] : SKIP
  nationality = hash.key?('nationality') ? hash['nationality'] : SKIP
  country_of_birth =
    hash.key?('countryOfBirth') ? hash['countryOfBirth'] : SKIP
  occupation = hash.key?('occupation') ? hash['occupation'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP

  # 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.
  RecipientInformation3.new(first_name: first_name,
                            middle_name: middle_name,
                            last_name: last_name,
                            address1: address1,
                            locality: locality,
                            administrative_area: administrative_area,
                            country: country,
                            postal_code: postal_code,
                            phone_number: phone_number,
                            alias_name: alias_name,
                            nationality: nationality,
                            country_of_birth: country_of_birth,
                            occupation: occupation,
                            email: email,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 97

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['first_name'] = 'firstName'
  @_hash['middle_name'] = 'middleName'
  @_hash['last_name'] = 'lastName'
  @_hash['address1'] = 'address1'
  @_hash['locality'] = 'locality'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['country'] = 'country'
  @_hash['postal_code'] = 'postalCode'
  @_hash['phone_number'] = 'phoneNumber'
  @_hash['alias_name'] = 'aliasName'
  @_hash['nationality'] = 'nationality'
  @_hash['country_of_birth'] = 'countryOfBirth'
  @_hash['occupation'] = 'occupation'
  @_hash['email'] = 'email'
  @_hash
end

.nullablesObject

An array for nullable fields



137
138
139
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 137

def self.nullables
  []
end

.optionalsObject

An array for optional fields



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 117

def self.optionals
  %w[
    first_name
    middle_name
    last_name
    address1
    locality
    administrative_area
    country
    postal_code
    phone_number
    alias_name
    nationality
    country_of_birth
    occupation
    email
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



286
287
288
289
290
291
292
293
294
295
296
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 286

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name.inspect}, middle_name: #{@middle_name.inspect},"\
  " last_name: #{@last_name.inspect}, address1: #{@address1.inspect}, locality:"\
  " #{@locality.inspect}, administrative_area: #{@administrative_area.inspect}, country:"\
  " #{@country.inspect}, postal_code: #{@postal_code.inspect}, phone_number:"\
  " #{@phone_number.inspect}, alias_name: #{@alias_name.inspect}, nationality:"\
  " #{@nationality.inspect}, country_of_birth: #{@country_of_birth.inspect}, occupation:"\
  " #{@occupation.inspect}, email: #{@email.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



275
276
277
278
279
280
281
282
283
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 275

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name}, middle_name: #{@middle_name}, last_name:"\
  " #{@last_name}, address1: #{@address1}, locality: #{@locality}, administrative_area:"\
  " #{@administrative_area}, country: #{@country}, postal_code: #{@postal_code}, phone_number:"\
  " #{@phone_number}, alias_name: #{@alias_name}, nationality: #{@nationality},"\
  " country_of_birth: #{@country_of_birth}, occupation: #{@occupation}, email: #{@email},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/cyber_source_merged_spec/models/recipient_information3.rb', line 249

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'firstName', first_name)
  XmlUtilities.add_as_subelement(doc, root, 'middleName', middle_name)
  XmlUtilities.add_as_subelement(doc, root, 'lastName', last_name)
  XmlUtilities.add_as_subelement(doc, root, 'address1', address1)
  XmlUtilities.add_as_subelement(doc, root, 'locality', locality)
  XmlUtilities.add_as_subelement(doc, root, 'administrativeArea',
                                 administrative_area)
  XmlUtilities.add_as_subelement(doc, root, 'country', country)
  XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code)
  XmlUtilities.add_as_subelement(doc, root, 'phoneNumber', phone_number)
  XmlUtilities.add_as_subelement(doc, root, 'aliasName', alias_name)
  XmlUtilities.add_as_subelement(doc, root, 'nationality', nationality)
  XmlUtilities.add_as_subelement(doc, root, 'countryOfBirth',
                                 country_of_birth)
  XmlUtilities.add_as_subelement(doc, root, 'occupation', occupation)
  XmlUtilities.add_as_subelement(doc, root, 'email', email)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end