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.
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
33 34 35 |
# File 'app/models/spree/refund.rb', line 33 def response @response end |
Class Method Details
.total_amount_reimbursed_for(reimbursement) ⇒ Object
47 48 49 |
# File 'app/models/spree/refund.rb', line 47 def total_amount_reimbursed_for(reimbursement) reimbursement.refunds.to_a.sum(&:amount) end |
Instance Method Details
#amount=(amount) ⇒ Object
37 38 39 |
# File 'app/models/spree/refund.rb', line 37 def amount=(amount) self[:amount] = Spree::LocalizedNumber.parse(amount) end |
#description ⇒ Object
52 53 54 |
# File 'app/models/spree/refund.rb', line 52 def description payment.payment_method.name end |
#editable? ⇒ Boolean
Returns true if the refund is editable.
68 69 70 |
# File 'app/models/spree/refund.rb', line 68 def editable? !payment.order.canceled? end |
#money ⇒ Object Also known as: display_amount
41 42 43 |
# File 'app/models/spree/refund.rb', line 41 def money Spree::Money.new(amount, currency: currency) end |
#return_items ⇒ Array<Spree::ReturnItem>
return items for the refund
59 60 61 62 63 |
# File 'app/models/spree/refund.rb', line 59 def return_items return [] unless reimbursement.present? reimbursement.customer_return&.return_items || reimbursement.return_items end |