Class: CyberSourceMergedSpec::ResponseInsights

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

Overview

ResponseInsights 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(category: SKIP, category_code: SKIP, processor_raw_name: SKIP, additional_properties: nil) ⇒ ResponseInsights

Returns a new instance of ResponseInsights.



65
66
67
68
69
70
71
72
73
74
# File 'lib/cyber_source_merged_spec/models/response_insights.rb', line 65

def initialize(category: SKIP, category_code: SKIP,
               processor_raw_name: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @category = category unless category == SKIP
  @category_code = category_code unless category_code == SKIP
  @processor_raw_name = processor_raw_name unless processor_raw_name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#categoryString

Categorization of response message from processor Possible Values:

  • ISSUER_WILL_NEVER_APPROVE
  • ISSUER_CANNOT_APPROVE_AT_THIS_TIME
  • ISSUER_CANNOT_APPROVE_WITH_THESE_DETAILS
  • GENERIC_ERROR
  • PAYMENT_INSIGHTS_INTERNAL_ERROR
  • OTHERS
  • PAYMENT_INSIGHTS_RESPONSE_CATEGORY_MATCH_NOT_FOUND

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/response_insights.rb', line 22

def category
  @category
end

#category_codeString

Categorization Code of response message from processor Possible Values:

  • 01 : ISSUER_WILL_NEVER_APPROVE
  • 02 : ISSUER_CANNOT_APPROVE_AT_THIS_TIME
  • 03 : ISSUER_CANNOT_APPROVE_WITH_THESE_DETAILS
  • 04 : GENERIC_ERROR
  • 97 : PAYMENT_INSIGHTS_INTERNAL_ERROR
  • 98 : OTHERS
  • 99 : PAYMENT_INSIGHTS_RESPONSE_CATEGORY_MATCH_NOT_FOUND

Returns:

  • (String)


34
35
36
# File 'lib/cyber_source_merged_spec/models/response_insights.rb', line 34

def category_code
  @category_code
end

#processor_raw_nameString

Raw name of the processor used for the transaction processing, especially useful during acquirer swing to see which processor transaction settled with

Returns:

  • (String)


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

def processor_raw_name
  @processor_raw_name
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  category = XmlUtilities.from_element(root, 'category', String)
  category_code = XmlUtilities.from_element(root, 'categoryCode', String)
  processor_raw_name = XmlUtilities.from_element(root, 'processorRawName',
                                                 String)

  new(category: category,
      category_code: category_code,
      processor_raw_name: processor_raw_name,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  category = hash.key?('category') ? hash['category'] : SKIP
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP
  processor_raw_name =
    hash.key?('processorRawName') ? hash['processorRawName'] : 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.
  ResponseInsights.new(category: category,
                       category_code: category_code,
                       processor_raw_name: processor_raw_name,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['category'] = 'category'
  @_hash['category_code'] = 'categoryCode'
  @_hash['processor_raw_name'] = 'processorRawName'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    category
    category_code
    processor_raw_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



134
135
136
137
138
139
# File 'lib/cyber_source_merged_spec/models/response_insights.rb', line 134

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

#to_sObject

Provides a human-readable string representation of the object.



126
127
128
129
130
131
# File 'lib/cyber_source_merged_spec/models/response_insights.rb', line 126

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

#to_xml_element(doc, root_name) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cyber_source_merged_spec/models/response_insights.rb', line 112

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

  XmlUtilities.add_as_subelement(doc, root, 'category', category)
  XmlUtilities.add_as_subelement(doc, root, 'categoryCode', category_code)
  XmlUtilities.add_as_subelement(doc, root, 'processorRawName',
                                 processor_raw_name)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end