Class: CyberSourceMergedSpec::ErrorInformation30

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

Overview

ErrorInformation30 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(reason: SKIP, message: SKIP, details: SKIP, additional_properties: nil) ⇒ ErrorInformation30

Returns a new instance of ErrorInformation30.



73
74
75
76
77
78
79
80
81
82
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 73

def initialize(reason: SKIP, message: SKIP, details: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @reason = reason unless reason == SKIP
  @message = message unless message == SKIP
  @details = details unless details == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#detailsArray[Detail102]

The detail message related to the status and reason listed above.

Returns:



48
49
50
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 48

def details
  @details
end

#messageString

The detail message related to the status and reason listed above.

Returns:

  • (String)


44
45
46
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 44

def message
  @message
end

#reasonString

The reason of the status. Possible values:

  • CONTACT_PROCESSOR
  • INVALID_MERCHANT_CONFIGURATION
  • STOLEN_LOST_CARD
  • PROCESSOR_DECLINED
  • PARTIAL_APPROVAL
  • PAYMENT_REFUSED
  • INVALID_ACCOUNT
  • ISSUER_UNAVAILABLE
  • INSUFFICIENT_FUND
  • EXPIRED_CARD
  • INVALID_PIN
  • UNAUTHORIZED_CARD
  • EXCEEDS_CREDIT_LIMIT
  • DEBIT_CARD_USAGE_LIMIT_EXCEEDED
  • CVN_NOT_MATCH
  • DUPLICATE_REQUEST
  • GENERAL_DECLINE
  • BLACKLISTED_CUSTOMER
  • GATEWAY_TIMEOUT
  • INVALID_DATA
  • SYSTEM_ERROR
  • SERVICE_UNAVAILABLE
  • PROCESSOR_TIMEOUT
  • PAYMENT_REJECTED
  • PULL_PAYMENT_REFUSED

Returns:

  • (String)


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

def reason
  @reason
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  reason = XmlUtilities.from_element(root, 'reason', String)
  message = XmlUtilities.from_element(root, 'message', String)
  details = XmlUtilities.from_element_to_array(root, 'Detail102', Detail102)

  new(reason: reason,
      message: message,
      details: details,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
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
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  message = hash.key?('message') ? hash['message'] : SKIP
  # Parameter is an array, so we need to iterate through it
  details = nil
  unless hash['details'].nil?
    details = []
    hash['details'].each do |structure|
      details << (Detail102.from_hash(structure) if structure)
    end
  end

  details = SKIP unless hash.key?('details')

  # 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.
  ErrorInformation30.new(reason: reason,
                         message: message,
                         details: details,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reason'] = 'reason'
  @_hash['message'] = 'message'
  @_hash['details'] = 'details'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 69

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    reason
    message
    details
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



147
148
149
150
151
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 147

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} reason: #{@reason.inspect}, message: #{@message.inspect}, details:"\
  " #{@details.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



140
141
142
143
144
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 140

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} reason: #{@reason}, message: #{@message}, details: #{@details},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/cyber_source_merged_spec/models/error_information30.rb', line 127

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

  XmlUtilities.add_as_subelement(doc, root, 'reason', reason)
  XmlUtilities.add_as_subelement(doc, root, 'message', message)
  XmlUtilities.add_array_as_subelement(doc, root, 'Detail102', details)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end