$preparedTransactionStruct =
$this->paymentTransactionStructFactory->
prepared($transaction,
$order);
$paymentHandler->
capture($preparedTransactionStruct,
$dataBag,
$salesChannelContext,
$preOrderStruct);
} catch (PaymentProcessException
$e) { $this->logger->
error('An error occurred during processing the capture of the payment. The order has been placed.',
['orderId' =>
$order->
getId(), 'exceptionMessage' =>
$e->
getMessage()]);
throw $e;
} } private function getTransaction(OrderEntity
$order, SalesChannelContext
$salesChannelContext): ?OrderTransactionEntity
{ $transactions =
$order->
getTransactions();
if ($transactions === null
) { throw PaymentException::
invalidOrder($order->
getId());
} $transactions =
$transactions->
filterByStateId( $this->initialStateIdLoader->
get(OrderTransactionStates::STATE_MACHINE
) );
return $transactions->
last();
}