Class: CyberSourceMergedSpec::TaxDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::TaxDetails
- Defined in:
- lib/cyber_source_merged_spec/models/tax_details.rb
Overview
TaxDetails Model.
Instance Attribute Summary collapse
-
#amount ⇒ String
Indicates the amount of tax based on the
typefield as described in the table below:. -
#applied ⇒ TrueClass | FalseClass
Flag that indicates whether the tax amount (
travelInformation.autoRental.taxDetails.amount) is included in the request. -
#exemption_code ⇒ String
Status code for exemption from sales and use tax.
-
#rate ⇒ String
Rate of VAT or other tax for the order.
-
#tax_summary ⇒ String
Summary of all tax types.
-
#tax_type ⇒ String
Different taxes the rental agency applies to the rental agreement such as tourist tax, airport tax, or rental tax.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(amount: SKIP, rate: SKIP, applied: SKIP, exemption_code: SKIP, tax_type: SKIP, tax_summary: SKIP, additional_properties: nil) ⇒ TaxDetails
constructor
A new instance of TaxDetails.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(amount: SKIP, rate: SKIP, applied: SKIP, exemption_code: SKIP, tax_type: SKIP, tax_summary: SKIP, additional_properties: nil) ⇒ TaxDetails
Returns a new instance of TaxDetails.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 79 def initialize(amount: SKIP, rate: SKIP, applied: SKIP, exemption_code: SKIP, tax_type: SKIP, tax_summary: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @amount = amount unless amount == SKIP @rate = rate unless rate == SKIP @applied = applied unless applied == SKIP @exemption_code = exemption_code unless exemption_code == SKIP @tax_type = tax_type unless tax_type == SKIP @tax_summary = tax_summary unless tax_summary == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ String
Indicates the amount of tax based on the type field as described in the
table below:
15 16 17 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 15 def amount @amount end |
#applied ⇒ TrueClass | FalseClass
Flag that indicates whether the tax amount
(travelInformation.autoRental.taxDetails.amount) is
included in the request.
Possible values:
false: tax amount is not included in the request.true: tax amount is included in the request.
32 33 34 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 32 def applied @applied end |
#exemption_code ⇒ String
Status code for exemption from sales and use tax. This field is a pass-through, which means that CyberSource does not verify the value or modify it in any way before sending it to the processor.
39 40 41 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 39 def exemption_code @exemption_code end |
#rate ⇒ String
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)
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 23 def rate @rate end |
#tax_summary ⇒ String
Summary of all tax types
48 49 50 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 48 def tax_summary @tax_summary end |
#tax_type ⇒ String
Different taxes the rental agency applies to the rental agreement such as tourist tax, airport tax, or rental tax.
44 45 46 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 44 def tax_type @tax_type end |
Class Method Details
.from_element(root) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 123 def self.from_element(root) amount = XmlUtilities.from_element(root, 'amount', String) rate = XmlUtilities.from_element(root, 'rate', String) applied = XmlUtilities.from_element(root, 'applied', TrueClass) exemption_code = XmlUtilities.from_element(root, 'exemptionCode', String) tax_type = XmlUtilities.from_element(root, 'taxType', String) tax_summary = XmlUtilities.from_element(root, 'taxSummary', String) new(amount: amount, rate: rate, applied: applied, exemption_code: exemption_code, tax_type: tax_type, tax_summary: tax_summary, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 95 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : SKIP rate = hash.key?('rate') ? hash['rate'] : SKIP applied = hash.key?('applied') ? hash['applied'] : SKIP exemption_code = hash.key?('exemptionCode') ? hash['exemptionCode'] : SKIP tax_type = hash.key?('taxType') ? hash['taxType'] : SKIP tax_summary = hash.key?('taxSummary') ? hash['taxSummary'] : 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. TaxDetails.new(amount: amount, rate: rate, applied: applied, exemption_code: exemption_code, tax_type: tax_type, tax_summary: tax_summary, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['rate'] = 'rate' @_hash['applied'] = 'applied' @_hash['exemption_code'] = 'exemptionCode' @_hash['tax_type'] = 'taxType' @_hash['tax_summary'] = 'taxSummary' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 63 def self.optionals %w[ amount rate applied exemption_code tax_type tax_summary ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
164 165 166 167 168 169 170 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 164 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, rate: #{@rate.inspect}, applied:"\ " #{@applied.inspect}, exemption_code: #{@exemption_code.inspect}, tax_type:"\ " #{@tax_type.inspect}, tax_summary: #{@tax_summary.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
156 157 158 159 160 161 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 156 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, rate: #{@rate}, applied: #{@applied}, exemption_code:"\ " #{@exemption_code}, tax_type: #{@tax_type}, tax_summary: #{@tax_summary},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/cyber_source_merged_spec/models/tax_details.rb', line 140 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'amount', amount) XmlUtilities.add_as_subelement(doc, root, 'rate', rate) XmlUtilities.add_as_subelement(doc, root, 'applied', applied) XmlUtilities.add_as_subelement(doc, root, 'exemptionCode', exemption_code) XmlUtilities.add_as_subelement(doc, root, 'taxType', tax_type) XmlUtilities.add_as_subelement(doc, root, 'taxSummary', tax_summary) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |