1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/app/services/orders/set_in_progress_service.rb

14 lines
477 B
Ruby
Raw Normal View History

2022-09-15 20:19:19 +02:00
# frozen_string_literal: true
# Provides methods for set in progress state to order
class Orders::SetInProgressService
def call(order, current_user)
raise ::UpdateOrderStateError if %w[cart payment_failed in_progress canceled refunded].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