Class: CyberSourceMergedSpec::FluidData

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

Overview

FluidData 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(key_serial_number: SKIP, descriptor: SKIP, value: SKIP, encoding: SKIP, additional_properties: nil) ⇒ FluidData

Returns a new instance of FluidData.



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

def initialize(key_serial_number: SKIP, descriptor: SKIP, value: SKIP,
               encoding: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @key_serial_number = key_serial_number unless key_serial_number == SKIP
  @descriptor = descriptor unless descriptor == SKIP
  @value = value unless value == SKIP
  @encoding = encoding unless encoding == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#descriptorString

The identifier for a payment solution, which is sending the encrypted payment data for decryption. Valid values: Samsung Pay: RklEPUNPTU1PTi5TQU1TVU5HLklOQVBQLlBBWU1FTlQ= Note: For other payment solutions, the value may be specific to the terminal or device initiatinf the payment. For example, the descriptor for a Bluefin payment encryption would be a device-generated descriptor. Used by Authorization and Standalone Credits. Required for authorizations and standalone credits. Card Present processing: Format of the encrypted payment data. The value for Bluefin PCI P2PE is Ymx1ZWZpbg==. paymentInformation.fluidData.encoding must be Base64. The value for Cybersource P2PE decryption depends on the encoding method used and identified in encoding field. If paymentInformation.fluidData.encoding is Base64, the value is: RklEPUVNVi5QQVlNRU5ULkFQSQ== If paymentInformation.fluidData.encoding is HEX, the value is: 4649443D454D562E5041594D454E542E41504

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 39

def descriptor
  @descriptor
end

#encodingString

Encoding method used to encrypt the payment data. Valid values: Base64, HEX If no value is provided, Base64 is taken as the default value. And the Base64 descriptor is used for paymentInformation.fluidData.encoding

Returns:

  • (String)


57
58
59
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 57

def encoding
  @encoding
end

#key_serial_numberString

The encoded or encrypted value that a payment solution returns for an authorization request. For details about the valid values for a key, see [Creating an Online Authorization](https://developer.cybersource.com/api/developer-guides/dita -payments/CreatingOnlineAuth.html)

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 18

def key_serial_number
  @key_serial_number
end

#valueString

Represents the encrypted payment data BLOB. The entry for this field is dependent on the payment solution used by the merchant. Used by Authorization and Standalone Credits. Required for authorizations and standalone credits that use a Cybersource suppored Point-to-Point encryption method. Card Present processing This field represents the encrypted payment data generated by the payment terminal/device.

Returns:

  • (String)


50
51
52
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 50

def value
  @value
end

Class Method Details

.from_element(root) ⇒ Object



122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 122

def self.from_element(root)
  key_serial_number = XmlUtilities.from_element(root, 'keySerialNumber',
                                                String)
  descriptor = XmlUtilities.from_element(root, 'descriptor', String)
  value = XmlUtilities.from_element(root, 'value', String)
  encoding = XmlUtilities.from_element(root, 'encoding', String)

  new(key_serial_number: key_serial_number,
      descriptor: descriptor,
      value: value,
      encoding: encoding,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  key_serial_number =
    hash.key?('keySerialNumber') ? hash['keySerialNumber'] : SKIP
  descriptor = hash.key?('descriptor') ? hash['descriptor'] : SKIP
  value = hash.key?('value') ? hash['value'] : SKIP
  encoding = hash.key?('encoding') ? hash['encoding'] : SKIP

  # 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.
  FluidData.new(key_serial_number: key_serial_number,
                descriptor: descriptor,
                value: value,
                encoding: encoding,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



60
61
62
63
64
65
66
67
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 60

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['key_serial_number'] = 'keySerialNumber'
  @_hash['descriptor'] = 'descriptor'
  @_hash['value'] = 'value'
  @_hash['encoding'] = 'encoding'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    key_serial_number
    descriptor
    value
    encoding
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



159
160
161
162
163
164
# File 'lib/cyber_source_merged_spec/models/fluid_data.rb', line 159

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} key_serial_number: #{@key_serial_number.inspect}, descriptor:"\
  " #{@descriptor.inspect}, value: #{@value.inspect}, encoding: #{@encoding.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} key_serial_number: #{@key_serial_number}, descriptor: #{@descriptor},"\
  " value: #{@value}, encoding: #{@encoding}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'keySerialNumber',
                                 key_serial_number)
  XmlUtilities.add_as_subelement(doc, root, 'descriptor', descriptor)
  XmlUtilities.add_as_subelement(doc, root, 'value', value)
  XmlUtilities.add_as_subelement(doc, root, 'encoding', encoding)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end