Class: Spree::Refund

Inherits:
Object
  • Object
show all
Includes:
Metadata, Metafields, Security::Refunds, Webhooks::HasWebhooks
Defined in:
app/models/spree/refund.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#responseObject (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

#descriptionObject



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

#moneyObject 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_itemsArray<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