Sha256: e28b075e40ae7b3a35bbdb603dad0f47e7bece4c1bb0929de1437e19933ff411

Contents?: true

Size: 899 Bytes

Versions: 2

Compression:

Stored size: 899 Bytes

Contents

module Workarea
  module GlobalE
    module Api
      class UpdateOrderShippingInfo
        attr_reader :order, :merchant_order

        def initialize(order, merchant_order)
          @order = order
          @merchant_order = merchant_order
        end

        def response
          @response ||=
            begin
              ship_items
              Merchant::ResponseInfo.new(order: order)
            end
        end

        private

          def fulfillment
            @fulfillment ||= Fulfillment.find order.id
          end

          def ship_items
            fulfillment.ship_items(
              merchant_order.international_details.order_tracking_number,
              order.items.map do |item|
                { 'id' => item.id.to_s, 'quantity' => item.quantity }
              end,
              send_to_global_e: false
            )
          end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-global_e-1.3.0 app/services/workarea/global_e/api/update_order_shipping_info.rb
workarea-global_e-1.2.1 app/services/workarea/global_e/api/update_order_shipping_info.rb