Class: CyberSourceMergedSpec::AuthorizationInformation

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

Overview

AuthorizationInformation 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, reason_code: SKIP, reversal_submitted: SKIP, additional_properties: nil) ⇒ AuthorizationInformation

Returns a new instance of AuthorizationInformation.



53
54
55
56
57
58
59
60
61
62
# File 'lib/cyber_source_merged_spec/models/authorization_information.rb', line 53

def initialize(approval_code: SKIP, reason_code: SKIP,
               reversal_submitted: 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
  @reason_code = reason_code unless reason_code == SKIP
  @reversal_submitted =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#approval_codeString

The authorization code returned by the processor.

Returns:

  • (String)


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

def approval_code
  @approval_code
end

#reason_codeString

Reply flag for the original transaction.

Returns:

  • (String)


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

def reason_code
  @reason_code
end

#reversal_submittedString

Flag indicating whether a full authorization reversal was successfully submitted. Possible values:

  • Y: The authorization reversal was successfully submitted.
  • N: The authorization reversal was not successfully submitted. You must send a credit request for a refund. This field is supported only for FDC Nashville Global.

Returns:

  • (String)


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

def 
  @reversal_submitted
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  approval_code = XmlUtilities.from_element(root, 'approvalCode', String)
  reason_code = XmlUtilities.from_element(root, 'reasonCode', String)
   = XmlUtilities.from_element(root, 'reversalSubmitted',
                                                 String)

  new(approval_code: approval_code,
      reason_code: reason_code,
      reversal_submitted: ,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/cyber_source_merged_spec/models/authorization_information.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  approval_code = hash.key?('approvalCode') ? hash['approvalCode'] : SKIP
  reason_code = hash.key?('reasonCode') ? hash['reasonCode'] : SKIP
   =
    hash.key?('reversalSubmitted') ? hash['reversalSubmitted'] : 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.
  AuthorizationInformation.new(approval_code: approval_code,
                               reason_code: reason_code,
                               reversal_submitted: ,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
# File 'lib/cyber_source_merged_spec/models/authorization_information.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['approval_code'] = 'approvalCode'
  @_hash['reason_code'] = 'reasonCode'
  @_hash['reversal_submitted'] = 'reversalSubmitted'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/cyber_source_merged_spec/models/authorization_information.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
# File 'lib/cyber_source_merged_spec/models/authorization_information.rb', line 40

def self.optionals
  %w[
    approval_code
    reason_code
    reversal_submitted
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
# File 'lib/cyber_source_merged_spec/models/authorization_information.rb', line 122

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

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/cyber_source_merged_spec/models/authorization_information.rb', line 114

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

#to_xml_element(doc, root_name) ⇒ Object



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

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, 'reasonCode', reason_code)
  XmlUtilities.add_as_subelement(doc, root, 'reversalSubmitted',
                                 )
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end