Class: CyberSourceMergedSpec::ExportComplianceInformation1

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

Overview

ExportComplianceInformation1 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(ip_country_confidence: SKIP, info_codes: SKIP, watch_list: SKIP, additional_properties: nil) ⇒ ExportComplianceInformation1

Returns a new instance of ExportComplianceInformation1.



70
71
72
73
74
75
76
77
78
79
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 70

def initialize(ip_country_confidence: SKIP, info_codes: SKIP,
               watch_list: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @ip_country_confidence = ip_country_confidence unless ip_country_confidence == SKIP
  @info_codes = info_codes unless info_codes == SKIP
  @watch_list = watch_list unless watch_list == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#info_codesArray[String]

Returned when the Denied Parties List check (first two codes) or the export service (all others) would have declined the transaction. This field can contain one or more of these values:

  • MATCH-DPC: Denied Parties List match.
  • UNV-DPC: Denied Parties List unavailable.
  • MATCH-BCO: Billing country restricted.
  • MATCH-EMCO: Email country restricted.
  • MATCH-HCO: Host name country restricted.
  • MATCH-IPCO: IP country restricted.
  • MATCH-SCO: Shipping country restricted.

Returns:

  • (Array[String])


31
32
33
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 31

def info_codes
  @info_codes
end

#ip_country_confidenceInteger

Likelihood that the country associated with the customer’s IP address was identified correctly. Returns a value from 1–100, where 100 indicates the highest likelihood. If the country cannot be determined, the value is –1.

Returns:

  • (Integer)


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

def ip_country_confidence
  @ip_country_confidence
end

#watch_listExportComplianceWatchList

Returned when the Denied Parties List check (first two codes) or the export service (all others) would have declined the transaction. This field can contain one or more of these values:

  • MATCH-DPC: Denied Parties List match.
  • UNV-DPC: Denied Parties List unavailable.
  • MATCH-BCO: Billing country restricted.
  • MATCH-EMCO: Email country restricted.
  • MATCH-HCO: Host name country restricted.
  • MATCH-IPCO: IP country restricted.
  • MATCH-SCO: Shipping country restricted.


45
46
47
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 45

def watch_list
  @watch_list
end

Class Method Details

.from_element(root) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 105

def self.from_element(root)
  ip_country_confidence = XmlUtilities.from_element(root,
                                                    'ipCountryConfidence',
                                                    Integer)
  info_codes = XmlUtilities.from_element_to_array(root, 'infoCodes', String)
  watch_list = XmlUtilities.from_element(root, 'exportComplianceWatchList',
                                         ExportComplianceWatchList)

  new(ip_country_confidence: ip_country_confidence,
      info_codes: info_codes,
      watch_list: watch_list,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ip_country_confidence =
    hash.key?('ipCountryConfidence') ? hash['ipCountryConfidence'] : SKIP
  info_codes = hash.key?('infoCodes') ? hash['infoCodes'] : SKIP
  watch_list = ExportComplianceWatchList.from_hash(hash['watchList']) if hash['watchList']

  # 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.
  ExportComplianceInformation1.new(ip_country_confidence: ip_country_confidence,
                                   info_codes: info_codes,
                                   watch_list: watch_list,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ip_country_confidence'] = 'ipCountryConfidence'
  @_hash['info_codes'] = 'infoCodes'
  @_hash['watch_list'] = 'watchList'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



57
58
59
60
61
62
63
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 57

def self.optionals
  %w[
    ip_country_confidence
    info_codes
    watch_list
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



142
143
144
145
146
147
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 142

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

#to_sObject

Provides a human-readable string representation of the object.



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

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

#to_xml_element(doc, root_name) ⇒ Object



119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/cyber_source_merged_spec/models/export_compliance_information1.rb', line 119

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

  XmlUtilities.add_as_subelement(doc, root, 'ipCountryConfidence',
                                 ip_country_confidence)
  XmlUtilities.add_array_as_subelement(doc, root, 'infoCodes', info_codes)
  XmlUtilities.add_as_subelement(doc, root, 'exportComplianceWatchList',
                                 watch_list)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end