mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
14 lines
493 B
Ruby
14 lines
493 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Provides a method to set the order state to "in progress"
|
|
class Orders::SetInProgressService
|
|
def call(order, current_user)
|
|
raise ::UpdateOrderStateError if %w[cart payment_failed in_progress canceled refunded delivered].include?(order.state)
|
|
|
|
order.state = 'in_progress'
|
|
order.order_activities.push(OrderActivity.new(activity_type: 'in_progress', operator_profile_id: current_user.invoicing_profile.id))
|
|
order.save
|
|
order.reload
|
|
end
|
|
end
|