Sha256: 950e232790d18c657feef67a269c36f4929a887ede9459cee3ad541d72409b71

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

module Workarea
  module Pricing
    module Calculators
      class FlowLocalizationCalculator
        include Calculator

        def adjust
          return unless order.experience.present? && order.items.present?

          order_put_form = FlowIo::OrderPutForm.from(order: order, shippings: shippings, discounts: discounts)

          flow_order = FlowIo.client.orders.put_by_number(
            FlowIo.organization_id,
            order.id,
            order_put_form,
            experience: order.experience.key
          )

          FlowIo::PriceApplier.perform(order: order, flow_order: flow_order)
        rescue => exception
          if defined?(::Raven)
            Raven.capture_exception(exception)
          else
            Rails.logger.warn "Error in FlowLocalizationCalculator: #{exception}"
          end
        end
      end
    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/calculators/flow_localization_calculator.rb