Sha256: a85577323af4c1ed4fb6fdf74d95e5a3d5eba19279f1b2408467056913922c45

Contents?: true

Size: 1.05 KB

Versions: 43

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Spree
  class ReturnItem < Spree::Base
    module EligibilityValidator
      class Default < Spree::ReturnItem::EligibilityValidator::BaseValidator
        class_attribute :permitted_eligibility_validators
        self.permitted_eligibility_validators = [
          ReturnItem::EligibilityValidator::OrderCompleted,
          ReturnItem::EligibilityValidator::TimeSincePurchase,
          ReturnItem::EligibilityValidator::RMARequired,
          ReturnItem::EligibilityValidator::InventoryShipped,
          ReturnItem::EligibilityValidator::NoReimbursements
        ]

        def eligible_for_return?
          validators.all?(&:eligible_for_return?)
        end

        def requires_manual_intervention?
          validators.any?(&:requires_manual_intervention?)
        end

        def errors
          validators.map(&:errors).reduce({}, :merge)
        end

        private

        def validators
          @validators ||= permitted_eligibility_validators.map{ |v| v.new(@return_item) }
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
solidus_core-2.9.6 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.8.6 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.9.5 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.9.4 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.6.6 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.7.4 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.8.5 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.9.3 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.9.2 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.10.0.beta1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.7.3 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.6.5 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.9.1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.9.0 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.9.0.rc.1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.8.4 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.8.3 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.7.2 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.6.4 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.8.2 app/models/spree/return_item/eligibility_validator/default.rb