Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CancelOrderRouteResponse example
$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
{
if
(
$context
->
getCustomer
(
)
=== null
)
{
throw
OrderException::
customerNotLoggedIn
(
)
;
}
$criteria
=
new
Criteria
(
[
$orderId
]
)
;
$criteria
->
addFilter
(
new
EqualsFilter
(
'orderCustomer.customerId',
$context
->
getCustomer
(
)
->
getId
(
)
)
)
;