Class: CyberSourceMergedSpec::PostTokenizedCardRequest

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

Overview

PostTokenizedCardRequest 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(source:, account_reference_id: SKIP, consumer_id: SKIP, create_pan_instrument_identifier: SKIP, card: SKIP, passcode: SKIP, bill_to: SKIP, additional_properties: nil) ⇒ PostTokenizedCardRequest

Returns a new instance of PostTokenizedCardRequest.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 85

def initialize(source:, account_reference_id: SKIP, consumer_id: SKIP,
               create_pan_instrument_identifier: SKIP, card: SKIP,
               passcode: SKIP, bill_to: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_reference_id =  unless  == SKIP
  @consumer_id = consumer_id unless consumer_id == SKIP
  unless create_pan_instrument_identifier == SKIP
    @create_pan_instrument_identifier =
      create_pan_instrument_identifier
  end
  @source = source
  @card = card unless card == SKIP
  @passcode = passcode unless passcode == SKIP
  @bill_to = bill_to unless bill_to == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_reference_idString

An identifier provided by the issuer for the account. Required when source is ISSUER.

Returns:

  • (String)


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

def 
  @account_reference_id
end

#bill_toBillTo20

Passcode by issuer for ID&V.

Returns:



52
53
54
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 52

def bill_to
  @bill_to
end

#cardCard24

Source of the card details. Possible Values:

  • ONFILE
  • TOKEN
  • ISSUER

Returns:



44
45
46
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 44

def card
  @card
end

#consumer_idString

Identifier of the consumer within the wallet. Maximum 24 characters for VTS.

Returns:

  • (String)


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

def consumer_id
  @consumer_id
end

#create_pan_instrument_identifierTrueClass | FalseClass

Specifies whether the Instrument Identifier should be created (true) or not (false) with the PAN provided for the Network Token Provision request. Possible Values:

  • true: The InstrumentIdentifier should be created.
  • false: The InstrumentIdentifier should not be created.

Returns:

  • (TrueClass | FalseClass)


28
29
30
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 28

def create_pan_instrument_identifier
  @create_pan_instrument_identifier
end

#passcodePasscode

Passcode by issuer for ID&V.

Returns:



48
49
50
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 48

def passcode
  @passcode
end

#sourceString

Source of the card details. Possible Values:

  • ONFILE
  • TOKEN
  • ISSUER

Returns:

  • (String)


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

def source
  @source
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  source = XmlUtilities.from_element(root, 'source', String)
   = XmlUtilities.from_element(root,
                                                   'accountReferenceId',
                                                   String)
  consumer_id = XmlUtilities.from_element(root, 'consumerId', String)
  create_pan_instrument_identifier = XmlUtilities.from_element(
    root, 'createPanInstrumentIdentifier', TrueClass
  )
  card = XmlUtilities.from_element(root, 'Card24', Card24)
  passcode = XmlUtilities.from_element(root, 'Passcode', Passcode)
  bill_to = XmlUtilities.from_element(root, 'BillTo20', BillTo20)

  new(source: source,
      account_reference_id: ,
      consumer_id: consumer_id,
      create_pan_instrument_identifier: create_pan_instrument_identifier,
      card: card,
      passcode: passcode,
      bill_to: bill_to,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 105

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  source = hash.key?('source') ? hash['source'] : nil
   =
    hash.key?('accountReferenceId') ? hash['accountReferenceId'] : SKIP
  consumer_id = hash.key?('consumerId') ? hash['consumerId'] : SKIP
  create_pan_instrument_identifier =
    hash.key?('createPanInstrumentIdentifier') ? hash['createPanInstrumentIdentifier'] : SKIP
  card = Card24.from_hash(hash['card']) if hash['card']
  passcode = Passcode.from_hash(hash['passcode']) if hash['passcode']
  bill_to = BillTo20.from_hash(hash['billTo']) if hash['billTo']

  # 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.
  PostTokenizedCardRequest.new(source: source,
                               account_reference_id: ,
                               consumer_id: consumer_id,
                               create_pan_instrument_identifier: create_pan_instrument_identifier,
                               card: card,
                               passcode: passcode,
                               bill_to: bill_to,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 55

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_reference_id'] = 'accountReferenceId'
  @_hash['consumer_id'] = 'consumerId'
  @_hash['create_pan_instrument_identifier'] =
    'createPanInstrumentIdentifier'
  @_hash['source'] = 'source'
  @_hash['card'] = 'card'
  @_hash['passcode'] = 'passcode'
  @_hash['bill_to'] = 'billTo'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
78
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 69

def self.optionals
  %w[
    account_reference_id
    consumer_id
    create_pan_instrument_identifier
    card
    passcode
    bill_to
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



188
189
190
191
192
193
194
195
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 188

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_reference_id: #{@account_reference_id.inspect}, consumer_id:"\
  " #{@consumer_id.inspect}, create_pan_instrument_identifier:"\
  " #{@create_pan_instrument_identifier.inspect}, source: #{@source.inspect}, card:"\
  " #{@card.inspect}, passcode: #{@passcode.inspect}, bill_to: #{@bill_to.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



179
180
181
182
183
184
185
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 179

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_reference_id: #{@account_reference_id}, consumer_id:"\
  " #{@consumer_id}, create_pan_instrument_identifier: #{@create_pan_instrument_identifier},"\
  " source: #{@source}, card: #{@card}, passcode: #{@passcode}, bill_to: #{@bill_to},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/cyber_source_merged_spec/models/post_tokenized_card_request.rb', line 160

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

  XmlUtilities.add_as_subelement(doc, root, 'source', source)
  XmlUtilities.add_as_subelement(doc, root, 'accountReferenceId',
                                 )
  XmlUtilities.add_as_subelement(doc, root, 'consumerId', consumer_id)
  XmlUtilities.add_as_subelement(doc, root, 'createPanInstrumentIdentifier',
                                 create_pan_instrument_identifier)
  XmlUtilities.add_as_subelement(doc, root, 'Card24', card)
  XmlUtilities.add_as_subelement(doc, root, 'Passcode', passcode)
  XmlUtilities.add_as_subelement(doc, root, 'BillTo20', bill_to)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end