Class: Spree::CustomerReturn

Inherits:
Base
  • Object
show all
Extended by:
DisplayMoney
Defined in:
app/models/spree/customer_return.rb

Instance Method Summary collapse

Methods included from DisplayMoney

money_methods

Methods inherited from Base

belongs_to_required_by_default, page, spree_base_scopes

Methods included from Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

#completely_decided?Boolean


26
27
28
# File 'app/models/spree/customer_return.rb', line 26

def completely_decided?
  !return_items.undecided.exists?
end

#fully_reimbursed?Boolean


30
31
32
# File 'app/models/spree/customer_return.rb', line 30

def fully_reimbursed?
  completely_decided? && return_items.accepted.includes(:reimbursement).all? { |return_item| return_item.reimbursement.try(:reimbursed?) }
end

#orderObject

Temporarily tie a customer_return to one order


35
36
37
38
# File 'app/models/spree/customer_return.rb', line 35

def order
  return nil if return_items.blank?
  return_items.first.inventory_unit.order
end

#pre_tax_totalObject


40
41
42
# File 'app/models/spree/customer_return.rb', line 40

def pre_tax_total
  return_items.sum(:pre_tax_amount)
end