Class: Spree::ReturnItem::EligibilityValidator::NoReimbursements

Inherits:
BaseValidator
  • Object
show all
Defined in:
app/models/spree/return_item/eligibility_validator/no_reimbursements.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)


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

def eligible_for_return?
  if @return_item.inventory_unit.return_items.reimbursed.valid.any?
    add_error(:inventory_unit_reimbursed, Spree.t('return_item_inventory_unit_reimbursed'))
    return false
  else
    return true
  end
end

#requires_manual_intervention?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/spree/return_item/eligibility_validator/no_reimbursements.rb', line 15

def requires_manual_intervention?
  @errors.present?
end