Sha256: 52021138613a57c98359c6186d9e0eb77008e67212aa0054f1daa4fc26bf0978

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

module Workarea
  decorate Shipping, with: :flow_io do
    decorated do
      field :flow_shipping_total, type: Money
      field :flow_tax_total, type: Money
      field :delivery_duty, type: String

      embeds_one :experience, class_name: "Workarea::FlowIo::ExperienceGeo", as: :experienceable

      embeds_many :flow_price_adjustments,
        class_name: 'Workarea::PriceAdjustment',
        extend: PriceAdjustmentExtension
    end

    def adjust_flow_pricing(options = {})
      flow_price_adjustments.build(options)
    end

    # @param ::Io::Flow::V0::Models::DeliveryOption flow_shipping_method
    def set_flow_shipping!(flow_shipping_method)
      # clear the default shipping service.
      self.shipping_service = nil
      self.delivery_duty = flow_shipping_method.delivered_duty.value
      self.build_shipping_service(name: flow_shipping_method.tier.name)
      save!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 app/models/workarea/shipping.decorator