Class: CyberSourceMergedSpec::Application1

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

Overview

Application1 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(name: SKIP, reason_code: SKIP, status: SKIP, reason: SKIP, r_code: SKIP, r_flag: SKIP, reconciliation_id: SKIP, r_message: SKIP, return_code: SKIP, additional_properties: nil) ⇒ Application1

Returns a new instance of Application1.



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

def initialize(name: SKIP, reason_code: SKIP, status: SKIP, reason: SKIP,
               r_code: SKIP, r_flag: SKIP, reconciliation_id: SKIP,
               r_message: SKIP, return_code: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @name = name unless name == SKIP
  @reason_code = reason_code unless reason_code == SKIP
  @status = status unless status == SKIP
  @reason = reason unless reason == SKIP
  @r_code = r_code unless r_code == SKIP
  @r_flag = r_flag unless r_flag == SKIP
  @reconciliation_id = reconciliation_id unless reconciliation_id == SKIP
  @r_message = r_message unless r_message == SKIP
  @return_code = return_code unless return_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#nameString

The name of the CyberSource transaction type (such as CC settlement or CC authorization) that the merchant wants to process in a transaction request. More than one transaction type can included in a transaction request. Each transaction type separately returns their own status, reasonCode, rCode, and rFlag messages.

Returns:

  • (String)


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

def name
  @name
end

#r_codeString

Indicates whether the service request was successful. Possible values:

  • -1: An error occurred.
  • 0: The request was declined.
  • 1: The request was successful.

Returns:

  • (String)


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

def r_code
  @r_code
end

#r_flagString

One-word description of the result of the application.

Returns:

  • (String)


45
46
47
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 45

def r_flag
  @r_flag
end

#r_messageString

Message that explains the reply flag for the application.

Returns:

  • (String)


54
55
56
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 54

def r_message
  @r_message
end

#reasonString

Description of why a request failed. Note: This field may not be returned for all transactions.

Returns:

  • (String)


33
34
35
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 33

def reason
  @reason
end

#reason_codeString

3-digit reason code that indicates why the customer profile payment succeeded or failed.

Returns:

  • (String)


23
24
25
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 23

def reason_code
  @reason_code
end

#reconciliation_idString

Reference number that you use to reconcile your CyberSource reports with your processor reports.

Returns:

  • (String)


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

def reconciliation_id
  @reconciliation_id
end

#return_codeInteger

The description for this field is not available.

Returns:

  • (Integer)


58
59
60
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 58

def return_code
  @return_code
end

#statusString

The status of the submitted transaction. Note: This field may not be returned for all transactions.

Returns:

  • (String)


28
29
30
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 28

def status
  @status
end

Class Method Details

.from_element(root) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 150

def self.from_element(root)
  name = XmlUtilities.from_element(root, 'name', String)
  reason_code = XmlUtilities.from_element(root, 'reasonCode', String)
  status = XmlUtilities.from_element(root, 'status', String)
  reason = XmlUtilities.from_element(root, 'reason', String)
  r_code = XmlUtilities.from_element(root, 'rCode', String)
  r_flag = XmlUtilities.from_element(root, 'rFlag', String)
  reconciliation_id = XmlUtilities.from_element(root, 'reconciliationId',
                                                String)
  r_message = XmlUtilities.from_element(root, 'rMessage', String)
  return_code = XmlUtilities.from_element(root, 'returnCode', Integer)

  new(name: name,
      reason_code: reason_code,
      status: status,
      reason: reason,
      r_code: r_code,
      r_flag: r_flag,
      reconciliation_id: reconciliation_id,
      r_message: r_message,
      return_code: return_code,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 115

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  reason_code = hash.key?('reasonCode') ? hash['reasonCode'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  r_code = hash.key?('rCode') ? hash['rCode'] : SKIP
  r_flag = hash.key?('rFlag') ? hash['rFlag'] : SKIP
  reconciliation_id =
    hash.key?('reconciliationId') ? hash['reconciliationId'] : SKIP
  r_message = hash.key?('rMessage') ? hash['rMessage'] : SKIP
  return_code = hash.key?('returnCode') ? hash['returnCode'] : 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.
  Application1.new(name: name,
                   reason_code: reason_code,
                   status: status,
                   reason: reason,
                   r_code: r_code,
                   r_flag: r_flag,
                   reconciliation_id: reconciliation_id,
                   r_message: r_message,
                   return_code: return_code,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['reason_code'] = 'reasonCode'
  @_hash['status'] = 'status'
  @_hash['reason'] = 'reason'
  @_hash['r_code'] = 'rCode'
  @_hash['r_flag'] = 'rFlag'
  @_hash['reconciliation_id'] = 'reconciliationId'
  @_hash['r_message'] = 'rMessage'
  @_hash['return_code'] = 'returnCode'
  @_hash
end

.nullablesObject

An array for nullable fields



91
92
93
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 91

def self.nullables
  []
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 76

def self.optionals
  %w[
    name
    reason_code
    status
    reason
    r_code
    r_flag
    reconciliation_id
    r_message
    return_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



203
204
205
206
207
208
209
210
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 203

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, reason_code: #{@reason_code.inspect}, status:"\
  " #{@status.inspect}, reason: #{@reason.inspect}, r_code: #{@r_code.inspect}, r_flag:"\
  " #{@r_flag.inspect}, reconciliation_id: #{@reconciliation_id.inspect}, r_message:"\
  " #{@r_message.inspect}, return_code: #{@return_code.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



194
195
196
197
198
199
200
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 194

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, reason_code: #{@reason_code}, status: #{@status}, reason:"\
  " #{@reason}, r_code: #{@r_code}, r_flag: #{@r_flag}, reconciliation_id:"\
  " #{@reconciliation_id}, r_message: #{@r_message}, return_code: #{@return_code},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/cyber_source_merged_spec/models/application1.rb', line 174

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

  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'reasonCode', reason_code)
  XmlUtilities.add_as_subelement(doc, root, 'status', status)
  XmlUtilities.add_as_subelement(doc, root, 'reason', reason)
  XmlUtilities.add_as_subelement(doc, root, 'rCode', r_code)
  XmlUtilities.add_as_subelement(doc, root, 'rFlag', r_flag)
  XmlUtilities.add_as_subelement(doc, root, 'reconciliationId',
                                 reconciliation_id)
  XmlUtilities.add_as_subelement(doc, root, 'rMessage', r_message)
  XmlUtilities.add_as_subelement(doc, root, 'returnCode', return_code)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end