Advance order when creating a shipment

This action gets called from the order edit page when adding line items and it's one of the places that needs to advance the order *before* redirecting back to the order edit action
This commit is contained in:
Matt-Yorkley
2023-06-07 00:50:08 +01:00
parent acc34d1deb
commit cf0f148dba

View File

@@ -21,6 +21,10 @@ module Api
@shipment.refresh_rates
@shipment.save!
if @order.line_items.any? && @order.state.in?(["cart", "address", "delivery"])
OrderWorkflow.new(@order).advance_to_payment
end
render json: @shipment.reload, serializer: Api::ShipmentSerializer, status: :ok
end