Class: Spree::ReturnAuthorization
- Inherits:
-
Base
- Object
- Base
- Spree::ReturnAuthorization
- Extended by:
- DisplayMoney
- Includes:
- Metadata
- 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
- #amount ⇒ Object
- #can_cancel_return_items? ⇒ Boolean
- #currency ⇒ Object
- #customer_returned_items? ⇒ Boolean
- #refundable_amount ⇒ Object
- #total_excluding_vat ⇒ Object
Methods included from DisplayMoney
Instance Method Details
#amount ⇒ Object
39 40 41 |
# File 'app/models/spree/return_authorization.rb', line 39 def amount return_items.sum(:amount) end |
#can_cancel_return_items? ⇒ Boolean
55 56 57 |
# File 'app/models/spree/return_authorization.rb', line 55 def can_cancel_return_items? return_items.any?(&:can_cancel?) || return_items.blank? end |
#currency ⇒ Object
43 44 45 |
# File 'app/models/spree/return_authorization.rb', line 43 def currency order.currency end |
#customer_returned_items? ⇒ Boolean
51 52 53 |
# File 'app/models/spree/return_authorization.rb', line 51 def customer_returned_items? customer_returns.exists? end |
#refundable_amount ⇒ Object
47 48 49 |
# File 'app/models/spree/return_authorization.rb', line 47 def refundable_amount order.item_total_before_tax + order.promo_total end |
#total_excluding_vat ⇒ Object
35 36 37 |
# File 'app/models/spree/return_authorization.rb', line 35 def total_excluding_vat return_items.sum(&:total_excluding_vat) end |