Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
tryTransition example
$this
->
validatePaymentState
(
$order
)
;
$this
->
setPaymentMethod
(
$paymentMethodId
,
$order
,
$context
)
;
return
new
SetPaymentOrderRouteResponse
(
)
;
}
private
function
setPaymentMethod
(
string
$paymentMethodId
, OrderEntity
$order
, SalesChannelContext
$salesChannelContext
)
: void
{
$context
=
$salesChannelContext
->
getContext
(
)
;
if
(
$this
->
tryTransition
(
$order
,
$paymentMethodId
,
$context
)
)
{
return
;
}
$initialState
=
$this
->initialStateIdLoader->
get
(
OrderTransactionStates::STATE_MACHINE
)
;
$transactionAmount
=
new
CalculatedPrice
(
$order
->
getPrice
(
)
->
getTotalPrice
(
)
,
$order
->
getPrice
(
)
->
getTotalPrice
(
)
,
$order
->
getPrice
(
)
->
getCalculatedTaxes
(
)
,
$order
->
getPrice
(
)
->
getTaxRules
(
)
)
;