Sha256: e3d3da267ca8d3ccf88b6f9cccd5b171acd44d0b7ac1d054e98fc777174a9196

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

module Workarea
  module GlobalE
    module Api
      class RemoveRestrictedProducts
        attr_reader :order, :codes

        def initialize(order, codes = [])
          @order = order
          @codes = codes
        end

        def self.perform(*args)
          new(*args).tap(&:call)
        end

        def call
          order.items.each do |item|
            item.destroy if item.sku.in?(codes)
          end
        end

        def response
          @response ||= Merchant::ResponseInfo.new(order: order)
        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/remove_restricted_products.rb
workarea-global_e-1.2.1 app/services/workarea/global_e/api/remove_restricted_products.rb