Class: CyberSourceMergedSpec::ProcessorInformation30

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

Overview

ProcessorInformation30 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(approval_code: SKIP, response_code: SKIP, transaction_id: SKIP, system_trace_audit_number: SKIP, response_code_source: SKIP, merchant_advice: SKIP, avs: SKIP, customer: SKIP, electronic_verification_results: SKIP, card_verification: SKIP, additional_properties: nil) ⇒ ProcessorInformation30

Returns a new instance of ProcessorInformation30.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 106

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

  @approval_code = approval_code unless approval_code == SKIP
  @response_code = response_code unless response_code == SKIP
  @transaction_id = transaction_id unless transaction_id == SKIP
  unless system_trace_audit_number == SKIP
    @system_trace_audit_number =
      system_trace_audit_number
  end
  @response_code_source = response_code_source unless response_code_source == SKIP
  @merchant_advice = merchant_advice unless merchant_advice == SKIP
  @avs = avs unless avs == SKIP
  @customer = customer unless customer == SKIP
  unless electronic_verification_results == SKIP
    @electronic_verification_results =
      electronic_verification_results
  end
  @card_verification = card_verification unless card_verification == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#approval_codeString

Issuer-generated approval code for the transaction.

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 14

def approval_code
  @approval_code
end

#avsAvs4

Used by Visa only and contains the response source/reason code that identifies the source of the response decision.

Returns:



51
52
53
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 51

def avs
  @avs
end

#card_verificationCardVerification1

Used by Visa only and contains the response source/reason code that identifies the source of the response decision.

Returns:



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

def card_verification
  @card_verification
end

#customerCustomer54

Used by Visa only and contains the response source/reason code that identifies the source of the response decision.

Returns:



56
57
58
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 56

def customer
  @customer
end

#electronic_verification_resultsElectronicVerificationResults1

Used by Visa only and contains the response source/reason code that identifies the source of the response decision.



61
62
63
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 61

def electronic_verification_results
  @electronic_verification_results
end

#merchant_adviceMerchantAdvice2

Used by Visa only and contains the response source/reason code that identifies the source of the response decision.

Returns:



46
47
48
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 46

def merchant_advice
  @merchant_advice
end

#response_codeString

Transaction status from the processor.

Returns:

  • (String)


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

def response_code
  @response_code
end

#response_code_sourceString

Used by Visa only and contains the response source/reason code that identifies the source of the response decision.

Returns:

  • (String)


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

def response_code_source
  @response_code_source
end

#system_trace_audit_numberString

This field is returned only for American Express Direct and CyberSource through VisaNet. Returned by authorization and incremental authorization services.

American Express Direct

System trace audit number (STAN). This value identifies the transaction and is useful when investigating a chargeback dispute.

CyberSource through VisaNet

System trace number that must be printed on the customer’s receipt.

Returns:

  • (String)


36
37
38
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 36

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)


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

def transaction_id
  @transaction_id
end

Class Method Details

.from_element(root) ⇒ Object



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
202
203
204
205
206
207
208
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 176

def self.from_element(root)
  approval_code = XmlUtilities.from_element(root, 'approvalCode', String)
  response_code = XmlUtilities.from_element(root, 'responseCode', String)
  transaction_id = XmlUtilities.from_element(root, 'transactionId', String)
  system_trace_audit_number = XmlUtilities.from_element(
    root, 'systemTraceAuditNumber', String
  )
  response_code_source = XmlUtilities.from_element(root,
                                                   'responseCodeSource',
                                                   String)
  merchant_advice = XmlUtilities.from_element(root, 'MerchantAdvice2',
                                              MerchantAdvice2)
  avs = XmlUtilities.from_element(root, 'Avs4', Avs4)
  customer = XmlUtilities.from_element(root, 'Customer54', Customer54)
  electronic_verification_results = XmlUtilities.from_element(
    root, 'ElectronicVerificationResults1',
    ElectronicVerificationResults1
  )
  card_verification = XmlUtilities.from_element(root, 'CardVerification1',
                                                CardVerification1)

  new(approval_code: approval_code,
      response_code: response_code,
      transaction_id: transaction_id,
      system_trace_audit_number: system_trace_audit_number,
      response_code_source: response_code_source,
      merchant_advice: merchant_advice,
      avs: avs,
      customer: customer,
      electronic_verification_results: electronic_verification_results,
      card_verification: card_verification,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
168
169
170
171
172
173
174
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 134

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  approval_code = hash.key?('approvalCode') ? hash['approvalCode'] : SKIP
  response_code = hash.key?('responseCode') ? hash['responseCode'] : SKIP
  transaction_id = hash.key?('transactionId') ? hash['transactionId'] : SKIP
  system_trace_audit_number =
    hash.key?('systemTraceAuditNumber') ? hash['systemTraceAuditNumber'] : SKIP
  response_code_source =
    hash.key?('responseCodeSource') ? hash['responseCodeSource'] : SKIP
  merchant_advice = MerchantAdvice2.from_hash(hash['merchantAdvice']) if
    hash['merchantAdvice']
  avs = Avs4.from_hash(hash['avs']) if hash['avs']
  customer = Customer54.from_hash(hash['customer']) if hash['customer']
  if hash['electronicVerificationResults']
    electronic_verification_results = ElectronicVerificationResults1.from_hash(hash['electronicVerificationResults'])
  end
  card_verification = CardVerification1.from_hash(hash['cardVerification']) if
    hash['cardVerification']

  # 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.
  ProcessorInformation30.new(approval_code: approval_code,
                             response_code: response_code,
                             transaction_id: transaction_id,
                             system_trace_audit_number: system_trace_audit_number,
                             response_code_source: response_code_source,
                             merchant_advice: merchant_advice,
                             avs: avs,
                             customer: customer,
                             electronic_verification_results: electronic_verification_results,
                             card_verification: card_verification,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['approval_code'] = 'approvalCode'
  @_hash['response_code'] = 'responseCode'
  @_hash['transaction_id'] = 'transactionId'
  @_hash['system_trace_audit_number'] = 'systemTraceAuditNumber'
  @_hash['response_code_source'] = 'responseCodeSource'
  @_hash['merchant_advice'] = 'merchantAdvice'
  @_hash['avs'] = 'avs'
  @_hash['customer'] = 'customer'
  @_hash['electronic_verification_results'] =
    'electronicVerificationResults'
  @_hash['card_verification'] = 'cardVerification'
  @_hash
end

.nullablesObject

An array for nullable fields



102
103
104
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 102

def self.nullables
  []
end

.optionalsObject

An array for optional fields



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 86

def self.optionals
  %w[
    approval_code
    response_code
    transaction_id
    system_trace_audit_number
    response_code_source
    merchant_advice
    avs
    customer
    electronic_verification_results
    card_verification
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



247
248
249
250
251
252
253
254
255
256
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 247

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

#to_sObject

Provides a human-readable string representation of the object.



236
237
238
239
240
241
242
243
244
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 236

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

#to_xml_element(doc, root_name) ⇒ Object



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/cyber_source_merged_spec/models/processor_information30.rb', line 210

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

  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, 'systemTraceAuditNumber',
                                 system_trace_audit_number)
  XmlUtilities.add_as_subelement(doc, root, 'responseCodeSource',
                                 response_code_source)
  XmlUtilities.add_as_subelement(doc, root, 'MerchantAdvice2',
                                 merchant_advice)
  XmlUtilities.add_as_subelement(doc, root, 'Avs4', avs)
  XmlUtilities.add_as_subelement(doc, root, 'Customer54', customer)
  XmlUtilities.add_as_subelement(doc, root,
                                 'ElectronicVerificationResults1',
                                 electronic_verification_results)
  XmlUtilities.add_as_subelement(doc, root, 'CardVerification1',
                                 card_verification)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end