Class: ReturnItem::EligibilityValidator::TimeSincePurchase

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

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) eligible_for_return?

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'app/models/spree/return_item/eligibility_validator/time_since_purchase.rb', line 3

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

- (Boolean) requires_manual_intervention?

Returns:

  • (Boolean)


12
13
14
# File 'app/models/spree/return_item/eligibility_validator/time_since_purchase.rb', line 12

def requires_manual_intervention?
  false
end