Class: CyberSourceMergedSpec::MerchantInformation3

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

Overview

MerchantInformation3 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, card_acceptor_reference_number: SKIP, category_code: SKIP, vat_registration_number: SKIP, service_fee_descriptor: SKIP, tax_id: SKIP, additional_properties: nil) ⇒ MerchantInformation3

Returns a new instance of MerchantInformation3.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 95

def initialize(merchant_descriptor: SKIP,
               card_acceptor_reference_number: SKIP, category_code: SKIP,
               vat_registration_number: SKIP, service_fee_descriptor: SKIP,
               tax_id: 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
  unless card_acceptor_reference_number == SKIP
    @card_acceptor_reference_number =
      card_acceptor_reference_number
  end
  @category_code = category_code unless category_code == SKIP
  @vat_registration_number = vat_registration_number unless vat_registration_number == SKIP
  @service_fee_descriptor = service_fee_descriptor unless service_fee_descriptor == SKIP
  @tax_id = tax_id unless tax_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#card_acceptor_reference_numberString

Reference number that facilitates card acceptor/corporation communication and record keeping.

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 19

def card_acceptor_reference_number
  @card_acceptor_reference_number
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)


35
36
37
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 35

def category_code
  @category_code
end

#merchant_descriptorMerchantDescriptor

TODO: Write general description for this method

Returns:



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

def merchant_descriptor
  @merchant_descriptor
end

#service_fee_descriptorServiceFeeDescriptor

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.



53
54
55
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 53

def service_fee_descriptor
  @service_fee_descriptor
end

#tax_idString

Your Cadastro Nacional da Pessoa Jurídica (CNPJ) number. This field is supported only for BNDES transactions on CyberSource through VisaNet. The value for this field corresponds to the following data in the TC 33 capture file5:

  • Record: CP07 TCR6
  • Position: 40-59
  • Field: BNDES Reference Field 1

Returns:

  • (String)


64
65
66
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 64

def tax_id
  @tax_id
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)


44
45
46
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 44

def vat_registration_number
  @vat_registration_number
end

Class Method Details

.from_element(root) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 147

def self.from_element(root)
  merchant_descriptor = XmlUtilities.from_element(root,
                                                  'MerchantDescriptor',
                                                  MerchantDescriptor)
  card_acceptor_reference_number = XmlUtilities.from_element(
    root, 'cardAcceptorReferenceNumber', String
  )
  category_code = XmlUtilities.from_element(root, 'categoryCode', Integer)
  vat_registration_number = XmlUtilities.from_element(
    root, 'vatRegistrationNumber', String
  )
  service_fee_descriptor = XmlUtilities.from_element(root,
                                                     'ServiceFeeDescriptor',
                                                     ServiceFeeDescriptor)
  tax_id = XmlUtilities.from_element(root, 'taxId', String)

  new(merchant_descriptor: merchant_descriptor,
      card_acceptor_reference_number: card_acceptor_reference_number,
      category_code: category_code,
      vat_registration_number: vat_registration_number,
      service_fee_descriptor: service_fee_descriptor,
      tax_id: tax_id,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 115

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  merchant_descriptor = MerchantDescriptor.from_hash(hash['merchantDescriptor']) if
    hash['merchantDescriptor']
  card_acceptor_reference_number =
    hash.key?('cardAcceptorReferenceNumber') ? hash['cardAcceptorReferenceNumber'] : SKIP
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP
  vat_registration_number =
    hash.key?('vatRegistrationNumber') ? hash['vatRegistrationNumber'] : SKIP
  service_fee_descriptor = ServiceFeeDescriptor.from_hash(hash['serviceFeeDescriptor']) if
    hash['serviceFeeDescriptor']
  tax_id = hash.key?('taxId') ? hash['taxId'] : 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.
  MerchantInformation3.new(merchant_descriptor: merchant_descriptor,
                           card_acceptor_reference_number: card_acceptor_reference_number,
                           category_code: category_code,
                           vat_registration_number: vat_registration_number,
                           service_fee_descriptor: service_fee_descriptor,
                           tax_id: tax_id,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['merchant_descriptor'] = 'merchantDescriptor'
  @_hash['card_acceptor_reference_number'] = 'cardAcceptorReferenceNumber'
  @_hash['category_code'] = 'categoryCode'
  @_hash['vat_registration_number'] = 'vatRegistrationNumber'
  @_hash['service_fee_descriptor'] = 'serviceFeeDescriptor'
  @_hash['tax_id'] = 'taxId'
  @_hash
end

.nullablesObject

An array for nullable fields



91
92
93
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 91

def self.nullables
  []
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 79

def self.optionals
  %w[
    merchant_descriptor
    card_acceptor_reference_number
    category_code
    vat_registration_number
    service_fee_descriptor
    tax_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



202
203
204
205
206
207
208
209
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 202

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

#to_sObject

Provides a human-readable string representation of the object.



192
193
194
195
196
197
198
199
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 192

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

#to_xml_element(doc, root_name) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/cyber_source_merged_spec/models/merchant_information3.rb', line 172

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

  XmlUtilities.add_as_subelement(doc, root, 'MerchantDescriptor',
                                 merchant_descriptor)
  XmlUtilities.add_as_subelement(doc, root, 'cardAcceptorReferenceNumber',
                                 card_acceptor_reference_number)
  XmlUtilities.add_as_subelement(doc, root, 'categoryCode', category_code)
  XmlUtilities.add_as_subelement(doc, root, 'vatRegistrationNumber',
                                 vat_registration_number)
  XmlUtilities.add_as_subelement(doc, root, 'ServiceFeeDescriptor',
                                 service_fee_descriptor)
  XmlUtilities.add_as_subelement(doc, root, 'taxId', tax_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end