Class: CyberSourceMergedSpec::TaxDetails13
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::TaxDetails13
- Defined in:
- lib/cyber_source_merged_spec/models/tax_details13.rb
Overview
Contains all of the tax-related fields for the order.
Instance Attribute Summary collapse
-
#amount ⇒ String
Indicates the amount of tax based on the
typefield as described in the table below: | type | type description | | ------------- |:-------------:| |alternate| Total amount of alternate tax for the order. -
#rate ⇒ String
Rate of VAT or other tax for the order.
-
#type ⇒ String
Indicates the type of tax data for the taxDetails object.
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(type: SKIP, amount: SKIP, rate: SKIP, additional_properties: nil) ⇒ TaxDetails13
constructor
A new instance of TaxDetails13.
-
#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(type: SKIP, amount: SKIP, rate: SKIP, additional_properties: nil) ⇒ TaxDetails13
Returns a new instance of TaxDetails13.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 68 def initialize(type: SKIP, amount: SKIP, rate: 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 @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:
| 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. |
35 36 37 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 35 def amount @amount 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)
43 44 45 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 43 def rate @rate end |
#type ⇒ String
Indicates the type of tax data for the taxDetails object. Possible values:
alternatelocalnationalvatothergreen
21 22 23 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 21 def type @type end |
Class Method Details
.from_element(root) ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 102 def self.from_element(root) type = XmlUtilities.from_element(root, 'type', String) amount = XmlUtilities.from_element(root, 'amount', String) rate = XmlUtilities.from_element(root, 'rate', String) new(type: type, amount: amount, rate: rate, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 80 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 # 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. TaxDetails13.new(type: type, amount: amount, rate: rate, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['type'] = 'type' @_hash['amount'] = 'amount' @_hash['rate'] = 'rate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 64 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 55 def self.optionals %w[ type amount rate ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
133 134 135 136 137 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 133 def inspect class_name = self.class.name.split('::').last "<#{class_name} type: #{@type.inspect}, amount: #{@amount.inspect}, rate: #{@rate.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
126 127 128 129 130 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 126 def to_s class_name = self.class.name.split('::').last "<#{class_name} type: #{@type}, amount: #{@amount}, rate: #{@rate}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/cyber_source_merged_spec/models/tax_details13.rb', line 113 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'type', type) XmlUtilities.add_as_subelement(doc, root, 'amount', amount) XmlUtilities.add_as_subelement(doc, root, 'rate', rate) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |