Class: CyberSourceMergedSpec::TokenInformation2

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

Overview

TokenInformation2 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, network_token_option: SKIP, token_provisioning_information: SKIP, additional_properties: nil) ⇒ TokenInformation2

Returns a new instance of TokenInformation2.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 70

def initialize(jti: SKIP, transient_token_jwt: SKIP,
               network_token_option: SKIP,
               token_provisioning_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
  @network_token_option = network_token_option unless network_token_option == SKIP
  unless token_provisioning_information == SKIP
    @token_provisioning_information =
      token_provisioning_information
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#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_information2.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)


31
32
33
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 31

def network_token_option
  @network_token_option
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.


42
43
44
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 42

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_information2.rb', line 20

def transient_token_jwt
  @transient_token_jwt
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  jti = XmlUtilities.from_element(root, 'jti', String)
  transient_token_jwt = XmlUtilities.from_element(root, 'transientTokenJwt',
                                                  String)
  network_token_option = XmlUtilities.from_element(root,
                                                   'networkTokenOption',
                                                   String)
  token_provisioning_information = XmlUtilities.from_element(
    root, 'TokenProvisioningInformation',
    TokenProvisioningInformation
  )

  new(jti: jti,
      transient_token_jwt: transient_token_jwt,
      network_token_option: network_token_option,
      token_provisioning_information: token_provisioning_information,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 88

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
  network_token_option =
    hash.key?('networkTokenOption') ? hash['networkTokenOption'] : SKIP
  if hash['tokenProvisioningInformation']
    token_provisioning_information = TokenProvisioningInformation.from_hash(hash['tokenProvisioningInformation'])
  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.
  TokenInformation2.new(jti: jti,
                        transient_token_jwt: transient_token_jwt,
                        network_token_option: network_token_option,
                        token_provisioning_information: token_provisioning_information,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['jti'] = 'jti'
  @_hash['transient_token_jwt'] = 'transientTokenJwt'
  @_hash['network_token_option'] = 'networkTokenOption'
  @_hash['token_provisioning_information'] =
    'tokenProvisioningInformation'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 56

def self.optionals
  %w[
    jti
    transient_token_jwt
    network_token_option
    token_provisioning_information
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



160
161
162
163
164
165
166
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 160

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

#to_sObject

Provides a human-readable string representation of the object.



152
153
154
155
156
157
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 152

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

#to_xml_element(doc, root_name) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/cyber_source_merged_spec/models/token_information2.rb', line 135

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, 'networkTokenOption',
                                 network_token_option)
  XmlUtilities.add_as_subelement(doc, root, 'TokenProvisioningInformation',
                                 token_provisioning_information)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end