Sha256: 341622329b7795fbe83272fae2c50f46b681bf94fbeffa4022c43e64dde1d671

Contents?: true

Size: 942 Bytes

Versions: 38

Compression:

Stored size: 942 Bytes

Contents

require_relative 'r_m_a_required'

module Spree
  class ReturnItem::EligibilityValidator::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

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
spree_core-4.0.9 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.15 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.14 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.0.8 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.13.1 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.0.7.1 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.0.7 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.13 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.0.6 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.2.0.rc2 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.0.5 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.12 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.2.0.rc1 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.0.4 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.11 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.10 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.2.0.beta app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.9 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.8 app/models/spree/return_item/eligibility_validator/default.rb
spree_core-4.1.7 app/models/spree/return_item/eligibility_validator/default.rb