Class: CyberSourceMergedSpec::MerchantInformation12

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

Overview

MerchantInformation12 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(merchant_descriptor: SKIP, category_code: SKIP, administrative_area: SKIP, transaction_local_date_time: SKIP, cancel_url: SKIP, success_url: SKIP, failure_url: SKIP, additional_properties: nil) ⇒ MerchantInformation12

Returns a new instance of MerchantInformation12.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 126

def initialize(merchant_descriptor: SKIP, category_code: SKIP,
               administrative_area: SKIP, transaction_local_date_time: SKIP,
               cancel_url: SKIP, success_url: SKIP, failure_url: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @merchant_descriptor = merchant_descriptor unless merchant_descriptor == SKIP
  @category_code = category_code unless category_code == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  unless transaction_local_date_time == SKIP
    @transaction_local_date_time =
      transaction_local_date_time
  end
  @cancel_url = cancel_url unless cancel_url == SKIP
  @success_url = success_url unless success_url == SKIP
  @failure_url = failure_url unless failure_url == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#administrative_areaString

The state where the merchant is located.

PIN debit

State code or region code for your business. Use the Use the [State, Province, and Territory Codes for the United States and Canada](https://developer.cybersource.com/library/documentation/sbc/quickr ef/states_and_provinces.pdf) This value might be displayed on the cardholder’s statement. When you do not include this value in your PIN debit request, the merchant name from your account is used. Important This value must consist of English characters. Note This field is supported only for businesses located in the U.S. or Canada. Optional field for PIN debit credit or PIN debit purchase.

Returns:

  • (String)


46
47
48
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 46

def administrative_area
  @administrative_area
end

#cancel_urlString

URL to which the customer is directed if they fail to sign the mandate.

SEPA

Required for Create Mandate and Update Mandate

BACS

Required for Create Mandate

Returns:

  • (String)


77
78
79
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 77

def cancel_url
  @cancel_url
end

#category_codeInteger

The value for this field is a four-digit number that the payment card industry uses to classify merchants into market segments. A payment card company assigned one or more of these values to your business when you started accepting the payment card company’s cards. When you do not include this field in your request, CyberSource uses the value in your CyberSource account.

CyberSource through VisaNet

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

  • Record: CP01 TCR4
  • Position: 150-153
  • Field: Merchant Category Code

Returns:

  • (Integer)


30
31
32
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 30

def category_code
  @category_code
end

#failure_urlString

URL to which the customer is directed if they fail to sign the mandate.

SEPA

Required for Create Mandate and Update Mandate

BACS

Required for Create Mandate

Returns:

  • (String)


93
94
95
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 93

def failure_url
  @failure_url
end

#merchant_descriptorMerchantDescriptor6

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 14

def merchant_descriptor
  @merchant_descriptor
end

#success_urlString

URL to which the customer is directed if they fail to sign the mandate.

SEPA

Required for Create Mandate and Update Mandate

BACS

Required for Create Mandate

Returns:

  • (String)


85
86
87
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 85

def success_url
  @success_url
end

#transaction_local_date_timeString

Date and time at your physical location. Format: YYYYMMDDhhmmss, where:

  • YYYY = year
  • MM = month
  • DD = day
  • hh = hour
  • mm = minutes
  • ss = seconds

Used by

Authorization Required for these processors:

  • American Express Direct

                                    - American Express Direct
    
  • Credit Mutuel-CIC

  • FDC Nashville Global

  • SIX Optional for all other processors.

Returns:

  • (String)


69
70
71
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 69

def transaction_local_date_time
  @transaction_local_date_time
end

Class Method Details

.from_element(root) ⇒ Object



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 180

def self.from_element(root)
  merchant_descriptor = XmlUtilities.from_element(root,
                                                  'MerchantDescriptor6',
                                                  MerchantDescriptor6)
  category_code = XmlUtilities.from_element(root, 'categoryCode', Integer)
  administrative_area = XmlUtilities.from_element(root,
                                                  'administrativeArea',
                                                  String)
  transaction_local_date_time = XmlUtilities.from_element(
    root, 'transactionLocalDateTime', String
  )
  cancel_url = XmlUtilities.from_element(root, 'cancelUrl', String)
  success_url = XmlUtilities.from_element(root, 'successUrl', String)
  failure_url = XmlUtilities.from_element(root, 'failureUrl', String)

  new(merchant_descriptor: merchant_descriptor,
      category_code: category_code,
      administrative_area: administrative_area,
      transaction_local_date_time: transaction_local_date_time,
      cancel_url: cancel_url,
      success_url: success_url,
      failure_url: failure_url,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 147

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  merchant_descriptor = MerchantDescriptor6.from_hash(hash['merchantDescriptor']) if
    hash['merchantDescriptor']
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  transaction_local_date_time =
    hash.key?('transactionLocalDateTime') ? hash['transactionLocalDateTime'] : SKIP
  cancel_url = hash.key?('cancelUrl') ? hash['cancelUrl'] : SKIP
  success_url = hash.key?('successUrl') ? hash['successUrl'] : SKIP
  failure_url = hash.key?('failureUrl') ? hash['failureUrl'] : 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.
  MerchantInformation12.new(merchant_descriptor: merchant_descriptor,
                            category_code: category_code,
                            administrative_area: administrative_area,
                            transaction_local_date_time: transaction_local_date_time,
                            cancel_url: cancel_url,
                            success_url: success_url,
                            failure_url: failure_url,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 96

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['merchant_descriptor'] = 'merchantDescriptor'
  @_hash['category_code'] = 'categoryCode'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['transaction_local_date_time'] = 'transactionLocalDateTime'
  @_hash['cancel_url'] = 'cancelUrl'
  @_hash['success_url'] = 'successUrl'
  @_hash['failure_url'] = 'failureUrl'
  @_hash
end

.nullablesObject

An array for nullable fields



122
123
124
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 122

def self.nullables
  []
end

.optionalsObject

An array for optional fields



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 109

def self.optionals
  %w[
    merchant_descriptor
    category_code
    administrative_area
    transaction_local_date_time
    cancel_url
    success_url
    failure_url
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



235
236
237
238
239
240
241
242
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 235

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} merchant_descriptor: #{@merchant_descriptor.inspect}, category_code:"\
  " #{@category_code.inspect}, administrative_area: #{@administrative_area.inspect},"\
  " transaction_local_date_time: #{@transaction_local_date_time.inspect}, cancel_url:"\
  " #{@cancel_url.inspect}, success_url: #{@success_url.inspect}, failure_url:"\
  " #{@failure_url.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



225
226
227
228
229
230
231
232
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 225

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} merchant_descriptor: #{@merchant_descriptor}, category_code:"\
  " #{@category_code}, administrative_area: #{@administrative_area},"\
  " transaction_local_date_time: #{@transaction_local_date_time}, cancel_url: #{@cancel_url},"\
  " success_url: #{@success_url}, failure_url: #{@failure_url}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/cyber_source_merged_spec/models/merchant_information12.rb', line 205

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

  XmlUtilities.add_as_subelement(doc, root, 'MerchantDescriptor6',
                                 merchant_descriptor)
  XmlUtilities.add_as_subelement(doc, root, 'categoryCode', category_code)
  XmlUtilities.add_as_subelement(doc, root, 'administrativeArea',
                                 administrative_area)
  XmlUtilities.add_as_subelement(doc, root, 'transactionLocalDateTime',
                                 transaction_local_date_time)
  XmlUtilities.add_as_subelement(doc, root, 'cancelUrl', cancel_url)
  XmlUtilities.add_as_subelement(doc, root, 'successUrl', success_url)
  XmlUtilities.add_as_subelement(doc, root, 'failureUrl', failure_url)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end