Skip to content

Commit

Permalink
NTR: PISHPS-286: add stateMashineState (#757)
Browse files Browse the repository at this point in the history
Co-authored-by: Vitalij Mik <[email protected]>
  • Loading branch information
BlackScorp and Vitalij Mik authored Jun 17, 2024
1 parent 6ed786f commit 355d411
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Controller/Storefront/Webhook/NotificationFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion src/Facade/MolliePaymentFinalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Order/OrderStatusUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Service/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 355d411

Please sign in to comment.