Class: VisaAcceptanceMergedSpec::TaxDetails1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/tax_details1.rb

Overview

TaxDetails1 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(type: SKIP, amount: SKIP, rate: SKIP, code: SKIP, tax_id: SKIP, applied: SKIP, exemption_code: SKIP, additional_properties: nil) ⇒ TaxDetails1

Returns a new instance of TaxDetails1.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 121

def initialize(type: SKIP, amount: SKIP, rate: SKIP, code: SKIP,
               tax_id: SKIP, applied: SKIP, exemption_code: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @amount = amount unless amount == SKIP
  @rate = rate unless rate == SKIP
  @code = code unless code == SKIP
  @tax_id = tax_id unless tax_id == SKIP
  @applied = applied unless applied == SKIP
  @exemption_code = exemption_code unless exemption_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountString

Indicates the amount of tax based on the type field as described in the table below:

type type description
alternate Total amount of alternate tax for the order.
local Sales tax for the order.
national National tax for the order.
vat Total amount of value added tax (VAT) included in the
order.
other Other tax.
green Green tax amount for Korean Processing.

Returns:

  • (String)


35
36
37
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 35

def amount
  @amount
end

#appliedTrueClass | FalseClass

Flag that indicates whether the alternate tax amount (orderInformation.amountDetails.taxDetails[].amount) is included in the request. Possible values:

  • false: alternate tax amount is not included in the request.
  • true: alternate tax amount is included in the request.

Returns:

  • (TrueClass | FalseClass)


81
82
83
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 81

def applied
  @applied
end

#codeString

Type of tax being applied to the item.

FDC Nashville Global

  • alternate_tax_type_applied
  • alternate_tax_type_identifier

Worldpay VAP

  • alternate_tax_type_identifier

RBS WorldPay Atlanta

  • tax_type_applied

TSYS Acquiring Solutions

  • tax_type_applied
  • local_tax_indicator

Chase Paymentech Solutions

  • tax_type_applied

Elavon Americas

  • local_tax_indicator

FDC Compass

  • tax_type_applied

OmniPay Direct

  • local_tax_indicator

Returns:

  • (String)


65
66
67
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 65

def code
  @code
end

#exemption_codeString

Status code for exemption from sales and use tax. This field is a pass-through, which means that Visa Acceptance does not verify the value or modify it in any way before sending it to the processor.

Returns:

  • (String)


88
89
90
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 88

def exemption_code
  @exemption_code
end

#rateString

Rate of VAT or other tax for the order. Example 0.040 (=4%) Valid range: 0.01 to 0.99 (1% to 99%, with only whole percentage values accepted; values with additional decimal places will be truncated)

Returns:

  • (String)


43
44
45
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 43

def rate
  @rate
end

#tax_idString

Your tax ID number to use for the alternate tax amount. Required if you set alternate tax amount to any value, including zero. You may send this field without sending alternate tax amount.

Returns:

  • (String)


72
73
74
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 72

def tax_id
  @tax_id
end

#typeString

Indicates the type of tax data for the taxDetails object. Possible values:

  • alternate
  • local
  • national
  • vat
  • other
  • green

Returns:

  • (String)


21
22
23
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 21

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 138

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  rate = hash.key?('rate') ? hash['rate'] : SKIP
  code = hash.key?('code') ? hash['code'] : SKIP
  tax_id = hash.key?('taxId') ? hash['taxId'] : SKIP
  applied = hash.key?('applied') ? hash['applied'] : SKIP
  exemption_code = hash.key?('exemptionCode') ? hash['exemptionCode'] : 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.
  TaxDetails1.new(type: type,
                  amount: amount,
                  rate: rate,
                  code: code,
                  tax_id: tax_id,
                  applied: applied,
                  exemption_code: exemption_code,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



91
92
93
94
95
96
97
98
99
100
101
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 91

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['amount'] = 'amount'
  @_hash['rate'] = 'rate'
  @_hash['code'] = 'code'
  @_hash['tax_id'] = 'taxId'
  @_hash['applied'] = 'applied'
  @_hash['exemption_code'] = 'exemptionCode'
  @_hash
end

.nullablesObject

An array for nullable fields



117
118
119
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 117

def self.nullables
  []
end

.optionalsObject

An array for optional fields



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 104

def self.optionals
  %w[
    type
    amount
    rate
    code
    tax_id
    applied
    exemption_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



177
178
179
180
181
182
183
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 177

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, amount: #{@amount.inspect}, rate: #{@rate.inspect},"\
  " code: #{@code.inspect}, tax_id: #{@tax_id.inspect}, applied: #{@applied.inspect},"\
  " exemption_code: #{@exemption_code.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



169
170
171
172
173
174
# File 'lib/visa_acceptance_merged_spec/models/tax_details1.rb', line 169

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, amount: #{@amount}, rate: #{@rate}, code: #{@code}, tax_id:"\
  " #{@tax_id}, applied: #{@applied}, exemption_code: #{@exemption_code},"\
  " additional_properties: #{@additional_properties}>"
end