#[Route(path: '/store-api/order/state/cancel', name: 'store-api.order.state.cancel', methods: ['POST'], defaults: ['_loginRequired' => true, '_loginRequiredAllowGuest' => true])]
public function cancel(Request
$request, SalesChannelContext
$context): CancelOrderRouteResponse
{ $orderId =
$request->
get('orderId', null
);
if ($orderId === null
) { throw RoutingException::
invalidRequestParameter('orderId'
);
} $this->
verify($orderId,
$context);
$newState =
$this->orderService->
orderStateTransition( $orderId,
'cancel',
new ParameterBag(),
$context->
getContext() );
return new CancelOrderRouteResponse($newState);
} private function verify(string
$orderId, SalesChannelContext
$context): void
{