Class: CyberSourceMergedSpec::MerchantInformation4

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

Overview

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

Returns a new instance of MerchantInformation4.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 84

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


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

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)


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

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_information4.rb', line 14

def merchant_descriptor
  @merchant_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)


55
56
57
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 55

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)


39
40
41
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 39

def vat_registration_number
  @vat_registration_number
end

Class Method Details

.from_element(root) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 132

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

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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 103

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



58
59
60
61
62
63
64
65
66
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 58

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

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
77
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 69

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



180
181
182
183
184
185
186
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 180

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

#to_sObject

Provides a human-readable string representation of the object.



171
172
173
174
175
176
177
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 171

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

#to_xml_element(doc, root_name) ⇒ Object



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/cyber_source_merged_spec/models/merchant_information4.rb', line 153

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, 'categoryCode', category_code)
  XmlUtilities.add_as_subelement(doc, root, 'vatRegistrationNumber',
                                 vat_registration_number)
  XmlUtilities.add_as_subelement(doc, root, 'cardAcceptorReferenceNumber',
                                 card_acceptor_reference_number)
  XmlUtilities.add_as_subelement(doc, root, 'taxId', tax_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end