class MarketTown::Checkout::CompleteStep
Handles completion of checkout. All payments and options should have already been completed by this point. The purpose of this step is to request the fulfilment of the order and notify the customer.
Dependencies:
- finish#complete_step_finished? - fulfilments#fulfil - notifications#notify - finish#complete_step
Protected Instance Methods
ensure_incomplete(state)
click to toggle source
@raise [AlreadyCompleteError]
# File lib/market_town/checkout/steps/complete_step.rb, line 25 def ensure_incomplete(state) if deps.finish.complete_step_finished?(state) raise AlreadyCompleteError.new(state) end end
finish_complete_step(state)
click to toggle source
Finishes complete step
# File lib/market_town/checkout/steps/complete_step.rb, line 49 def finish_complete_step(state) deps.finish.complete_step(state) end
fulfil_order(state)
click to toggle source
Tries to fulfil order
# File lib/market_town/checkout/steps/complete_step.rb, line 33 def fulfil_order(state) deps.fulfilments.fulfil(state) rescue MissingDependency add_dependency_missing_warning(state, :cannot_fulfil_order) end
send_order_complete_notice(state)
click to toggle source
Tries to send notifications about order complete
# File lib/market_town/checkout/steps/complete_step.rb, line 41 def send_order_complete_notice(state) deps.notifications.notify(:order_complete, state) rescue MissingDependency add_dependency_missing_warning(state, :cannot_send_order_complete_notice) end