Class: CyberSourceMergedSpec::Card16

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

Overview

Card16 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(type: SKIP, brand_name: SKIP, currency: SKIP, max_length: SKIP, credential_type: SKIP, brands: SKIP, additional_properties: nil) ⇒ Card16

Returns a new instance of Card16.



232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 232

def initialize(type: SKIP, brand_name: SKIP, currency: SKIP,
               max_length: SKIP, credential_type: SKIP, brands: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @brand_name = brand_name unless brand_name == SKIP
  @currency = currency unless currency == SKIP
  @max_length = max_length unless max_length == SKIP
  @credential_type = credential_type unless credential_type == SKIP
  @brands = brands unless brands == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#brand_nameString

This field contains the card brand name. Some of the possible values (not an exhaustive list) are -

  • VISA
  • MASTERCARD
  • AMERICAN EXPRESS
  • DISCOVER
  • DINERS CLUB
  • CARTE BLANCHE
  • JCB
  • OPTIMA
  • TWINPAY CREDIT CARD
  • TWINPAY DEBIT CARD
  • WALMART
  • ENROUTE
  • LOWES CONSUMER
  • HOME DEPOT CONSUMER
  • MBNA
  • DICKS SPORTWEAR
  • CASUAL CORNER
  • SEARS
  • JAL
  • DISNEY CARD
  • SWITCH/SOLO
  • SAMS CLUB CONSUMER
  • SAMS CLUB BUSINESS
  • NICOS HOUSE CARD
  • BEBE
  • RESTORATION HARDWARE
  • DELTA ONLINE
  • SOLO
  • VISA ELECTRON
  • DANKORT
  • LASER
  • CARTE BANCAIRE
  • CARTA SI
  • ENCODED ACCOUNT
  • UATP
  • HOUSEHOLD
  • MAESTRO
  • GE CAPITAL
  • KOREAN CARDS
  • STYLE CARDS
  • JCREW
  • MEIJER
  • HIPERCARD
  • AURA
  • REDECARD
  • ORICO HOUSE CARD
  • MADA
  • ELO
  • CAPITAL ONE PRIVATE LABEL
  • CARNET
  • RUPAY
  • CHINA UNION PAY
  • FALABELLA PRIVATE LABEL
  • PROMPTCARD
  • KOREAN DOMESTIC
  • BANRICOMPRAS
  • MEEZA
  • PAYPAK
  • JAYWAN
  • TPN

Returns:

  • (String)


180
181
182
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 180

def brand_name
  @brand_name
end

#brandsArray[Brand]

Array of brands

Returns:



201
202
203
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 201

def brands
  @brands
end

#credential_typeString

This field contains the type of the payment credential. Possible values:

- PAN
- TOKEN

Returns:

  • (String)


197
198
199
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 197

def credential_type
  @credential_type
end

#currencyString

This field indicates the 3-letter [ISO Standard Currency Codes](http://apps.cybersource.com/library/documentation/sbc/quickref/curr encies.pdf) for the card currency.

Returns:

  • (String)


186
187
188
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 186

def currency
  @currency
end

#max_lengthString

This field contains the max length of the card.

Returns:

  • (String)


190
191
192
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 190

def max_length
  @max_length
end

#typeString

This field contains a 3-digit numeric value that indicates the card type within Cybersource eco-system. Possible values from BIN Lookup Service (based on availability and enablement):

  • 000: Unsupported Card Type
  • 001: Visa
  • 002: Mastercard
  • 003: American Express
  • 004: Discover
  • 005: Diners Club
  • 007: JCB
  • 036: Cartes Bancaire
  • 042: Maestro
  • 054: Elo
  • 058: Carnet
  • 060: MADA
  • 061: RuPay
  • 062: China UnionPay
  • 064: Prompt Card
  • 067: Meeza
  • 068: PayPak
  • 070: EFTPOS
  • 081: Jaywan
  • 082: TPN Glossary of possible values in the payments ecosystem:
  • 001: Visa
  • 002: Mastercard
  • 003: American Express
  • 004: Discover
  • 005: Diners Club
  • 006: Carte Blanche
  • 007: JCB
  • 008: Optima
  • 009: GE Private Label
  • 010: Beneficial Private Label
  • 011: Twinpay Credit Card
  • 012: Twinpay Debit Card
  • 013: Walmart
  • 014: EnRoute
  • 015: Lowe's Consumer
  • 016: Home Depot Consumer
  • 017: MBNA
  • 018: Dick's Sportwear
  • 019: Casual Corner
  • 020: Sears
  • 021: JAL
  • 023: Disney Card
  • 024: Switch/Solo
  • 025: Sam's Club Consumer
  • 026: Sam's Club Business
  • 027: Nico's
  • 028: Paymentech Bill Me Later
  • 029: Bebe
  • 030: Restoration Hardware
  • 031: Delta Online
  • 032: Solo
  • 033: Visa Electron
  • 034: Dankort
  • 035: Laser
  • 036: Cartes Bancaire
  • 037: Carta Si
  • 040: UATP
  • 041: HOUSEHOLD
  • 042: Maestro
  • 043: GE MONEY
  • 044: Korean Cards
  • 045: Style Cards
  • 046: J.Crew
  • 047: Payeasecn eWallet
  • 048: Payeasecn Bank Transfer
  • 049: Meijer
  • 050: Hipercard
  • 051: Aura
  • 052: Redecard
  • 053: Orico Card
  • 054: Elo
  • 055: Capital One Private Label
  • 057: Costco Private Label
  • 058: Carnet
  • 059: ValueLink
  • 060: MADA
  • 061: RuPay
  • 062: China UnionPay
  • 063: Falabella Private Label
  • 064: Prompt Card
  • 065: Korean Domestic
  • 066: Banricompras
  • 067: Meeza
  • 068: PayPak
  • 070: EFTPOS
  • 071: Codensa
  • 072: Olimpica
  • 073: Colsubsidio
  • 074: Tuya
  • 075: Sodexo
  • 076: Naranja
  • 077: Cabal
  • 078: DINELCO
  • 079: PANAL
  • 080: EPM
  • 081: Jaywan
  • 082: TPN

Returns:

  • (String)


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

def type
  @type
end

Class Method Details

.from_element(root) ⇒ Object



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 286

def self.from_element(root)
  type = XmlUtilities.from_element(root, 'type', String)
  brand_name = XmlUtilities.from_element(root, 'brandName', String)
  currency = XmlUtilities.from_element(root, 'currency', String)
  max_length = XmlUtilities.from_element(root, 'maxLength', String)
  credential_type = XmlUtilities.from_element(root, 'credentialType',
                                              String)
  brands = XmlUtilities.from_element_to_array(root, 'Brand', Brand)

  new(type: type,
      brand_name: brand_name,
      currency: currency,
      max_length: max_length,
      credential_type: credential_type,
      brands: brands,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/cyber_source_merged_spec/models/card16.rb', line 248

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  brand_name = hash.key?('brandName') ? hash['brandName'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  max_length = hash.key?('maxLength') ? hash['maxLength'] : SKIP
  credential_type =
    hash.key?('credentialType') ? hash['credentialType'] : SKIP
  # Parameter is an array, so we need to iterate through it
  brands = nil
  unless hash['brands'].nil?
    brands = []
    hash['brands'].each do |structure|
      brands << (Brand.from_hash(structure) if structure)
    end
  end

  brands = SKIP unless hash.key?('brands')

  # 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.
  Card16.new(type: type,
             brand_name: brand_name,
             currency: currency,
             max_length: max_length,
             credential_type: credential_type,
             brands: brands,
             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



204
205
206
207
208
209
210
211
212
213
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 204

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['brand_name'] = 'brandName'
  @_hash['currency'] = 'currency'
  @_hash['max_length'] = 'maxLength'
  @_hash['credential_type'] = 'credentialType'
  @_hash['brands'] = 'brands'
  @_hash
end

.nullablesObject

An array for nullable fields



228
229
230
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 228

def self.nullables
  []
end

.optionalsObject

An array for optional fields



216
217
218
219
220
221
222
223
224
225
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 216

def self.optionals
  %w[
    type
    brand_name
    currency
    max_length
    credential_type
    brands
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



329
330
331
332
333
334
335
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 329

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, brand_name: #{@brand_name.inspect}, currency:"\
  " #{@currency.inspect}, max_length: #{@max_length.inspect}, credential_type:"\
  " #{@credential_type.inspect}, brands: #{@brands.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



321
322
323
324
325
326
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 321

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, brand_name: #{@brand_name}, currency: #{@currency},"\
  " max_length: #{@max_length}, credential_type: #{@credential_type}, brands: #{@brands},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/cyber_source_merged_spec/models/card16.rb', line 304

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

  XmlUtilities.add_as_subelement(doc, root, 'type', type)
  XmlUtilities.add_as_subelement(doc, root, 'brandName', brand_name)
  XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
  XmlUtilities.add_as_subelement(doc, root, 'maxLength', max_length)
  XmlUtilities.add_as_subelement(doc, root, 'credentialType',
                                 credential_type)
  XmlUtilities.add_array_as_subelement(doc, root, 'Brand', brands)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end