Class: VisaAcceptanceMergedSpec::MerchantInformation3

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_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/visa_acceptance_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_number ⇒ String

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

Returns:

  • (String)


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

def card_acceptor_reference_number
  @card_acceptor_reference_number
end

#category_code ⇒ Integer

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, Visa Acceptance uses the value in your Visa Acceptance account.

Visa Acceptance 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/visa_acceptance_merged_spec/models/merchant_information3.rb', line 35

def category_code
  @category_code
end

#merchant_descriptor ⇒ MerchantDescriptor

TODO: Write general description for this method

Returns:



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

def merchant_descriptor
  @merchant_descriptor
end

#service_fee_descriptor ⇒ ServiceFeeDescriptor

Your government-assigned tax identification number.

Tax Calculation

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

Visa Acceptance through VisaNet

For CtV processors, the maximum length is 20.



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

def service_fee_descriptor
  @service_fee_descriptor
end

#tax_id ⇒ String

Your Cadastro Nacional da Pessoa Jurídica (CNPJ) number. This field is supported only for BNDES transactions on Visa Acceptance 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/visa_acceptance_merged_spec/models/merchant_information3.rb', line 64

def tax_id
  @tax_id
end

#vat_registration_number ⇒ String

Your government-assigned tax identification number.

Tax Calculation

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

Visa Acceptance through VisaNet

For CtV processors, the maximum length is 20.

Returns:

  • (String)


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

def vat_registration_number
  @vat_registration_number
end

Class Method Details

.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/visa_acceptance_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

.names ⇒ Object

A mapping from model property names to API property names.



67
68
69
70
71
72
73
74
75
76
# File 'lib/visa_acceptance_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

.nullables ⇒ Object

An array for nullable fields



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

def self.nullables
  []
end

.optionals ⇒ Object

An array for optional fields



79
80
81
82
83
84
85
86
87
88
# File 'lib/visa_acceptance_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

#inspect ⇒ Object

Provides a debugging-friendly string with detailed object information.



158
159
160
161
162
163
164
165
# File 'lib/visa_acceptance_merged_spec/models/merchant_information3.rb', line 158

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_s ⇒ Object

Provides a human-readable string representation of the object.



148
149
150
151
152
153
154
155
# File 'lib/visa_acceptance_merged_spec/models/merchant_information3.rb', line 148

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