Class: NewStoreApi::CalculationModeEnum
- Inherits:
-
Object
- Object
- NewStoreApi::CalculationModeEnum
- Defined in:
- lib/new_store_api/models/calculation_mode_enum.rb
Overview
Type of the tax calculation * STANDARD: Standard tax calculation
(default). * Taxes will be calculated for each line from item_price * quantity respecting the tax_method (tax incl./excl.). * REVERSE:
Reverse calculation of taxes from the total amount paid by customer (e.g.
for injected offline or e-comm orders). * Taxes will be calculated from
price_line_item (total gross amount for given quantity) regardless of
tax_method (tax incl./excl.).
Constant Summary collapse
- CALCULATION_MODE_ENUM =
[ # TODO: Write general description for STANDARD STANDARD = 'STANDARD'.freeze, # TODO: Write general description for REVERSE REVERSE = 'REVERSE'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = STANDARD) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/new_store_api/models/calculation_mode_enum.rb', line 29 def self.from_value(value, default_value = STANDARD) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'standard' then STANDARD when 'reverse' then REVERSE else default_value end end |
.validate(value) ⇒ Object
23 24 25 26 27 |
# File 'lib/new_store_api/models/calculation_mode_enum.rb', line 23 def self.validate(value) return false if value.nil? CALCULATION_MODE_ENUM.include?(value) end |