Sha256: 232247cc6deb0640f14422255bce9179bf69bc46db40d80c45c9bfb063cefbe9

Contents?: true

Size: 505 Bytes

Versions: 31

Compression:

Stored size: 505 Bytes

Contents

module Spree
  module Orders
    class FindCurrent
      def execute(user:, store:, **params)
        params = params.merge(store_id: store.id)

        order = incomplete_orders.find_by(params)

        return order unless order.nil?
        return if user.nil?

        incomplete_orders.order(created_at: :desc).find_by(store: store, user: user, currency: params[:currency])
      end

      private

      def incomplete_orders
        Spree::Order.incomplete.not_canceled
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
spree_core-4.9.0 app/finders/spree/orders/find_current.rb
spree_core-4.8.3 app/finders/spree/orders/find_current.rb
spree_core-4.8.2 app/finders/spree/orders/find_current.rb
spree_core-4.7.3 app/finders/spree/orders/find_current.rb
spree_core-4.6.6 app/finders/spree/orders/find_current.rb
spree_core-4.5.5 app/finders/spree/orders/find_current.rb
spree_core-4.3.3 app/finders/spree/orders/find_current.rb
spree_core-4.4.1 app/finders/spree/orders/find_current.rb
spree_core-4.5.4 app/finders/spree/orders/find_current.rb
spree_core-4.6.5 app/finders/spree/orders/find_current.rb
spree_core-4.7.2 app/finders/spree/orders/find_current.rb
spree_core-4.7.1 app/finders/spree/orders/find_current.rb
spree_core-4.6.4 app/finders/spree/orders/find_current.rb
spree_core-4.7.0 app/finders/spree/orders/find_current.rb
spree_core-4.6.3 app/finders/spree/orders/find_current.rb
spree_core-4.6.2 app/finders/spree/orders/find_current.rb
spree_core-4.6.1 app/finders/spree/orders/find_current.rb
spree_core-4.6.0 app/finders/spree/orders/find_current.rb
spree_core-4.5.3 app/finders/spree/orders/find_current.rb
spree_core-4.5.2 app/finders/spree/orders/find_current.rb