Class: CyberSourceMergedSpec::ProcessorInformation32

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

Overview

ProcessorInformation32 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(system_trace_audit_number: SKIP, approval_code: SKIP, response_code: SKIP, transaction_id: SKIP, additional_properties: nil) ⇒ ProcessorInformation32

Returns a new instance of ProcessorInformation32.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 57

def initialize(system_trace_audit_number: SKIP, approval_code: SKIP,
               response_code: SKIP, transaction_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  unless system_trace_audit_number == SKIP
    @system_trace_audit_number =
      system_trace_audit_number
  end
  @approval_code = approval_code unless approval_code == SKIP
  @response_code = response_code unless response_code == SKIP
  @transaction_id = transaction_id unless transaction_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#approval_codeString

Issuer-generated approval code for the transaction.

Returns:

  • (String)


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

def approval_code
  @approval_code
end

#response_codeString

Transaction status from the processor.

Returns:

  • (String)


24
25
26
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 24

def response_code
  @response_code
end

#system_trace_audit_numberString

This field is returned by authorization and incremental authorization services. System trace number that must be printed on the customer’s receipt.

Returns:

  • (String)


16
17
18
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 16

def system_trace_audit_number
  @system_trace_audit_number
end

#transaction_idString

Network transaction identifier (TID). This value can be used to identify a specific transaction when you are discussing the transaction with your processor.

Returns:

  • (String)


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

def transaction_id
  @transaction_id
end

Class Method Details

.from_element(root) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 99

def self.from_element(root)
  system_trace_audit_number = XmlUtilities.from_element(
    root, 'systemTraceAuditNumber', String
  )
  approval_code = XmlUtilities.from_element(root, 'approvalCode', String)
  response_code = XmlUtilities.from_element(root, 'responseCode', String)
  transaction_id = XmlUtilities.from_element(root, 'transactionId', String)

  new(system_trace_audit_number: system_trace_audit_number,
      approval_code: approval_code,
      response_code: response_code,
      transaction_id: transaction_id,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  system_trace_audit_number =
    hash.key?('systemTraceAuditNumber') ? hash['systemTraceAuditNumber'] : SKIP
  approval_code = hash.key?('approvalCode') ? hash['approvalCode'] : SKIP
  response_code = hash.key?('responseCode') ? hash['responseCode'] : SKIP
  transaction_id = hash.key?('transactionId') ? hash['transactionId'] : 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.
  ProcessorInformation32.new(system_trace_audit_number: system_trace_audit_number,
                             approval_code: approval_code,
                             response_code: response_code,
                             transaction_id: transaction_id,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['system_trace_audit_number'] = 'systemTraceAuditNumber'
  @_hash['approval_code'] = 'approvalCode'
  @_hash['response_code'] = 'responseCode'
  @_hash['transaction_id'] = 'transactionId'
  @_hash
end

.nullablesObject

An array for nullable fields



53
54
55
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 53

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    system_trace_audit_number
    approval_code
    response_code
    transaction_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 137

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} system_trace_audit_number: #{@system_trace_audit_number.inspect},"\
  " approval_code: #{@approval_code.inspect}, response_code: #{@response_code.inspect},"\
  " transaction_id: #{@transaction_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



129
130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 129

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} system_trace_audit_number: #{@system_trace_audit_number}, approval_code:"\
  " #{@approval_code}, response_code: #{@response_code}, transaction_id: #{@transaction_id},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/cyber_source_merged_spec/models/processor_information32.rb', line 114

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

  XmlUtilities.add_as_subelement(doc, root, 'systemTraceAuditNumber',
                                 system_trace_audit_number)
  XmlUtilities.add_as_subelement(doc, root, 'approvalCode', approval_code)
  XmlUtilities.add_as_subelement(doc, root, 'responseCode', response_code)
  XmlUtilities.add_as_subelement(doc, root, 'transactionId', transaction_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end