Class: CyberSourceMergedSpec::MerchantInformation21

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

Overview

MerchantInformation21 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(category_code: SKIP, submit_local_date_time: SKIP, vat_registration_number: SKIP, merchant_descriptor: SKIP, additional_properties: nil) ⇒ MerchantInformation21

Returns a new instance of MerchantInformation21.



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 76

def initialize(category_code: SKIP, submit_local_date_time: SKIP,
               vat_registration_number: SKIP, merchant_descriptor: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @category_code = category_code unless category_code == SKIP
  @submit_local_date_time = submit_local_date_time unless submit_local_date_time == SKIP
  @vat_registration_number = vat_registration_number unless vat_registration_number == SKIP
  @merchant_descriptor = merchant_descriptor unless merchant_descriptor == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#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)


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

def category_code
  @category_code
end

#merchant_descriptorMerchantDescriptor36

Your government-assigned tax identification number.

Tax Calculation

Required field for value added tax only. Not applicable to U.S. and Canadian taxes.

CyberSource through VisaNet

For CtV processors, the maximum length is 20.



49
50
51
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 49

def merchant_descriptor
  @merchant_descriptor
end

#submit_local_date_timeString

Time that the transaction was submitted in local time. The time is in hhmmss format.

Returns:

  • (String)


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

def submit_local_date_time
  @submit_local_date_time
end

#vat_registration_numberString

Your government-assigned tax identification number.

Tax Calculation

Required field for value added tax only. Not applicable to U.S. and Canadian taxes.

CyberSource through VisaNet

For CtV processors, the maximum length is 20.

Returns:

  • (String)


40
41
42
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 40

def vat_registration_number
  @vat_registration_number
end

Class Method Details

.from_element(root) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 117

def self.from_element(root)
  category_code = XmlUtilities.from_element(root, 'categoryCode', Integer)
  submit_local_date_time = XmlUtilities.from_element(root,
                                                     'submitLocalDateTime',
                                                     String)
  vat_registration_number = XmlUtilities.from_element(
    root, 'vatRegistrationNumber', String
  )
  merchant_descriptor = XmlUtilities.from_element(root,
                                                  'MerchantDescriptor36',
                                                  MerchantDescriptor36)

  new(category_code: category_code,
      submit_local_date_time: submit_local_date_time,
      vat_registration_number: vat_registration_number,
      merchant_descriptor: merchant_descriptor,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP
  submit_local_date_time =
    hash.key?('submitLocalDateTime') ? hash['submitLocalDateTime'] : SKIP
  vat_registration_number =
    hash.key?('vatRegistrationNumber') ? hash['vatRegistrationNumber'] : SKIP
  merchant_descriptor = MerchantDescriptor36.from_hash(hash['merchantDescriptor']) if
    hash['merchantDescriptor']

  # 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.
  MerchantInformation21.new(category_code: category_code,
                            submit_local_date_time: submit_local_date_time,
                            vat_registration_number: vat_registration_number,
                            merchant_descriptor: merchant_descriptor,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['category_code'] = 'categoryCode'
  @_hash['submit_local_date_time'] = 'submitLocalDateTime'
  @_hash['vat_registration_number'] = 'vatRegistrationNumber'
  @_hash['merchant_descriptor'] = 'merchantDescriptor'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 62

def self.optionals
  %w[
    category_code
    submit_local_date_time
    vat_registration_number
    merchant_descriptor
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



162
163
164
165
166
167
168
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 162

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} category_code: #{@category_code.inspect}, submit_local_date_time:"\
  " #{@submit_local_date_time.inspect}, vat_registration_number:"\
  " #{@vat_registration_number.inspect}, merchant_descriptor: #{@merchant_descriptor.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



153
154
155
156
157
158
159
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 153

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} category_code: #{@category_code}, submit_local_date_time:"\
  " #{@submit_local_date_time}, vat_registration_number: #{@vat_registration_number},"\
  " merchant_descriptor: #{@merchant_descriptor}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/cyber_source_merged_spec/models/merchant_information21.rb', line 136

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

  XmlUtilities.add_as_subelement(doc, root, 'categoryCode', category_code)
  XmlUtilities.add_as_subelement(doc, root, 'submitLocalDateTime',
                                 submit_local_date_time)
  XmlUtilities.add_as_subelement(doc, root, 'vatRegistrationNumber',
                                 vat_registration_number)
  XmlUtilities.add_as_subelement(doc, root, 'MerchantDescriptor36',
                                 merchant_descriptor)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end