Class: Spree::Calculator::Returns::DefaultRefundAmount

Inherits:
ReturnsCalculator show all
Defined in:
app/models/spree/calculator/returns/default_refund_amount.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Spree::Calculator

#available?, calculators, #description, register, #to_s

Methods inherited from Base

page

Methods included from Preferences::Preferable

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

Class Method Details

.descriptionObject


7
8
9
# File 'app/models/spree/calculator/returns/default_refund_amount.rb', line 7

def self.description
  Spree.t(:default_refund_amount)
end

Instance Method Details

#compute(return_item) ⇒ Object


11
12
13
14
# File 'app/models/spree/calculator/returns/default_refund_amount.rb', line 11

def compute(return_item)
  return 0.0.to_d if return_item.exchange_requested?
  weighted_order_adjustment_amount(return_item.inventory_unit) + weighted_line_item_pre_tax_amount(return_item.inventory_unit)
end