diff --git a/app/controllers/api/v0/shipments_controller.rb b/app/controllers/api/v0/shipments_controller.rb index 05376a2666..d742f2c29e 100644 --- a/app/controllers/api/v0/shipments_controller.rb +++ b/app/controllers/api/v0/shipments_controller.rb @@ -23,6 +23,8 @@ module Api OrderWorkflow.new(@order).advance_to_payment if @order.line_items.any? + @order.recreate_all_fees! + render json: @shipment, serializer: Api::ShipmentSerializer, status: :ok end diff --git a/spec/controllers/api/v0/shipments_controller_spec.rb b/spec/controllers/api/v0/shipments_controller_spec.rb index 98584c9121..9ade418913 100644 --- a/spec/controllers/api/v0/shipments_controller_spec.rb +++ b/spec/controllers/api/v0/shipments_controller_spec.rb @@ -91,6 +91,18 @@ describe Api::V0::ShipmentsController, type: :controller do expect_error_response end + + it "applies any enterprise fees that are present" do + order_cycle = create(:simple_order_cycle, + coordinator: order.distributor, + coordinator_fees: [create(:enterprise_fee, amount: 20)], + distributors: [order.distributor], + variants: [variant]) + order.update!(order_cycle_id: order_cycle.id) + spree_post :create, params + + expect(order.line_item_adjustments.where(originator_type: "EnterpriseFee")).to be_present + end end it "can make a shipment ready" do