Sha256: 01eccd9d9613b1dd1d5f68b72b092f6cb39b433cb1aa3d5dac84f497e4058572

Contents?: true

Size: 827 Bytes

Versions: 62

Compression:

Stored size: 827 Bytes

Contents

module Workarea
  module Pricing
    module Calculators
      class CustomizationsCalculator
        include Calculator

        def adjust
          order.items.each do |item|
            next unless item.customizations['pricing_sku'].present?

            price = pricing.for_sku(
              item.customizations['pricing_sku'],
              quantity: item.quantity
            )

            unit = price.sell

            if unit > 0
              item.adjust_pricing(
                price: 'item',
                amount: unit * item.quantity,
                quantity: item.quantity,
                calculator: self.class.name,
                description: 'Customizations',
                data: { 'tax_code' => price.tax_code }
              )
            end
          end
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.4.13 app/models/workarea/pricing/calculators/customizations_calculator.rb
workarea-core-3.4.12 app/models/workarea/pricing/calculators/customizations_calculator.rb