Class: Spree::ReturnAuthorization
- Inherits:
-
Object
- Object
- Spree::ReturnAuthorization
- Extended by:
- DisplayMoney
- Includes:
- NumberIdentifier, Webhooks::HasWebhooks
- Defined in:
- app/models/spree/return_authorization.rb
Instance Method Summary collapse
- #can_cancel_return_items? ⇒ Boolean
- #currency ⇒ Object
- #customer_returned_items? ⇒ Boolean
- #pre_tax_total ⇒ Object
- #refundable_amount ⇒ Object
Methods included from DisplayMoney
Instance Method Details
#can_cancel_return_items? ⇒ Boolean
66 67 68 |
# File 'app/models/spree/return_authorization.rb', line 66 def can_cancel_return_items? return_items.any?(&:can_cancel?) || return_items.blank? end |
#currency ⇒ Object
53 54 55 56 |
# File 'app/models/spree/return_authorization.rb', line 53 def currency # FIXME: we should associate ReturnAuthorization with Store order.nil? ? Spree::Store.default.default_currency : order.currency end |
#customer_returned_items? ⇒ Boolean
62 63 64 |
# File 'app/models/spree/return_authorization.rb', line 62 def customer_returned_items? customer_returns.exists? end |
#pre_tax_total ⇒ Object
49 50 51 |
# File 'app/models/spree/return_authorization.rb', line 49 def pre_tax_total return_items.sum(:pre_tax_amount) end |
#refundable_amount ⇒ Object
58 59 60 |
# File 'app/models/spree/return_authorization.rb', line 58 def refundable_amount order.pre_tax_item_amount + order.promo_total end |