Class: Spree::Reimbursement::Credit

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/reimbursement/credit.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

display_includes, #initialize_preference_defaults, page, preference

Methods included from Preferences::Preferable

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

Class Method Details

.total_amount_reimbursed_for(reimbursement) ⇒ Object



13
14
15
# File 'app/models/spree/reimbursement/credit.rb', line 13

def total_amount_reimbursed_for(reimbursement)
  reimbursement.credits.to_a.sum(&:amount)
end

Instance Method Details

#descriptionObject



18
19
20
# File 'app/models/spree/reimbursement/credit.rb', line 18

def description
  creditable.class.name.demodulize
end

#display_amountObject



22
23
24
# File 'app/models/spree/reimbursement/credit.rb', line 22

def display_amount
  Spree::Money.new(amount, { currency: creditable.try(:currency) || "USD" })
end