Class: CyberSourceMergedSpec::BuyerInformation

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

Overview

BuyerInformation 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(merchant_customer_id: SKIP, date_of_birth: SKIP, vat_registration_number: SKIP, company_tax_id: SKIP, personal_identification: SKIP, hashed_password: SKIP, gender: SKIP, language: SKIP, note_to_seller: SKIP, mobile_phone: SKIP, wallet_id: SKIP, additional_properties: nil) ⇒ BuyerInformation

Returns a new instance of BuyerInformation.



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

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

  @merchant_customer_id = merchant_customer_id unless merchant_customer_id == SKIP
  @date_of_birth = date_of_birth unless date_of_birth == SKIP
  @vat_registration_number = vat_registration_number unless vat_registration_number == SKIP
  @company_tax_id = company_tax_id unless company_tax_id == SKIP
  @personal_identification = personal_identification unless personal_identification == SKIP
  @hashed_password = hashed_password unless hashed_password == SKIP
  @gender = gender unless gender == SKIP
  @language = language unless language == SKIP
  @note_to_seller = note_to_seller unless note_to_seller == SKIP
  @mobile_phone = mobile_phone unless mobile_phone == SKIP
  @wallet_id = wallet_id unless wallet_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#company_tax_idString

Company’s tax identifier. This is only used for eCheck service. ** TeleCheck ** Contact your TeleCheck representative to find out whether this field is required or optional. ** All Other Processors ** Not used.

Returns:

  • (String)


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

def company_tax_id
  @company_tax_id
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)


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

def date_of_birth
  @date_of_birth
end

#genderString

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

Returns:

  • (String)


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

def gender
  @gender
end

#hashed_passwordString

The merchant's password that CyberSource hashes and stores as a hashed password.

Returns:

  • (String)


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

def hashed_password
  @hashed_password
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)


83
84
85
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 83

def language
  @language
end

#merchant_customer_idString

Your identifier for the customer. When a subscription or customer profile is being created, the maximum length for this field for most processors is 30. Otherwise, the maximum length is 100.

Comercio Latino

For recurring payments in Mexico, the value is the customer’s contract number. Note Before you request the authorization, you must inform the issuer of the customer contract numbers that will be used for recurring transactions.

Worldpay VAP

For a follow-on credit with Worldpay VAP, CyberSource checks the following locations, in the order given, for a customer account ID value and uses the first value it finds:

  1. customer_account_id value in the follow-on credit request
  2. Customer account ID value that was used for the capture that is being credited
  3. Customer account ID value that was used for the original authorization If a customer account ID value cannot be found in any of these locations, then no value is used.

Returns:

  • (String)


33
34
35
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 33

def merchant_customer_id
  @merchant_customer_id
end

#mobile_phoneInteger

Cardholder’s mobile phone number. Important Required for Visa Secure transactions in Brazil. Do not use this request field for any other types of transactions.

Returns:

  • (Integer)


93
94
95
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 93

def mobile_phone
  @mobile_phone
end

#note_to_sellerString

Note to the recipient of the funds in this transaction

Returns:

  • (String)


87
88
89
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 87

def note_to_seller
  @note_to_seller
end

#personal_identificationArray[PersonalIdentification]

Company’s tax identifier. This is only used for eCheck service. ** TeleCheck ** Contact your TeleCheck representative to find out whether this field is required or optional. ** All Other Processors ** Not used.

Returns:



68
69
70
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 68

def personal_identification
  @personal_identification
end

#vat_registration_numberString

Customer’s government-assigned tax identification number.

Tax Calculation

Optional for international and value added taxes only. Not applicable to U.S. and Canadian taxes.

Returns:

  • (String)


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

def vat_registration_number
  @vat_registration_number
end

#wallet_idString

The one-time identification code of the Alipay wallet user. It is scanned from the barcode that is shown by the mobile application.

Returns:

  • (String)


98
99
100
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 98

def wallet_id
  @wallet_id
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
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 213

def self.from_element(root)
  merchant_customer_id = XmlUtilities.from_element(root,
                                                   'merchantCustomerId',
                                                   String)
  date_of_birth = XmlUtilities.from_element(root, 'dateOfBirth', String)
  vat_registration_number = XmlUtilities.from_element(
    root, 'vatRegistrationNumber', String
  )
  company_tax_id = XmlUtilities.from_element(root, 'companyTaxId', String)
  personal_identification = XmlUtilities.from_element_to_array(
    root, 'PersonalIdentification', PersonalIdentification
  )
  hashed_password = XmlUtilities.from_element(root, 'hashedPassword',
                                              String)
  gender = XmlUtilities.from_element(root, 'gender', String)
  language = XmlUtilities.from_element(root, 'language', String)
  note_to_seller = XmlUtilities.from_element(root, 'noteToSeller', String)
  mobile_phone = XmlUtilities.from_element(root, 'mobilePhone', Integer)
  wallet_id = XmlUtilities.from_element(root, 'walletId', String)

  new(merchant_customer_id: merchant_customer_id,
      date_of_birth: date_of_birth,
      vat_registration_number: vat_registration_number,
      company_tax_id: company_tax_id,
      personal_identification: personal_identification,
      hashed_password: hashed_password,
      gender: gender,
      language: language,
      note_to_seller: note_to_seller,
      mobile_phone: mobile_phone,
      wallet_id: wallet_id,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



163
164
165
166
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/buyer_information.rb', line 163

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  merchant_customer_id =
    hash.key?('merchantCustomerId') ? hash['merchantCustomerId'] : SKIP
  date_of_birth = hash.key?('dateOfBirth') ? hash['dateOfBirth'] : SKIP
  vat_registration_number =
    hash.key?('vatRegistrationNumber') ? hash['vatRegistrationNumber'] : SKIP
  company_tax_id = hash.key?('companyTaxId') ? hash['companyTaxId'] : 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 << (PersonalIdentification.from_hash(structure) if structure)
    end
  end

  personal_identification = SKIP unless hash.key?('personalIdentification')
  hashed_password =
    hash.key?('hashedPassword') ? hash['hashedPassword'] : SKIP
  gender = hash.key?('gender') ? hash['gender'] : SKIP
  language = hash.key?('language') ? hash['language'] : SKIP
  note_to_seller = hash.key?('noteToSeller') ? hash['noteToSeller'] : SKIP
  mobile_phone = hash.key?('mobilePhone') ? hash['mobilePhone'] : SKIP
  wallet_id = hash.key?('walletId') ? hash['walletId'] : 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.
  BuyerInformation.new(merchant_customer_id: merchant_customer_id,
                       date_of_birth: date_of_birth,
                       vat_registration_number: vat_registration_number,
                       company_tax_id: company_tax_id,
                       personal_identification: personal_identification,
                       hashed_password: hashed_password,
                       gender: gender,
                       language: language,
                       note_to_seller: note_to_seller,
                       mobile_phone: mobile_phone,
                       wallet_id: wallet_id,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 101

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['merchant_customer_id'] = 'merchantCustomerId'
  @_hash['date_of_birth'] = 'dateOfBirth'
  @_hash['vat_registration_number'] = 'vatRegistrationNumber'
  @_hash['company_tax_id'] = 'companyTaxId'
  @_hash['personal_identification'] = 'personalIdentification'
  @_hash['hashed_password'] = 'hashedPassword'
  @_hash['gender'] = 'gender'
  @_hash['language'] = 'language'
  @_hash['note_to_seller'] = 'noteToSeller'
  @_hash['mobile_phone'] = 'mobilePhone'
  @_hash['wallet_id'] = 'walletId'
  @_hash
end

.nullablesObject

An array for nullable fields



135
136
137
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 135

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    merchant_customer_id
    date_of_birth
    vat_registration_number
    company_tax_id
    personal_identification
    hashed_password
    gender
    language
    note_to_seller
    mobile_phone
    wallet_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



283
284
285
286
287
288
289
290
291
292
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 283

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

#to_sObject

Provides a human-readable string representation of the object.



272
273
274
275
276
277
278
279
280
# File 'lib/cyber_source_merged_spec/models/buyer_information.rb', line 272

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

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'merchantCustomerId',
                                 merchant_customer_id)
  XmlUtilities.add_as_subelement(doc, root, 'dateOfBirth', date_of_birth)
  XmlUtilities.add_as_subelement(doc, root, 'vatRegistrationNumber',
                                 vat_registration_number)
  XmlUtilities.add_as_subelement(doc, root, 'companyTaxId', company_tax_id)
  XmlUtilities.add_array_as_subelement(doc, root, 'PersonalIdentification',
                                       personal_identification)
  XmlUtilities.add_as_subelement(doc, root, 'hashedPassword',
                                 hashed_password)
  XmlUtilities.add_as_subelement(doc, root, 'gender', gender)
  XmlUtilities.add_as_subelement(doc, root, 'language', language)
  XmlUtilities.add_as_subelement(doc, root, 'noteToSeller', note_to_seller)
  XmlUtilities.add_as_subelement(doc, root, 'mobilePhone', mobile_phone)
  XmlUtilities.add_as_subelement(doc, root, 'walletId', wallet_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end