Class: CyberSourceMergedSpec::Watchlistscreening

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

Overview

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

Returns a new instance of Watchlistscreening.



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

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

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

Instance Attribute Details

#messageString

The message describing the reason of the status. Value can be

  • The customer matched the Denied Parties List
  • The Export bill_country/ship_country match
  • Export email_country match
  • Export hostname_country/ip_country match

Returns:

  • (String)


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

def message
  @message
end

#reasonString

The reason of the status. Value can be

  • CUSTOMER_WATCHLIST_MATCH
  • ADDRESS_COUNTRY_WATCHLIST_MATCH
  • EMAIL_COUNTRY_WATCHLIST_MATCH
  • IP_COUNTRY_WATCHLIST_MATCH
  • INVALID_MERCHANT_CONFIGURATION

Returns:

  • (String)


26
27
28
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 26

def reason
  @reason
end

#statusString

The status for the call can be:

  • COMPLETED
  • INVALID_REQUEST
  • DECLINED

Returns:

  • (String)


17
18
19
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 17

def status
  @status
end

Class Method Details

.from_element(root) ⇒ Object



93
94
95
96
97
98
99
100
101
102
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 93

def self.from_element(root)
  status = XmlUtilities.from_element(root, 'status', String)
  reason = XmlUtilities.from_element(root, 'reason', String)
  message = XmlUtilities.from_element(root, 'message', String)

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  message = hash.key?('message') ? hash['message'] : 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.
  Watchlistscreening.new(status: status,
                         reason: reason,
                         message: message,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 37

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

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 46

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



124
125
126
127
128
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 124

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

#to_sObject

Provides a human-readable string representation of the object.



117
118
119
120
121
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 117

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

#to_xml_element(doc, root_name) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cyber_source_merged_spec/models/watchlistscreening.rb', line 104

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

  XmlUtilities.add_as_subelement(doc, root, 'status', status)
  XmlUtilities.add_as_subelement(doc, root, 'reason', reason)
  XmlUtilities.add_as_subelement(doc, root, 'message', message)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end