Class: CyberSourceMergedSpec::TokenInformation4

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

Overview

TokenInformation4 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, customer: SKIP, shipping_address: SKIP, payment_instrument: SKIP, instrument_identifier: SKIP, additional_properties: nil) ⇒ TokenInformation4

Returns a new instance of TokenInformation4.



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

def initialize(jti: SKIP, transient_token_jwt: SKIP, customer: SKIP,
               shipping_address: SKIP, payment_instrument: SKIP,
               instrument_identifier: 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
  @customer = customer unless customer == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @payment_instrument = payment_instrument unless payment_instrument == SKIP
  @instrument_identifier = instrument_identifier unless instrument_identifier == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#customerCustomer14

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_information4.rb', line 25

def customer
  @customer
end

#instrument_identifierInstrumentIdentifier12

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



40
41
42
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 40

def instrument_identifier
  @instrument_identifier
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_information4.rb', line 15

def jti
  @jti
end

#payment_instrumentPaymentInstrument11

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

Returns:



35
36
37
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 35

def payment_instrument
  @payment_instrument
end

#shipping_addressShippingAddress12

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_information4.rb', line 30

def shipping_address
  @shipping_address
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_information4.rb', line 20

def transient_token_jwt
  @transient_token_jwt
end

Class Method Details

.from_element(root) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 119

def self.from_element(root)
  jti = XmlUtilities.from_element(root, 'jti', String)
  transient_token_jwt = XmlUtilities.from_element(root, 'transientTokenJwt',
                                                  String)
  customer = XmlUtilities.from_element(root, 'Customer14', Customer14)
  shipping_address = XmlUtilities.from_element(root, 'ShippingAddress12',
                                               ShippingAddress12)
  payment_instrument = XmlUtilities.from_element(root,
                                                 'paymentInstrument11',
                                                 PaymentInstrument11)
  instrument_identifier = XmlUtilities.from_element(
    root, 'InstrumentIdentifier12', InstrumentIdentifier12
  )

  new(jti: jti,
      transient_token_jwt: transient_token_jwt,
      customer: customer,
      shipping_address: shipping_address,
      payment_instrument: payment_instrument,
      instrument_identifier: instrument_identifier,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
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
115
116
117
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 87

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
  customer = Customer14.from_hash(hash['customer']) if hash['customer']
  shipping_address = ShippingAddress12.from_hash(hash['shippingAddress']) if
    hash['shippingAddress']
  payment_instrument = PaymentInstrument11.from_hash(hash['paymentInstrument']) if
    hash['paymentInstrument']
  instrument_identifier = InstrumentIdentifier12.from_hash(hash['instrumentIdentifier']) if
    hash['instrumentIdentifier']

  # 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.
  TokenInformation4.new(jti: jti,
                        transient_token_jwt: transient_token_jwt,
                        customer: customer,
                        shipping_address: shipping_address,
                        payment_instrument: payment_instrument,
                        instrument_identifier: instrument_identifier,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['jti'] = 'jti'
  @_hash['transient_token_jwt'] = 'transientTokenJwt'
  @_hash['customer'] = 'customer'
  @_hash['shipping_address'] = 'shippingAddress'
  @_hash['payment_instrument'] = 'paymentInstrument'
  @_hash['instrument_identifier'] = 'instrumentIdentifier'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    jti
    transient_token_jwt
    customer
    shipping_address
    payment_instrument
    instrument_identifier
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



171
172
173
174
175
176
177
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 171

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

#to_sObject

Provides a human-readable string representation of the object.



162
163
164
165
166
167
168
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 162

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

#to_xml_element(doc, root_name) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/cyber_source_merged_spec/models/token_information4.rb', line 142

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, 'Customer14', customer)
  XmlUtilities.add_as_subelement(doc, root, 'ShippingAddress12',
                                 shipping_address)
  XmlUtilities.add_as_subelement(doc, root, 'paymentInstrument11',
                                 payment_instrument)
  XmlUtilities.add_as_subelement(doc, root, 'InstrumentIdentifier12',
                                 instrument_identifier)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end