Class: Spree::ReturnAuthorization

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

Overview

Models the return of Inventory Units to a Stock Location for an Order.

Instance Method Summary collapse

Methods included from DisplayMoney

money_methods

Methods inherited from Base

display_includes, #initialize_preference_defaults, page, preference

Methods included from Preferences::Preferable

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

Instance Method Details

#amountObject



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

def amount
  return_item.sum(:amount)
end

#can_cancel_return_items?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'app/models/spree/return_authorization.rb', line 56

def can_cancel_return_items?
  return_items.any?(&:can_cancel?) || return_items.blank?
end

#currencyObject



44
45
46
# File 'app/models/spree/return_authorization.rb', line 44

def currency
  order.currency
end

#customer_returned_items?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'app/models/spree/return_authorization.rb', line 52

def customer_returned_items?
  customer_returns.exists?
end

#pre_tax_totalObject



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

def pre_tax_total
  return_items.map(&:pre_tax_amount).sum
end

#refundable_amountObject



48
49
50
# File 'app/models/spree/return_authorization.rb', line 48

def refundable_amount
  order.discounted_item_amount + order.promo_total
end