Class: CyberSourceMergedSpec::TokenInformation

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

Overview

TokenInformation 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(jti: SKIP, transient_token_jwt: SKIP, payment_instrument: SKIP, shipping_address: SKIP, network_token_option: SKIP, token_provisioning_information: SKIP, client_correlation_id: SKIP, token_authentication_information: SKIP, additional_properties: nil) ⇒ TokenInformation

Returns a new instance of TokenInformation.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 100

def initialize(jti: SKIP, transient_token_jwt: SKIP,
               payment_instrument: SKIP, shipping_address: SKIP,
               network_token_option: SKIP,
               token_provisioning_information: SKIP,
               client_correlation_id: SKIP,
               token_authentication_information: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @jti = jti unless jti == SKIP
  @transient_token_jwt = transient_token_jwt unless transient_token_jwt == SKIP
  @payment_instrument = payment_instrument unless payment_instrument == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @network_token_option = network_token_option unless network_token_option == SKIP
  unless token_provisioning_information == SKIP
    @token_provisioning_information =
      token_provisioning_information
  end
  @client_correlation_id = client_correlation_id unless client_correlation_id == SKIP
  unless token_authentication_information == SKIP
    @token_authentication_information =
      token_authentication_information
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#client_correlation_idString

Client-generated unique identifier for correlating token operations across API calls. This value helps track and associate token-related transactions.

Returns:

  • (String)


58
59
60
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 58

def client_correlation_id
  @client_correlation_id
end

#jtiString

TMS Transient Token, 64 hexadecimal id value representing captured payment credentials (including Sensitive Authentication Data, e.g. CVV).

Returns:

  • (String)


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

def jti
  @jti
end

#network_token_optionString

Indicates whether a payment network token associated with a TMS token should be used for authorization. This field can contain one of following values:

  • ignore: Use a tokenized card number for an authorization, even if the TMS token has an associated payment network token.
  • prefer: (Default) Use an associated payment network token for an authorization if the TMS token has one; otherwise, use the tokenized card number.

Returns:

  • (String)


41
42
43
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 41

def network_token_option
  @network_token_option
end

#payment_instrumentPaymentInstrument1

Flex API Transient Token encoded as JWT (JSON Web Token), e.g. Flex microform or Unified Payment checkout result.

Returns:



25
26
27
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 25

def payment_instrument
  @payment_instrument
end

#shipping_addressShippingAddress1

Flex API Transient Token encoded as JWT (JSON Web Token), e.g. Flex microform or Unified Payment checkout result.

Returns:



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

def shipping_address
  @shipping_address
end

#token_authentication_informationTokenAuthenticationInformation

Contains authentication information associated with the token, including details about authenticated identities.



63
64
65
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 63

def token_authentication_information
  @token_authentication_information
end

#token_provisioning_informationTokenProvisioningInformation

Indicates whether a payment network token associated with a TMS token should be used for authorization. This field can contain one of following values:

  • ignore: Use a tokenized card number for an authorization, even if the TMS token has an associated payment network token.
  • prefer: (Default) Use an associated payment network token for an authorization if the TMS token has one; otherwise, use the tokenized card number.


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

def token_provisioning_information
  @token_provisioning_information
end

#transient_token_jwtString

Flex API Transient Token encoded as JWT (JSON Web Token), e.g. Flex microform or Unified Payment checkout result.

Returns:

  • (String)


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

def transient_token_jwt
  @transient_token_jwt
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  jti = XmlUtilities.from_element(root, 'jti', String)
  transient_token_jwt = XmlUtilities.from_element(root, 'transientTokenJwt',
                                                  String)
  payment_instrument = XmlUtilities.from_element(root, 'PaymentInstrument1',
                                                 PaymentInstrument1)
  shipping_address = XmlUtilities.from_element(root, 'ShippingAddress1',
                                               ShippingAddress1)
  network_token_option = XmlUtilities.from_element(root,
                                                   'networkTokenOption',
                                                   String)
  token_provisioning_information = XmlUtilities.from_element(
    root, 'TokenProvisioningInformation',
    TokenProvisioningInformation
  )
  client_correlation_id = XmlUtilities.from_element(root,
                                                    'clientCorrelationId',
                                                    String)
  token_authentication_information = XmlUtilities.from_element(
    root, 'TokenAuthenticationInformation',
    TokenAuthenticationInformation
  )

  new(jti: jti,
      transient_token_jwt: transient_token_jwt,
      payment_instrument: payment_instrument,
      shipping_address: shipping_address,
      network_token_option: network_token_option,
      token_provisioning_information: token_provisioning_information,
      client_correlation_id: client_correlation_id,
      token_authentication_information: token_authentication_information,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 128

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  jti = hash.key?('jti') ? hash['jti'] : SKIP
  transient_token_jwt =
    hash.key?('transientTokenJwt') ? hash['transientTokenJwt'] : SKIP
  payment_instrument = PaymentInstrument1.from_hash(hash['paymentInstrument']) if
    hash['paymentInstrument']
  shipping_address = ShippingAddress1.from_hash(hash['shippingAddress']) if
    hash['shippingAddress']
  network_token_option =
    hash.key?('networkTokenOption') ? hash['networkTokenOption'] : SKIP
  if hash['tokenProvisioningInformation']
    token_provisioning_information = TokenProvisioningInformation.from_hash(hash['tokenProvisioningInformation'])
  end
  client_correlation_id =
    hash.key?('clientCorrelationId') ? hash['clientCorrelationId'] : SKIP
  if hash['tokenAuthenticationInformation']
    token_authentication_information = TokenAuthenticationInformation.from_hash(hash['tokenAuthenticationInformation'])
  end

  # 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.
  TokenInformation.new(jti: jti,
                       transient_token_jwt: transient_token_jwt,
                       payment_instrument: payment_instrument,
                       shipping_address: shipping_address,
                       network_token_option: network_token_option,
                       token_provisioning_information: token_provisioning_information,
                       client_correlation_id: client_correlation_id,
                       token_authentication_information: token_authentication_information,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 66

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['jti'] = 'jti'
  @_hash['transient_token_jwt'] = 'transientTokenJwt'
  @_hash['payment_instrument'] = 'paymentInstrument'
  @_hash['shipping_address'] = 'shippingAddress'
  @_hash['network_token_option'] = 'networkTokenOption'
  @_hash['token_provisioning_information'] =
    'tokenProvisioningInformation'
  @_hash['client_correlation_id'] = 'clientCorrelationId'
  @_hash['token_authentication_information'] =
    'tokenAuthenticationInformation'
  @_hash
end

.nullablesObject

An array for nullable fields



96
97
98
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 96

def self.nullables
  []
end

.optionalsObject

An array for optional fields



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 82

def self.optionals
  %w[
    jti
    transient_token_jwt
    payment_instrument
    shipping_address
    network_token_option
    token_provisioning_information
    client_correlation_id
    token_authentication_information
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



240
241
242
243
244
245
246
247
248
249
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 240

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} jti: #{@jti.inspect}, transient_token_jwt: #{@transient_token_jwt.inspect},"\
  " payment_instrument: #{@payment_instrument.inspect}, shipping_address:"\
  " #{@shipping_address.inspect}, network_token_option: #{@network_token_option.inspect},"\
  " token_provisioning_information: #{@token_provisioning_information.inspect},"\
  " client_correlation_id: #{@client_correlation_id.inspect},"\
  " token_authentication_information: #{@token_authentication_information.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



229
230
231
232
233
234
235
236
237
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 229

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} jti: #{@jti}, transient_token_jwt: #{@transient_token_jwt},"\
  " payment_instrument: #{@payment_instrument}, shipping_address: #{@shipping_address},"\
  " network_token_option: #{@network_token_option}, token_provisioning_information:"\
  " #{@token_provisioning_information}, client_correlation_id: #{@client_correlation_id},"\
  " token_authentication_information: #{@token_authentication_information},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/cyber_source_merged_spec/models/token_information.rb', line 203

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

  XmlUtilities.add_as_subelement(doc, root, 'jti', jti)
  XmlUtilities.add_as_subelement(doc, root, 'transientTokenJwt',
                                 transient_token_jwt)
  XmlUtilities.add_as_subelement(doc, root, 'PaymentInstrument1',
                                 payment_instrument)
  XmlUtilities.add_as_subelement(doc, root, 'ShippingAddress1',
                                 shipping_address)
  XmlUtilities.add_as_subelement(doc, root, 'networkTokenOption',
                                 network_token_option)
  XmlUtilities.add_as_subelement(doc, root, 'TokenProvisioningInformation',
                                 token_provisioning_information)
  XmlUtilities.add_as_subelement(doc, root, 'clientCorrelationId',
                                 client_correlation_id)
  XmlUtilities.add_as_subelement(doc, root,
                                 'TokenAuthenticationInformation',
                                 token_authentication_information)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end