Class: CyberSourceMergedSpec::MarkingDetails

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

Overview

Details for marking the transaction as either positive or negative.

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, record_name: SKIP, action: SKIP, additional_properties: nil) ⇒ MarkingDetails

Returns a new instance of MarkingDetails.



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

def initialize(notes: SKIP, reason: SKIP, record_name: 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
  @record_name = record_name unless record_name == SKIP
  @action = action unless action == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#actionString

Indicates whether to add to or remove a customer’s identity from the negative or positive list. This field can contain one of the following values:

  • add: Add information to the list.
  • convert: moves the data.
  • delete: deletes the data from the list.

Returns:

  • (String)


47
48
49
# File 'lib/cyber_source_merged_spec/models/marking_details.rb', line 47

def action
  @action
end

#notesString

Notes or details that explain the reasons for adding the transaction to either the positive or negative list.

Returns:

  • (String)


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

def notes
  @notes
end

#reasonString

Reason for adding the transaction to the negative list. 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_details.rb', line 28

def reason
  @reason
end

#record_nameString

Name of the customer’s record entered in the list. For the positive list, it is required if action_ code=add_positive. If absent from the request, ics_risk_update creates the value for this field by concatenating the customer’s first and last names. For the negative and the review lists, record_name, customer_firstname, and customer_lastname are optional.

Returns:

  • (String)


38
39
40
# File 'lib/cyber_source_merged_spec/models/marking_details.rb', line 38

def record_name
  @record_name
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  notes = XmlUtilities.from_element(root, 'notes', String)
  reason = XmlUtilities.from_element(root, 'reason', String)
  record_name = XmlUtilities.from_element(root, 'recordName', String)
  action = XmlUtilities.from_element(root, 'action', String)

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/cyber_source_merged_spec/models/marking_details.rb', line 87

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
  record_name = hash.key?('recordName') ? hash['recordName'] : 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.
  MarkingDetails.new(notes: notes,
                     reason: reason,
                     record_name: record_name,
                     action: action,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/cyber_source_merged_spec/models/marking_details.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
# File 'lib/cyber_source_merged_spec/models/marking_details.rb', line 138

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

#to_xml_element(doc, root_name) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/marking_details.rb', line 124

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_as_subelement(doc, root, 'recordName', record_name)
  XmlUtilities.add_as_subelement(doc, root, 'action', action)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end