Class: CyberSourceMergedSpec::SubMerchant

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

Overview

SubMerchant 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(card_acceptor_id: SKIP, id: SKIP, name: SKIP, address1: SKIP, locality: SKIP, administrative_area: SKIP, region: SKIP, postal_code: SKIP, country: SKIP, email: SKIP, phone_number: SKIP, merchant_category_code: SKIP, additional_properties: nil) ⇒ SubMerchant

Returns a new instance of SubMerchant.



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 211

def initialize(card_acceptor_id: SKIP, id: SKIP, name: SKIP, address1: SKIP,
               locality: SKIP, administrative_area: SKIP, region: SKIP,
               postal_code: SKIP, country: SKIP, email: SKIP,
               phone_number: SKIP, merchant_category_code: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @card_acceptor_id = card_acceptor_id unless card_acceptor_id == SKIP
  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @address1 = address1 unless address1 == SKIP
  @locality = locality unless locality == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  @region = region unless region == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @country = country unless country == SKIP
  @email = email unless email == SKIP
  @phone_number = phone_number unless phone_number == SKIP
  @merchant_category_code = merchant_category_code unless merchant_category_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#address1String

First line of the sub-merchant’s street address.

CyberSource through VisaNet

The value for this field does not map to the TC 33 capture file5.

FDC Compass

This value must consist of uppercase characters.

Returns:

  • (String)


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

def address1
  @address1
end

#administrative_areaString

Sub-merchant’s state or province.

CyberSource through VisaNet

The value for this field does not map to the TC 33 capture file5.

FDC Compass

This value must consist of uppercase characters.

Returns:

  • (String)


84
85
86
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 84

def administrative_area
  @administrative_area
end

#card_acceptor_idString

Unique identifier assigned by the payment card company to the sub-merchant.

Returns:

  • (String)


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

def card_acceptor_id
  @card_acceptor_id
end

#countryString

Sub-merchant’s country. Use the [ISO Standard Country Codes](https://developer.cybersource.com/library/documentation/sbc/quickre f/countries_alpha_list.pdf).

CyberSource through VisaNet

The value for this field does not map to the TC 33 capture file.

FDC Compass

This value must consist of uppercase characters.

Returns:

  • (String)


108
109
110
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 108

def country
  @country
end

#emailString

Sub-merchant’s email address. Maximum length for processors

  • American Express Direct: 40
  • CyberSource through VisaNet: 40
  • FDC Compass: 40
  • FDC Nashville Global: 19

CyberSource through VisaNet

With American Express, the value for this field corresponds to the following data in the TC 33 capture file:

  • Record: CP01 TCRB
  • Position: 25-64
  • Field: American Express Seller E-mail Address Note The TC 33 Capture file contains information about the purchases and refunds that a merchant submits to CyberSource. CyberSource through VisaNet creates the TC 33 Capture file at the end of the day and sends it to the merchant’s acquirer, who uses this information to facilitate end-of-day clearing processing with payment card companies.

Returns:

  • (String)


128
129
130
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 128

def email
  @email
end

#idString

The ID you assigned to your sub-merchant. CyberSource through VisaNet: For American Express transaction, the value for this field corresponds to the following data in the TC 33 capture file:

  • Record: CP01 TCRB
  • Position: 65-84
  • Field: American Express Seller ID For Mastercard transactions, the value for this field corresponds to the following data in the TC 33 capture file:
  • Record: CP01 TCR6
  • Position: 117-131
  • Field: Sub-Merchant ID FDC Compass: This value must consist of uppercase characters. American Express Direct: String (20) CyberSource through VisaNet with American Express: String (20) CyberSource through VisaNet with Visa,Mastercard and Discover: String (15) FDC Compass: String (20) FDC Nashville Global: String (14)

Returns:

  • (String)


36
37
38
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 36

def id
  @id
end

#localityString

Sub-merchant’s city.

CyberSource through VisaNet

The value for this field does not map to the TC 33 capture file5.

FDC Compass

This value must consist of uppercase characters.

Returns:

  • (String)


76
77
78
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 76

def locality
  @locality
end

#merchant_category_codeFloat

Sub-merchant’s telephone number. Maximum length for procesors

  • American Express Direct: 20
  • CyberSource through VisaNet: 20
  • FDC Compass: 13
  • FDC Nashville Global: 10

CyberSource through VisaNet

With American Express, the value for this field corresponds to the following data in the TC 33 capture file5:

  • Record: CP01 TCRB
  • Position: 5-24
  • Field: American Express Seller Telephone Number FDC Compass
    This value must consist of uppercase characters. Use one of these recommended formats:
    NNN-NNN-NNNN
    NNN-AAAAAAA

Returns:

  • (Float)


168
169
170
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 168

def merchant_category_code
  @merchant_category_code
end

#nameString

Sub-merchant’s business name.

American Express Direct

The maximum length of the sub-merchant name depends on the length of the aggregator name. The combined length for both values must not exceed 36 characters.

CyberSource through VisaNet

With American Express, the maximum length of the sub-merchant name depends on the length of the aggregator name. The combined length for both values must not exceed 36 characters. The value for this field does not map to the TC 33 capture file5.

FDC Compass

This value must consist of uppercase characters.

FDC Nashville Global

With Mastercard, the maximum length of the sub-merchant name depends on the length of the aggregator name:

  • If aggregator name length is 1 through 3, maximum sub-merchant name length is 21.
  • If aggregator name length is 4 through 7, maximum sub-merchant name length is 17.
  • If aggregator name length is 8 through 12, maximum sub-merchant name length is 12.

Returns:

  • (String)


60
61
62
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 60

def name
  @name
end

#phone_numberString

Sub-merchant’s telephone number. Maximum length for procesors

  • American Express Direct: 20
  • CyberSource through VisaNet: 20
  • FDC Compass: 13
  • FDC Nashville Global: 10

CyberSource through VisaNet

With American Express, the value for this field corresponds to the following data in the TC 33 capture file5:

  • Record: CP01 TCRB
  • Position: 5-24
  • Field: American Express Seller Telephone Number FDC Compass
    This value must consist of uppercase characters. Use one of these recommended formats:
    NNN-NNN-NNNN
    NNN-AAAAAAA

Returns:

  • (String)


148
149
150
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 148

def phone_number
  @phone_number
end

#postal_codeString

Partial postal code for the sub-merchant’s address.

CyberSource through VisaNet

The value for this field does not map to the TC 33 capture file5.

FDC Compass

This value must consist of uppercase characters.

Returns:

  • (String)


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

def postal_code
  @postal_code
end

#regionString

Sub-merchant’s region. Example
NE indicates that the sub-merchant is in the northeast region.

Returns:

  • (String)


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

def region
  @region
end

Class Method Details

.from_element(root) ⇒ Object



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 278

def self.from_element(root)
  card_acceptor_id = XmlUtilities.from_element(root, 'cardAcceptorId',
                                               String)
  id = XmlUtilities.from_element(root, 'id', String)
  name = XmlUtilities.from_element(root, 'name', String)
  address1 = XmlUtilities.from_element(root, 'address1', String)
  locality = XmlUtilities.from_element(root, 'locality', String)
  administrative_area = XmlUtilities.from_element(root,
                                                  'administrativeArea',
                                                  String)
  region = XmlUtilities.from_element(root, 'region', String)
  postal_code = XmlUtilities.from_element(root, 'postalCode', String)
  country = XmlUtilities.from_element(root, 'country', String)
  email = XmlUtilities.from_element(root, 'email', String)
  phone_number = XmlUtilities.from_element(root, 'phoneNumber', String)
  merchant_category_code = XmlUtilities.from_element(root,
                                                     'merchantCategoryCode',
                                                     Float)

  new(card_acceptor_id: card_acceptor_id,
      id: id,
      name: name,
      address1: address1,
      locality: locality,
      administrative_area: administrative_area,
      region: region,
      postal_code: postal_code,
      country: country,
      email: email,
      phone_number: phone_number,
      merchant_category_code: merchant_category_code,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 235

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card_acceptor_id =
    hash.key?('cardAcceptorId') ? hash['cardAcceptorId'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  address1 = hash.key?('address1') ? hash['address1'] : SKIP
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  region = hash.key?('region') ? hash['region'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : SKIP
  merchant_category_code =
    hash.key?('merchantCategoryCode') ? hash['merchantCategoryCode'] : 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.
  SubMerchant.new(card_acceptor_id: card_acceptor_id,
                  id: id,
                  name: name,
                  address1: address1,
                  locality: locality,
                  administrative_area: administrative_area,
                  region: region,
                  postal_code: postal_code,
                  country: country,
                  email: email,
                  phone_number: phone_number,
                  merchant_category_code: merchant_category_code,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 171

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card_acceptor_id'] = 'cardAcceptorId'
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['address1'] = 'address1'
  @_hash['locality'] = 'locality'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['region'] = 'region'
  @_hash['postal_code'] = 'postalCode'
  @_hash['country'] = 'country'
  @_hash['email'] = 'email'
  @_hash['phone_number'] = 'phoneNumber'
  @_hash['merchant_category_code'] = 'merchantCategoryCode'
  @_hash
end

.nullablesObject

An array for nullable fields



207
208
209
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 207

def self.nullables
  []
end

.optionalsObject

An array for optional fields



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 189

def self.optionals
  %w[
    card_acceptor_id
    id
    name
    address1
    locality
    administrative_area
    region
    postal_code
    country
    email
    phone_number
    merchant_category_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



347
348
349
350
351
352
353
354
355
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 347

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} card_acceptor_id: #{@card_acceptor_id.inspect}, id: #{@id.inspect}, name:"\
  " #{@name.inspect}, address1: #{@address1.inspect}, locality: #{@locality.inspect},"\
  " administrative_area: #{@administrative_area.inspect}, region: #{@region.inspect},"\
  " postal_code: #{@postal_code.inspect}, country: #{@country.inspect}, email:"\
  " #{@email.inspect}, phone_number: #{@phone_number.inspect}, merchant_category_code:"\
  " #{@merchant_category_code.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



337
338
339
340
341
342
343
344
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 337

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} card_acceptor_id: #{@card_acceptor_id}, id: #{@id}, name: #{@name},"\
  " address1: #{@address1}, locality: #{@locality}, administrative_area:"\
  " #{@administrative_area}, region: #{@region}, postal_code: #{@postal_code}, country:"\
  " #{@country}, email: #{@email}, phone_number: #{@phone_number}, merchant_category_code:"\
  " #{@merchant_category_code}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/cyber_source_merged_spec/models/sub_merchant.rb', line 312

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

  XmlUtilities.add_as_subelement(doc, root, 'cardAcceptorId',
                                 card_acceptor_id)
  XmlUtilities.add_as_subelement(doc, root, 'id', id)
  XmlUtilities.add_as_subelement(doc, root, 'name', 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, 'region', region)
  XmlUtilities.add_as_subelement(doc, root, 'postalCode', postal_code)
  XmlUtilities.add_as_subelement(doc, root, 'country', country)
  XmlUtilities.add_as_subelement(doc, root, 'email', email)
  XmlUtilities.add_as_subelement(doc, root, 'phoneNumber', phone_number)
  XmlUtilities.add_as_subelement(doc, root, 'merchantCategoryCode',
                                 merchant_category_code)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end