Module: Magelex::TaxGuess
- Defined in:
- lib/magelex/tax_guess.rb
Class Method Summary collapse
Class Method Details
.guess(total, tax_amount) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/magelex/tax_guess.rb', line 3 def self.guess(total, tax_amount) if tax_amount == 0 :tax0 elsif (total - total/1.06) <= tax_amount && (total - total/1.08) >= tax_amount :tax7 elsif (total - total/1.18) <= tax_amount && (total - total/1.20) >= tax_amount :tax19 else raise "TaxGuess: Cannot guess tax of "\ "#{total}/#{tax_amount} (#{total - total/tax_amount})" end end |