Class: Spree::Refund
- Inherits:
-
Object
- Object
- Spree::Refund
- Includes:
- Metadata, Metafields, Security::Refunds, Webhooks::HasWebhooks
- 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
- #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.
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
34 35 36 |
# File 'app/models/spree/refund.rb', line 34 def response @response end |
Class Method Details
.total_amount_reimbursed_for(reimbursement) ⇒ Object
44 45 46 |
# File 'app/models/spree/refund.rb', line 44 def total_amount_reimbursed_for(reimbursement) reimbursement.refunds.to_a.sum(&:amount) end |
Instance Method Details
#description ⇒ Object
49 50 51 |
# File 'app/models/spree/refund.rb', line 49 def description payment.payment_method.name end |
#editable? ⇒ Boolean
Returns true if the refund is editable.
65 66 67 |
# File 'app/models/spree/refund.rb', line 65 def editable? !payment.order.canceled? end |
#money ⇒ Object Also known as: display_amount
38 39 40 |
# File 'app/models/spree/refund.rb', line 38 def money Spree::Money.new(amount, currency: currency) end |
#return_items ⇒ Array<Spree::ReturnItem>
return items for the refund
56 57 58 59 60 |
# File 'app/models/spree/refund.rb', line 56 def return_items return [] unless reimbursement.present? reimbursement.customer_return&.return_items || reimbursement.return_items end |