Class: CyberSourceMergedSpec::RecipientInformation

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

Overview

RecipientInformation 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(account_id: SKIP, account_type: SKIP, first_name: SKIP, middle_name: SKIP, last_name: SKIP, address1: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, date_of_birth: SKIP, beneficiary_id: SKIP, beneficiary_name: SKIP, beneficiary_address: SKIP, alias_name: SKIP, nationality: SKIP, country_of_birth: SKIP, occupation: SKIP, email: SKIP, locality: SKIP, tax_id_number: SKIP, additional_properties: nil) ⇒ RecipientInformation

Returns a new instance of RecipientInformation.



206
207
208
209
210
211
212
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
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 206

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

  @account_id =  unless  == SKIP
  @account_type =  unless  == SKIP
  @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
  @administrative_area = administrative_area unless administrative_area == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @country = country unless country == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @beneficiary_id = beneficiary_id unless beneficiary_id == SKIP
  @beneficiary_name = beneficiary_name unless beneficiary_name == SKIP
  @beneficiary_address = beneficiary_address unless beneficiary_address == 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
  @locality = locality unless locality == SKIP
  @tax_id_number = tax_id_number unless tax_id_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

Identifier for the recipient’s account. This field is applicable for AFT transactions.

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 15

def 
  @account_id
end

#account_typeString

Identifies the recipient’s account type. This field is applicable for AFT transactions. Valid values are:

- `00` for Other
- `01` for Routing Transit Number (RTN) + Bank Account Number (BAN)
- `02` for International Bank Account Number (IBAN)
- `03` for Card Account
- `06` for Bank Account Number (BAN) + Bank Identification Code (BIC),

also known as a SWIFT code

Returns:

  • (String)


27
28
29
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 27

def 
  @account_type
end

#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)


59
60
61
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 59

def address1
  @address1
end

#administrative_areaString

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

Returns:

  • (String)


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

def administrative_area
  @administrative_area
end

#alias_nameString

Account owner alias name.

Returns:

  • (String)


115
116
117
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 115

def alias_name
  @alias_name
end

#beneficiary_addressString

Only for e-wallets: The ultimate beneficiary’s street address (street, zip code, city), excluding the country. Example: “Main street 1, 12345, Barcelona

Returns:

  • (String)


111
112
113
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 111

def beneficiary_address
  @beneficiary_address
end

#beneficiary_idString

Only for e-wallets: ID, username, hash or anything uniquely identifying the ultimate beneficiary.

Returns:

  • (String)


101
102
103
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 101

def beneficiary_id
  @beneficiary_id
end

#beneficiary_nameString

Only for e-wallets: The ultimate beneficiary’s full name.

Returns:

  • (String)


105
106
107
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 105

def beneficiary_name
  @beneficiary_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)


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

def country
  @country
end

#country_of_birthString

Account Owner Country of Birth

Returns:

  • (String)


123
124
125
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 123

def country_of_birth
  @country_of_birth
end

#date_of_birthString

Recipient’s date of birth. Format: YYYYMMDD. This field is a pass-through, which means that CyberSource 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, CyberSource does not forward it to the processor.

Returns:

  • (String)


96
97
98
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 96

def date_of_birth
  @date_of_birth
end

#emailString

Account Owner email address

Returns:

  • (String)


131
132
133
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 131

def email
  @email
end

#first_nameString

First name of the recipient. This field is applicable for AFT 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)


35
36
37
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 35

def first_name
  @first_name
end

#last_nameString

Last name of the recipient. This field is applicable for AFT 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)


51
52
53
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 51

def last_name
  @last_name
end

#localityString

The city of the recipient. This field is applicable for AFT 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)


139
140
141
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 139

def locality
  @locality
end

#middle_nameString

Middle name of the recipient. This field is applicable for AFT 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)


43
44
45
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 43

def middle_name
  @middle_name
end

#nationalityString

Account Owner Nationality

Returns:

  • (String)


119
120
121
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 119

def nationality
  @nationality
end

#occupationString

Account Owner Occupation

Returns:

  • (String)


127
128
129
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 127

def occupation
  @occupation
end

#postal_codeString

Partial postal code for the recipient’s address. For example, if the postal code is NN5 7SG, the value for this field should be the first part of the postal code: NN5. This field is a pass-through, which means that CyberSource 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, CyberSource does not forward it to the processor.

Returns:

  • (String)


77
78
79
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 77

def postal_code
  @postal_code
end

#tax_id_numberFloat

CPF or CNPJ of the cash-in recipient. "Cadastro de Pessoas Físicas", which translates to the "Natural Persons Register." It is the individual taxpayer registry identification number in Brazil, similar to a Social Security Number (SSN) in the United States or a National Insurance Number in the UK.

Returns:

  • (Float)


147
148
149
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 147

def tax_id_number
  @tax_id_number
end

Class Method Details

.from_element(root) ⇒ Object



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 301

def self.from_element(root)
   = XmlUtilities.from_element(root, 'accountId', String)
   = XmlUtilities.from_element(root, 'accountType', String)
  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)
  administrative_area = XmlUtilities.from_element(root,
                                                  'administrativeArea',
                                                  String)
  postal_code = XmlUtilities.from_element(root, 'postalCode', String)
  country = XmlUtilities.from_element(root, 'country', String)
  date_of_birth = XmlUtilities.from_element(root, 'dateOfBirth', String)
  beneficiary_id = XmlUtilities.from_element(root, 'beneficiaryId', String)
  beneficiary_name = XmlUtilities.from_element(root, 'beneficiaryName',
                                               String)
  beneficiary_address = XmlUtilities.from_element(root,
                                                  'beneficiaryAddress',
                                                  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)
  locality = XmlUtilities.from_element(root, 'locality', String)
  tax_id_number = XmlUtilities.from_element(root, 'taxIdNumber', Float)

  new(account_id: ,
      account_type: ,
      first_name: first_name,
      middle_name: middle_name,
      last_name: last_name,
      address1: address1,
      administrative_area: administrative_area,
      postal_code: postal_code,
      country: country,
      date_of_birth: date_of_birth,
      beneficiary_id: beneficiary_id,
      beneficiary_name: beneficiary_name,
      beneficiary_address: beneficiary_address,
      alias_name: alias_name,
      nationality: nationality,
      country_of_birth: country_of_birth,
      occupation: occupation,
      email: email,
      locality: locality,
      tax_id_number: tax_id_number,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 241

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountId') ? hash['accountId'] : SKIP
   = hash.key?('accountType') ? hash['accountType'] : SKIP
  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
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  date_of_birth = hash.key?('dateOfBirth') ? hash['dateOfBirth'] : SKIP
  beneficiary_id = hash.key?('beneficiaryId') ? hash['beneficiaryId'] : SKIP
  beneficiary_name =
    hash.key?('beneficiaryName') ? hash['beneficiaryName'] : SKIP
  beneficiary_address =
    hash.key?('beneficiaryAddress') ? hash['beneficiaryAddress'] : 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
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  tax_id_number = hash.key?('taxIdNumber') ? hash['taxIdNumber'] : 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.
  RecipientInformation.new(account_id: ,
                           account_type: ,
                           first_name: first_name,
                           middle_name: middle_name,
                           last_name: last_name,
                           address1: address1,
                           administrative_area: administrative_area,
                           postal_code: postal_code,
                           country: country,
                           date_of_birth: date_of_birth,
                           beneficiary_id: beneficiary_id,
                           beneficiary_name: beneficiary_name,
                           beneficiary_address: beneficiary_address,
                           alias_name: alias_name,
                           nationality: nationality,
                           country_of_birth: country_of_birth,
                           occupation: occupation,
                           email: email,
                           locality: locality,
                           tax_id_number: tax_id_number,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 150

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'accountId'
  @_hash['account_type'] = 'accountType'
  @_hash['first_name'] = 'firstName'
  @_hash['middle_name'] = 'middleName'
  @_hash['last_name'] = 'lastName'
  @_hash['address1'] = 'address1'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['postal_code'] = 'postalCode'
  @_hash['country'] = 'country'
  @_hash['date_of_birth'] = 'dateOfBirth'
  @_hash['beneficiary_id'] = 'beneficiaryId'
  @_hash['beneficiary_name'] = 'beneficiaryName'
  @_hash['beneficiary_address'] = 'beneficiaryAddress'
  @_hash['alias_name'] = 'aliasName'
  @_hash['nationality'] = 'nationality'
  @_hash['country_of_birth'] = 'countryOfBirth'
  @_hash['occupation'] = 'occupation'
  @_hash['email'] = 'email'
  @_hash['locality'] = 'locality'
  @_hash['tax_id_number'] = 'taxIdNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



202
203
204
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 202

def self.nullables
  []
end

.optionalsObject

An array for optional fields



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 176

def self.optionals
  %w[
    account_id
    account_type
    first_name
    middle_name
    last_name
    address1
    administrative_area
    postal_code
    country
    date_of_birth
    beneficiary_id
    beneficiary_name
    beneficiary_address
    alias_name
    nationality
    country_of_birth
    occupation
    email
    locality
    tax_id_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 400

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

#to_sObject

Provides a human-readable string representation of the object.



386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 386

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

#to_xml_element(doc, root_name) ⇒ Object



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/cyber_source_merged_spec/models/recipient_information.rb', line 352

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

  XmlUtilities.add_as_subelement(doc, root, 'accountId', )
  XmlUtilities.add_as_subelement(doc, root, 'accountType', )
  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, 'administrativeArea',
                                 administrative_area)
  XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code)
  XmlUtilities.add_as_subelement(doc, root, 'country', country)
  XmlUtilities.add_as_subelement(doc, root, 'dateOfBirth', date_of_birth)
  XmlUtilities.add_as_subelement(doc, root, 'beneficiaryId', beneficiary_id)
  XmlUtilities.add_as_subelement(doc, root, 'beneficiaryName',
                                 beneficiary_name)
  XmlUtilities.add_as_subelement(doc, root, 'beneficiaryAddress',
                                 beneficiary_address)
  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, 'locality', locality)
  XmlUtilities.add_as_subelement(doc, root, 'taxIdNumber', tax_id_number)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end