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

Methods included from Core::Permalinks

#generate_permalink, #save_permalink

Instance Method Details

#amountObject



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

def amount
  return_items.sum(:amount)
end

#can_cancel_return_items?Boolean

Returns:

  • (Boolean)


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

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

#currencyObject



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

def currency
  order.currency
end

#customer_returned_items?Boolean

Returns:

  • (Boolean)


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

def customer_returned_items?
  customer_returns.exists?
end

#refundable_amountObject



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

def refundable_amount
  order.item_total_before_tax + order.promo_total
end

#total_excluding_vatObject



32
33
34
# File 'app/models/spree/return_authorization.rb', line 32

def total_excluding_vat
  return_items.sum(&:total_excluding_vat)
end