Class: Spree::Claims::Create
- Includes:
- Refunds::TaxCredit
- Defined in:
- app/workflows/spree/claims/create.rb
Overview
Opens a claim: the customer reports a problem with what arrived.
No goods come back — that is the point of a claim — so there is nothing to receive and nothing to restock.
Instance Attribute Summary collapse
-
#claim ⇒ Object
readonly
Returns the value of attribute claim.
Instance Method Summary collapse
Methods inherited from Workflow
#call, define_argument_readers, #errors, #halt!, hooks, inherited, model_name, #read_attribute_for_validation, #reject!, workflow_key
Methods included from ServiceModule::Base
Methods included from Workflow::ControlFlow
Instance Attribute Details
#claim ⇒ Object (readonly)
Returns the value of attribute claim.
12 13 14 |
# File 'app/workflows/spree/claims/create.rb', line 12 def claim @claim end |
Instance Method Details
#perform(order:, items:, reason: nil, memo: nil, created_by: nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/workflows/spree/claims/create.rb', line 20 def perform(order:, items:, reason: nil, memo: nil, created_by: nil) super step :ensure_claimable step :normalize_items run_hooks :validate ApplicationRecord.transaction do step :build_claim step :calculate_tax step :ensure_refunds_within_paid end run_hooks :after_create claim.publish_event('claim.opened') success(claim.reload) end |