Sha256: 445eaca749e98d9c1be6c47133dc0406f074dc4c7d7ced1f2e356d67164b3cbb

Contents?: true

Size: 593 Bytes

Versions: 1

Compression:

Stored size: 593 Bytes

Contents

module Workarea
  decorate Pricing::ShippingTotals, with: :flow_io do
    def total
      super

      return unless @shipping.experience.present?

      set_flow_shipping_total
      set_flow_tax_total
    end

    def flow_price_adjustments
      @flow_price_adjustments ||= PriceAdjustmentSet.new(@shipping.flow_price_adjustments)
    end

    def set_flow_shipping_total
      @shipping.flow_shipping_total = flow_price_adjustments.adjusting('shipping').sum
    end

    def set_flow_tax_total
      @shipping.flow_tax_total = flow_price_adjustments.adjusting('tax').sum
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 app/models/workarea/pricing/shipping_totals.decorator