Sha256: bbe48d9dca61f8f840539a66dad1a6345bd768b4fc1e0aab33901e1a4a5206e3

Contents?: true

Size: 516 Bytes

Versions: 96

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true

module Spree
  class Promotion < Spree::Base
    module Rules
      class UserLoggedIn < PromotionRule
        def applicable?(promotable)
          promotable.is_a?(Spree::Order)
        end

        def eligible?(order, _options = {})
          unless order.user.present?
            eligibility_errors.add(:base, eligibility_error_message(:no_user_specified), error_code: :no_user_specified)
          end
          eligibility_errors.empty?
        end
      end
    end
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
solidus_core-4.3.4 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.2.4 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.1.5 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.3.3 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.3.2 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.1.4 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.3.1 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.3.0 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.2.3 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.1.3 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.0.4 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-3.4.6 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.0.3 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.1.2 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.2.2 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-3.4.5 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.2.1 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.2.0 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.1.1 app/models/spree/promotion/rules/user_logged_in.rb
solidus_core-4.0.2 app/models/spree/promotion/rules/user_logged_in.rb