Sha256: fe7542ff9a40260ce59c6640f7a5bd836cf37f9231fe28022a55d6b504ca1e8a

Contents?: true

Size: 864 Bytes

Versions: 3

Compression:

Stored size: 864 Bytes

Contents

module Spree
  class ReturnItem::DefaultEligibilityValidator < Spree::ReturnItem::EligibilityValidator::BaseValidator
    class_attribute :permitted_eligibility_validators
    self.permitted_eligibility_validators = [
                                              ReturnItem::EligibilityValidator::TimeSincePurchase,
                                              ReturnItem::EligibilityValidator::RMARequired,
                                            ]

    def eligible_for_return?
      validators.all? {|v| v.eligible_for_return? }
    end

    def requires_manual_intervention?
      validators.any? {|v| v.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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_core-2.4.0.rc3 app/models/spree/return_item/default_eligibility_validator.rb
spree_core-2.4.0.rc2 app/models/spree/return_item/default_eligibility_validator.rb
spree_core-2.4.0.rc1 app/models/spree/return_item/default_eligibility_validator.rb