CodeExplorer getOrderRules example
$transactionId = Uuid::
randomHex();
$payload =
[ 'id' =>
$order->
getId(),
'transactions' =>
[ [ 'id' =>
$transactionId,
'paymentMethodId' =>
$paymentMethodId,
'stateId' =>
$initialState,
'amount' =>
$transactionAmount,
],
],
'ruleIds' =>
$this->
getOrderRules($order,
$salesChannelContext),
];
$context->
scope( Context::SYSTEM_SCOPE,
function D
) use ($payload,
$context): void
{ $this->orderRepository->
update([$payload],
$context);
} );
$changedOrder =
$this->
loadOrder($order->
getId(),
$salesChannelContext);
$transactions =
$changedOrder->
getTransactions();