Sha256: 5f8562345777de496a62bcc02dd163fa4dee260ae9bc7c362730f195886ebab3

Contents?: true

Size: 652 Bytes

Versions: 62

Compression:

Stored size: 652 Bytes

Contents

module Workarea
  module Pricing
    class ShippingTotals
      def initialize(shipping)
        @shipping = shipping
        @price_adjustments = PriceAdjustmentSet.new(
          @shipping.price_adjustments
        )
      end

      def total
        set_shipping_total
        set_tax_total
      end

      def set_shipping_total
        relevant_adjustments = @price_adjustments.adjusting('shipping')
        @shipping.shipping_total = relevant_adjustments.sum
      end

      def set_tax_total
        relevant_adjustments = @price_adjustments.adjusting('tax')
        @shipping.tax_total = relevant_adjustments.sum
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.26 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.45 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.25 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.23 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.44 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.22 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.43 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.21 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.42 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.20 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.41 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.19 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.40 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.18 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.39 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.17 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.38 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.5.16 app/models/workarea/pricing/shipping_totals.rb
workarea-core-3.4.37 app/models/workarea/pricing/shipping_totals.rb