Class: Spree::ReturnItem::EligibilityValidator::TimeSincePurchase

Inherits:
BaseValidator
  • Object
show all
Defined in:
core/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb

Instance Attribute Summary

Attributes inherited from BaseValidator

#errors

Instance Method Summary collapse

Methods inherited from BaseValidator

#initialize

Constructor Details

This class inherits a constructor from Spree::ReturnItem::EligibilityValidator::BaseValidator

Instance Method Details

#eligible_for_return?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'core/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb', line 7

def eligible_for_return?
  if (@return_item.inventory_unit.order.completed_at + Spree::Config[:return_eligibility_number_of_days].days) > Time.current
    true
  else
    add_error(:number_of_days, I18n.t('spree.return_item_time_period_ineligible'))
    false
  end
end

#requires_manual_intervention?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'core/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb', line 16

def requires_manual_intervention?
  false
end