Class: CyberSourceMergedSpec::SenderInformation1

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

Overview

SenderInformation1 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, last_name: SKIP, address1: SKIP, locality: SKIP, country_code: SKIP, administrative_area: SKIP, account: SKIP, additional_properties: nil) ⇒ SenderInformation1

Returns a new instance of SenderInformation1.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 106

def initialize(first_name: SKIP, last_name: SKIP, address1: SKIP,
               locality: SKIP, country_code: SKIP,
               administrative_area: SKIP, account: 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
  @last_name = last_name unless last_name == SKIP
  @address1 = address1 unless address1 == SKIP
  @locality = locality unless locality == SKIP
  @country_code = country_code unless country_code == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  @account =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountAccount6

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

Returns:



73
74
75
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 73

def 
  @account
end

#address1String

Street address of the sender of the funds. For Gaming Payment of Winnings transactions these are the merchant details.

  • Required for Mastercard Payment of Winnings (POW) transactions.
  • Must not be all numeric.
  • Must contain only ASCII characters in range 32-122.
  • Must not be greater than 50 characters including spaces.
  • Required for POW on Barclays.

Returns:

  • (String)


40
41
42
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 40

def address1
  @address1
end

#administrative_areaString

The state or province of the sender. This field is applicable for AFT transactions when the sender 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/sender_information1.rb', line 66

def administrative_area
  @administrative_area
end

#country_codeString

Country of the sender of the funds. For Gaming Payment of Winnings transactions these are the merchant details.

  • Required for Mastercard Payment of Winnings (POW) transactions.
  • Must be a valid three character ISO country code as defined by ISO 3166.
  • Must not be greater than 3 characters.
  • Required for POW on Barclays.

Returns:

  • (String)


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

def country_code
  @country_code
end

#first_nameString

First name of the sender of the funds. For Gaming Payment of Winnings transactions these are the merchant details.

  • Required for Mastercard Payment of Winnings (POW) transactions.
  • Must not be all numeric.
  • Must contain only ASCII characters in range 32-122.
  • Must not be greater than 35 characters including spaces.
  • Required for POW on Barclays.

Returns:

  • (String)


20
21
22
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 20

def first_name
  @first_name
end

#last_nameString

Last name of the sender of the funds. For Gaming Payment of Winnings transactions these are the merchant details.

  • Optional for Mastercard Payment of Winnings (POW) transactions.
  • Must not be all numeric.
  • Must contain only ASCII characters in range 32-122.
  • Must not be greater than 35 characters including spaces.
  • Optional for POW on Barclays.

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 30

def last_name
  @last_name
end

#localityString

City of the sender of the funds. For Gaming Payment of Winnings transactions these are the merchant details.

  • Required for Mastercard Payment of Winnings (POW) transactions.
  • Must not be all numeric.
  • Must contain only ASCII characters in range 32-122.
  • Must not be greater than 25 characters including spaces.
  • Required for POW on Barclays.

Returns:

  • (String)


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

def locality
  @locality
end

Class Method Details

.from_element(root) ⇒ Object



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 155

def self.from_element(root)
  first_name = XmlUtilities.from_element(root, 'firstName', String)
  last_name = XmlUtilities.from_element(root, 'lastName', String)
  address1 = XmlUtilities.from_element(root, 'address1', String)
  locality = XmlUtilities.from_element(root, 'locality', String)
  country_code = XmlUtilities.from_element(root, 'countryCode', String)
  administrative_area = XmlUtilities.from_element(root,
                                                  'administrativeArea',
                                                  String)
   = XmlUtilities.from_element(root, 'Account6', Account6)

  new(first_name: first_name,
      last_name: last_name,
      address1: address1,
      locality: locality,
      country_code: country_code,
      administrative_area: administrative_area,
      account: ,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 124

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  address1 = hash.key?('address1') ? hash['address1'] : SKIP
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  country_code = hash.key?('countryCode') ? hash['countryCode'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
   = Account6.from_hash(hash['account']) if hash['account']

  # 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.
  SenderInformation1.new(first_name: first_name,
                         last_name: last_name,
                         address1: address1,
                         locality: locality,
                         country_code: country_code,
                         administrative_area: administrative_area,
                         account: ,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 76

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['first_name'] = 'firstName'
  @_hash['last_name'] = 'lastName'
  @_hash['address1'] = 'address1'
  @_hash['locality'] = 'locality'
  @_hash['country_code'] = 'countryCode'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['account'] = 'account'
  @_hash
end

.nullablesObject

An array for nullable fields



102
103
104
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 102

def self.nullables
  []
end

.optionalsObject

An array for optional fields



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 89

def self.optionals
  %w[
    first_name
    last_name
    address1
    locality
    country_code
    administrative_area
    account
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



203
204
205
206
207
208
209
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 203

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name.inspect}, last_name: #{@last_name.inspect},"\
  " address1: #{@address1.inspect}, locality: #{@locality.inspect}, country_code:"\
  " #{@country_code.inspect}, administrative_area: #{@administrative_area.inspect}, account:"\
  " #{@account.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



194
195
196
197
198
199
200
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 194

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} first_name: #{@first_name}, last_name: #{@last_name}, address1:"\
  " #{@address1}, locality: #{@locality}, country_code: #{@country_code}, administrative_area:"\
  " #{@administrative_area}, account: #{@account}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/cyber_source_merged_spec/models/sender_information1.rb', line 176

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, '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, 'countryCode', country_code)
  XmlUtilities.add_as_subelement(doc, root, 'administrativeArea',
                                 administrative_area)
  XmlUtilities.add_as_subelement(doc, root, 'Account6', )
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end