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

Methods included from Core::Permalinks

#generate_permalink, #save_permalink

Class Method Details

.total_amount_reimbursed_for(reimbursement) ⇒ Object



15
16
17
# File 'app/models/spree/reimbursement/credit.rb', line 15

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

Instance Method Details

#descriptionObject



20
21
22
# File 'app/models/spree/reimbursement/credit.rb', line 20

def description
  creditable.class.name.demodulize
end

#display_amountObject



24
25
26
# File 'app/models/spree/reimbursement/credit.rb', line 24

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