Class: CyberSourceMergedSpec::MerchantAdvice

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

Overview

MerchantAdvice 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, code_raw: SKIP, name_match: SKIP, additional_properties: nil) ⇒ MerchantAdvice

Returns a new instance of MerchantAdvice.



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

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

  @code = code unless code == SKIP
  @code_raw = code_raw unless code_raw == SKIP
  @name_match = name_match unless name_match == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#codeString

  • Merchant should update their retry logic to ensure retry is not attempted for the cards for which Issuer won’t approve the transactions and where the retry is allowed.
  • Card Processing Associations provides this data which is being passed through in the following data element irrespective of the Card Associations. Usage of this data must be always associated with the Card Associations card types for merchant processing retry logic.
  • In additions to the Merchant Advice code, Associations also provides the decline response codes which provides the reason for decline. Association response code will be a pass-through value.

Processors supported:

- HSBC
- Barclays
- FDC Nash
- FDI Global
- Elavon America
- VPC
- Rede
- Payment tech Salem

Possible values:

| Card Type | Advice Code | Description | | ----------- | ------------- | ------------------------------------------- | | VISA | 1 | Issuer never approves | | VISA | 2 | Issuer cannot approve at this time | | VISA | 3 | Data quality/revalidate payment information | | MasterCard | 01 | New account information available | | MasterCard | 02 | Try Again Later | | MasterCard | 03 | Do Not Try Again | | MasterCard | 04 | Token not supported | | MasterCard | 21 | Do not honor | | MasterCard | 22 | Merchant does not qualify for product code | | MasterCard | 24 | Retry after 1 hour | | MasterCard | 25 | Retry after 24 hours | | MasterCard | 26 | Retry after 2 days | | MasterCard | 27 | Retry after 4 days | | MasterCard | 28 | Retry after 6 days | | MasterCard | 29 | Retry after 8 days | | MasterCard | 30 | Retry after 10 days | | MasterCard | 40 | Consumer non-reloadable prepaid card | | MasterCard | 41 | Consumer single-use virtual card number | | MasterCard | 42 | Sanctions score exceeds threshold value | | MasterCard | 99 | Do Not Try Again |

Possbile values for Barclays processor:

  • 00: No information, or response not provided.
  • 01: New account information available
  • 02: Try again later
  • 03: Do not try again
  • 05: Payment blocked by the payment card company

Returns:

  • (String)


83
84
85
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 83

def code
  @code
end

#code_rawString

Raw merchant advice code sent directly from the processor. This field is used only for Mastercard.

CyberSource through VisaNet

The value for this field corresponds to the following data in the TC 33 capture file1:

  • Record: CP01 TCR7
  • Position: 96-99
  • Field: Response Data-Merchant Advice Code

Possbile values for Barclays processor:

  • 01: Updated/additional information needed
  • 02: Cannot approve at this time; try again later
  • 04: Do not try again
  • 08: Payment blocked by card scheme

Returns:

  • (String)


99
100
101
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 99

def code_raw
  @code_raw
end

#name_matchString

Visa Platform Connect

The field contains will contain the Account Name Request Result for zero amount Authorization request. Valid values are: 00 = Name Match Performed 01 = Name Match not Performed 02 = Name Match not supported

Returns:

  • (String)


108
109
110
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 108

def name_match
  @name_match
end

Class Method Details

.from_element(root) ⇒ Object



167
168
169
170
171
172
173
174
175
176
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 167

def self.from_element(root)
  code = XmlUtilities.from_element(root, 'code', String)
  code_raw = XmlUtilities.from_element(root, 'codeRaw', String)
  name_match = XmlUtilities.from_element(root, 'nameMatch', String)

  new(code: code,
      code_raw: code_raw,
      name_match: name_match,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 145

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : SKIP
  code_raw = hash.key?('codeRaw') ? hash['codeRaw'] : SKIP
  name_match = hash.key?('nameMatch') ? hash['nameMatch'] : 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.
  MerchantAdvice.new(code: code,
                     code_raw: code_raw,
                     name_match: name_match,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



111
112
113
114
115
116
117
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 111

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'code'
  @_hash['code_raw'] = 'codeRaw'
  @_hash['name_match'] = 'nameMatch'
  @_hash
end

.nullablesObject

An array for nullable fields



129
130
131
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 129

def self.nullables
  []
end

.optionalsObject

An array for optional fields



120
121
122
123
124
125
126
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 120

def self.optionals
  %w[
    code
    code_raw
    name_match
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



198
199
200
201
202
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 198

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

#to_sObject

Provides a human-readable string representation of the object.



191
192
193
194
195
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 191

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

#to_xml_element(doc, root_name) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
# File 'lib/cyber_source_merged_spec/models/merchant_advice.rb', line 178

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, 'codeRaw', code_raw)
  XmlUtilities.add_as_subelement(doc, root, 'nameMatch', name_match)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end