Class: Workarea::Pricing::TaxApplier
- Inherits:
-
Object
- Object
- Workarea::Pricing::TaxApplier
- Includes:
- TaxApplication
- Defined in:
- app/models/workarea/pricing/tax_applier.rb
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(shipping, adjustments_to_tax) ⇒ TaxApplier
constructor
A new instance of TaxApplier.
- #shipping_total ⇒ Object
Methods included from TaxApplication
#calculate_tax_amount, #calculate_tax_amounts
Methods included from GuardNegativePrice
Constructor Details
#initialize(shipping, adjustments_to_tax) ⇒ TaxApplier
Returns a new instance of TaxApplier.
6 7 8 9 10 |
# File 'app/models/workarea/pricing/tax_applier.rb', line 6 def initialize(shipping, adjustments_to_tax) @shipping = shipping @adjustments_to_tax = adjustments_to_tax @adjustments_by_parent = adjustments_to_tax.grouped_by_parent end |
Instance Method Details
#apply ⇒ Object
16 17 18 19 |
# File 'app/models/workarea/pricing/tax_applier.rb', line 16 def apply @adjustments_to_tax.each { |a| assign_item_tax(a) } assign_shipping_tax if @shipping.shipping_service.present? end |
#shipping_total ⇒ Object
12 13 14 |
# File 'app/models/workarea/pricing/tax_applier.rb', line 12 def shipping_total @shipping_total ||= @shipping.price_adjustments.adjusting('shipping').sum end |