Sha256: b8cf1748b4f8f7d3625196ac51e2623413eb1e4ff70d63f4ba1484995b35927a
Contents?: true
Size: 973 Bytes
Versions: 42
Compression:
Stored size: 973 Bytes
Contents
# frozen_string_literal: true module Spree # Used to persist shipping rate tax estimations. # @attr [Spree::ShippingRate] shipping_rate The shipping rate to be taxed # @attr [Spree::TaxRate] tax_rate The tax rate used to calculate the tax amount # @since 1.3.0 # @see Spree::Tax::ShippingRateTaxer class ShippingRateTax < ActiveRecord::Base belongs_to :shipping_rate, class_name: "Spree::ShippingRate" belongs_to :tax_rate, class_name: "Spree::TaxRate" extend DisplayMoney money_methods :absolute_amount delegate :currency, to: :shipping_rate, allow_nil: true def label I18n.t translation_key, scope: 'spree.shipping_rate_tax.label', amount: display_absolute_amount, tax_rate_name: tax_rate.name end def absolute_amount amount.abs end private def translation_key if tax_rate.included_in_price? :vat else :sales_tax end end end end
Version data entries
42 entries across 42 versions & 2 rubygems
Version | Path |
---|---|
solidus_core-2.6.0 | app/models/spree/shipping_rate_tax.rb |
solidus_core-2.6.0.rc1 | app/models/spree/shipping_rate_tax.rb |