Sha256: 8aa0ee827e797fbac392655e42213776a32af986d98b74433fc5c16c453936fa

Contents?: true

Size: 1.12 KB

Versions: 32

Compression:

Stored size: 1.12 KB

Contents

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

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.2.2 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.1.1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.0.3 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-1.4.2 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-1.3.2 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.3.0 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.3.0.rc3 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.3.0.rc2 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.3.0.rc1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.3.0.beta1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.0.2 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-1.4.1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.2.1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.2.0 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.2.0.rc1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.2.0.beta1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.1.0 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.1.0.rc1 app/models/spree/return_item/eligibility_validator/default.rb
solidus_core-2.0.1 app/models/spree/return_item/eligibility_validator/default.rb