Class: Spree::Refund
- Inherits:
-
Object
- Object
- Spree::Refund
- Includes:
- Metadata, Metafields, Security::Refunds
- Defined in:
- app/models/spree/refund.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
- #amount=(amount) ⇒ Object
- #description ⇒ Object
-
#editable? ⇒ Boolean
Returns true if the refund is editable.
- #money ⇒ Object (also: #display_amount)
-
#return_items ⇒ Array<Spree::ReturnItem>
return items for the refund.
Methods included from Metadata
#metadata, #metadata=, #public_metadata=
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
35 36 37 |
# File 'app/models/spree/refund.rb', line 35 def response @response end |
Class Method Details
.total_amount_reimbursed_for(reimbursement) ⇒ Object
49 50 51 |
# File 'app/models/spree/refund.rb', line 49 def total_amount_reimbursed_for(reimbursement) reimbursement.refunds.to_a.sum(&:amount) end |
Instance Method Details
#amount=(amount) ⇒ Object
39 40 41 |
# File 'app/models/spree/refund.rb', line 39 def amount=(amount) self[:amount] = Spree::LocalizedNumber.parse(amount) end |
#description ⇒ Object
54 55 56 |
# File 'app/models/spree/refund.rb', line 54 def description payment.payment_method.name end |
#editable? ⇒ Boolean
Returns true if the refund is editable.
70 71 72 |
# File 'app/models/spree/refund.rb', line 70 def editable? !payment.order.canceled? end |
#money ⇒ Object Also known as: display_amount
43 44 45 |
# File 'app/models/spree/refund.rb', line 43 def money Spree::Money.new(amount, currency: currency) end |
#return_items ⇒ Array<Spree::ReturnItem>
return items for the refund
61 62 63 64 65 |
# File 'app/models/spree/refund.rb', line 61 def return_items return [] unless reimbursement.present? reimbursement.customer_return&.return_items || reimbursement.return_items end |