Class: CyberSourceMergedSpec::MarkingDetails1

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

Overview

Details for marking the transaction.

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(notes: SKIP, reason: SKIP, fields_included: SKIP, action: SKIP, additional_properties: nil) ⇒ MarkingDetails1

Returns a new instance of MarkingDetails1.



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

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

  @notes = notes unless notes == SKIP
  @reason = reason unless reason == SKIP
  @fields_included = fields_included unless fields_included == SKIP
  @action = action unless action == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#actionString

This field can contain one of the following values:

  • add: Mark as Suspect.
  • clear: Clear Mark as Suspect.
  • hide: Remove from history.

Returns:

  • (String)


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

def action
  @action
end

#fields_includedArray[String]

This field can contain one or more of the following values. When you specify more than one value, separate them with commas (,).

  • account_key_hash
  • customer_account_id
  • customer_email
  • customer_ipaddress
  • customer_phone
  • device_fingerprint
  • ship_address If no value is specified, account_key_hash, customer_email, and ship_address are used by default. Note account_key_hash adds the field that contains the card number (customer_cc_number).

Returns:

  • (Array[String])


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

def fields_included
  @fields_included
end

#notesString

Notes or details that explain the reasons for marking the transaction as suspect or otherwise.

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/marking_details1.rb', line 15

def notes
  @notes
end

#reasonString

Reason for marking the transaction as suspect or otherwise. This field can contain one of the following values:

  • fraud_chargeback: You have received a fraud-related chargeback for the transaction.
  • non_fraud_chargeback: You have received a non-fraudulent chargeback for the transaction.
  • suspected: You believe that you will probably receive a chargeback for the transaction.
  • creditback: You issued a refund to the customer to avoid a chargeback for the transaction.

Returns:

  • (String)


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

def reason
  @reason
end

Class Method Details

.from_element(root) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/cyber_source_merged_spec/models/marking_details1.rb', line 116

def self.from_element(root)
  notes = XmlUtilities.from_element(root, 'notes', String)
  reason = XmlUtilities.from_element(root, 'reason', String)
  fields_included = XmlUtilities.from_element_to_array(root,
                                                       'fieldsIncluded',
                                                       String)
  action = XmlUtilities.from_element(root, 'action', String)

  new(notes: notes,
      reason: reason,
      fields_included: fields_included,
      action: action,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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/marking_details1.rb', line 91

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  notes = hash.key?('notes') ? hash['notes'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  fields_included =
    hash.key?('fieldsIncluded') ? hash['fieldsIncluded'] : SKIP
  action = hash.key?('action') ? hash['action'] : 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.
  MarkingDetails1.new(notes: notes,
                      reason: reason,
                      fields_included: fields_included,
                      action: action,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['notes'] = 'notes'
  @_hash['reason'] = 'reason'
  @_hash['fields_included'] = 'fieldsIncluded'
  @_hash['action'] = 'action'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/cyber_source_merged_spec/models/marking_details1.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
# File 'lib/cyber_source_merged_spec/models/marking_details1.rb', line 64

def self.optionals
  %w[
    notes
    reason
    fields_included
    action
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



153
154
155
156
157
158
# File 'lib/cyber_source_merged_spec/models/marking_details1.rb', line 153

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

#to_sObject

Provides a human-readable string representation of the object.



146
147
148
149
150
# File 'lib/cyber_source_merged_spec/models/marking_details1.rb', line 146

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

#to_xml_element(doc, root_name) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/cyber_source_merged_spec/models/marking_details1.rb', line 131

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

  XmlUtilities.add_as_subelement(doc, root, 'notes', notes)
  XmlUtilities.add_as_subelement(doc, root, 'reason', reason)
  XmlUtilities.add_array_as_subelement(doc, root, 'fieldsIncluded',
                                       fields_included)
  XmlUtilities.add_as_subelement(doc, root, 'action', action)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end