Class: VisaAcceptanceMergedSpec::RecipientInformation

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_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, additional_properties: nil) ⇒ RecipientInformation

Returns a new instance of RecipientInformation.



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 194

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,
               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
  @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/visa_acceptance_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/visa_acceptance_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/visa_acceptance_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/visa_acceptance_merged_spec/models/recipient_information.rb', line 66

def administrative_area
  @administrative_area
end

#alias_nameString

Account owner alias name.

Returns:

  • (String)


113
114
115
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 113

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)


109
110
111
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 109

def beneficiary_address
  @beneficiary_address
end

#beneficiary_idString

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

Returns:

  • (String)


99
100
101
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 99

def beneficiary_id
  @beneficiary_id
end

#beneficiary_nameString

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

Returns:

  • (String)


103
104
105
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 103

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](

Returns:

  • (String)


84
85
86
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 84

def country
  @country
end

#country_of_birthString

Account Owner Country of Birth

Returns:

  • (String)


121
122
123
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 121

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


94
95
96
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 94

def date_of_birth
  @date_of_birth
end

#emailString

Account Owner email address

Returns:

  • (String)


129
130
131
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 129

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/visa_acceptance_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/visa_acceptance_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)


137
138
139
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 137

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/visa_acceptance_merged_spec/models/recipient_information.rb', line 43

def middle_name
  @middle_name
end

#nationalityString

Account Owner Nationality

Returns:

  • (String)


117
118
119
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 117

def nationality
  @nationality
end

#occupationString

Account Owner Occupation

Returns:

  • (String)


125
126
127
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 125

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 Visa Acceptance 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)


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

def postal_code
  @postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



228
229
230
231
232
233
234
235
236
237
238
239
240
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
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 228

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

  # 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,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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
end

.nullablesObject

An array for nullable fields



190
191
192
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 190

def self.nullables
  []
end

.optionalsObject

An array for optional fields



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 165

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
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 300

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}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



287
288
289
290
291
292
293
294
295
296
297
# File 'lib/visa_acceptance_merged_spec/models/recipient_information.rb', line 287

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}, additional_properties: #{@additional_properties}>"
end