diff --git a/src/Controller/Storefront/Webhook/NotificationFacade.php b/src/Controller/Storefront/Webhook/NotificationFacade.php index 0f221fbc1..d16eba760 100644 --- a/src/Controller/Storefront/Webhook/NotificationFacade.php +++ b/src/Controller/Storefront/Webhook/NotificationFacade.php @@ -297,6 +297,7 @@ private function getTransaction(string $transactionId, Context $context): ?Order $criteria->addAssociation('order.transactions'); $criteria->addAssociation('order.stateMachineState'); $criteria->addAssociation('paymentMethod'); + $criteria->addAssociation('stateMachineState'); return $this->repoOrderTransactions->search($criteria, $context)->first(); } diff --git a/src/Facade/MolliePaymentFinalize.php b/src/Facade/MolliePaymentFinalize.php index 2dd26981d..05a6dd45a 100644 --- a/src/Facade/MolliePaymentFinalize.php +++ b/src/Facade/MolliePaymentFinalize.php @@ -106,7 +106,8 @@ public function __construct(OrderStatusConverter $orderStatusConverter, OrderSta */ public function finalize(AsyncPaymentTransactionStruct $transactionStruct, SalesChannelContext $salesChannelContext): void { - $order = $transactionStruct->getOrder(); + $order = $this->orderService->getOrder($transactionStruct->getOrder()->getId(), $salesChannelContext->getContext()); + $customFields = $order->getCustomFields() ?? []; $customFieldsStruct = new OrderAttributes($order); $mollieOrderId = $customFieldsStruct->getMollieOrderId(); diff --git a/src/Service/Order/OrderStatusUpdater.php b/src/Service/Order/OrderStatusUpdater.php index a3ac1754e..05967bcd3 100644 --- a/src/Service/Order/OrderStatusUpdater.php +++ b/src/Service/Order/OrderStatusUpdater.php @@ -186,7 +186,7 @@ public function updateOrderStatus(OrderEntity $order, string $statusTo, MollieSe # let's check if we have configured a final order state. # if so, we need to verify, if a transition is even allowed if (! empty($settings->getOrderStateFinalState())) { - $currentId = ($stateMachine instanceof StateMachineStateEntity) ? $stateMachine->getId() : ''; + $currentId = ($stateMachine instanceof StateMachineStateEntity) ? $stateMachine->getId() : $order->getStateId(); # test if our current order does already have # our configured final order state diff --git a/src/Service/OrderService.php b/src/Service/OrderService.php index eabd648a4..9a3d82568 100644 --- a/src/Service/OrderService.php +++ b/src/Service/OrderService.php @@ -98,6 +98,7 @@ public function getOrder(string $orderId, Context $context): OrderEntity $criteria->addAssociation('billingAddress'); # important for subscription creation $criteria->addAssociation('billingAddress.country'); $criteria->addAssociation('orderCustomer'); + $criteria->addAssociation('stateMachineState'); $criteria->addAssociation('orderCustomer.customer'); $criteria->addAssociation('orderCustomer.salutation'); $criteria->addAssociation('language');