Class: Spree::ShippingRateTax

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
DisplayMoney
Defined in:
core/app/models/spree/shipping_rate_tax.rb

Overview

Used to persist shipping rate tax estimations.

See Also:

Since:

  • 1.3.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DisplayMoney

money_methods

Instance Attribute Details

#shipping_rateSpree::ShippingRate

The shipping rate to be taxed

Returns:



9
10
11
# File 'core/app/models/spree/shipping_rate_tax.rb', line 9

def shipping_rate
  @shipping_rate
end

#tax_rateSpree::TaxRate

The tax rate used to calculate the tax amount

Returns:



9
10
11
# File 'core/app/models/spree/shipping_rate_tax.rb', line 9

def tax_rate
  @tax_rate
end

Instance Method Details

#absolute_amountObject

Since:

  • 1.3.0



25
26
27
# File 'core/app/models/spree/shipping_rate_tax.rb', line 25

def absolute_amount
  amount.abs
end

#labelObject

Since:

  • 1.3.0



18
19
20
21
22
23
# File 'core/app/models/spree/shipping_rate_tax.rb', line 18

def label
  I18n.t translation_key,
    scope: 'spree.shipping_rate_tax.label',
    amount: display_absolute_amount,
    tax_rate_name: tax_rate.name
end