Class: CyberSourceMergedSpec::ClientReferenceInformaton

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

Overview

ClientReferenceInformaton 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(code: SKIP, comments: SKIP, partner: SKIP, additional_properties: nil) ⇒ ClientReferenceInformaton

Returns a new instance of ClientReferenceInformaton.



66
67
68
69
70
71
72
73
74
75
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 66

def initialize(code: SKIP, comments: SKIP, partner: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @code = code unless code == SKIP
  @comments = comments unless comments == SKIP
  @partner = partner unless partner == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#codeString

Merchant-generated order reference or tracking number. It is recommended that you send a unique value for each transaction so that you can perform meaningful searches for the transaction.

Used by

Authorization Required field.

PIN Debit

Requests for PIN debit reversals need to use the same merchant reference number that was used in the transaction that is being reversed. Required field for all PIN Debit requests (purchase, credit, and reversal).

FDC Nashville Global

Certain circumstances can cause the processor to truncate this value to 15 or 17 characters for Level II and Level III processing, which can cause a discrepancy between the value you submit and the value included in some processor reports.

Returns:

  • (String)


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

def code
  @code
end

#commentsString

Brief description of the order or any comment you wish to add to the order.

Returns:

  • (String)


36
37
38
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 36

def comments
  @comments
end

#partnerPartner16

Brief description of the order or any comment you wish to add to the order.

Returns:



41
42
43
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 41

def partner
  @partner
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  code = XmlUtilities.from_element(root, 'code', String)
  comments = XmlUtilities.from_element(root, 'comments', String)
  partner = XmlUtilities.from_element(root, 'Partner16', Partner16)

  new(code: code,
      comments: comments,
      partner: partner,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 78

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : SKIP
  comments = hash.key?('comments') ? hash['comments'] : SKIP
  partner = Partner16.from_hash(hash['partner']) if hash['partner']

  # 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.
  ClientReferenceInformaton.new(code: code,
                                comments: comments,
                                partner: partner,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'code'
  @_hash['comments'] = 'comments'
  @_hash['partner'] = 'partner'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 53

def self.optionals
  %w[
    code
    comments
    partner
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/client_reference_informaton.rb', line 131

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

#to_sObject

Provides a human-readable string representation of the object.



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

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

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'code', code)
  XmlUtilities.add_as_subelement(doc, root, 'comments', comments)
  XmlUtilities.add_as_subelement(doc, root, 'Partner16', partner)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end