Skip to content

Commit

Permalink
Add logging to save order extension data observer.
Browse files Browse the repository at this point in the history
  • Loading branch information
NickolasMalovanets committed Jun 19, 2024
1 parent b7aece6 commit 0144359
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Observer/Order/SaveOrderExtensionDataObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ public function __construct(
*/
public function execute(Observer $observer)
{
$order = $observer->getEvent()->getOrder();
if ($order->getPayment()->getMethod() !== Service::CODE) {
return;
}
$orderId = (int)$order->getEntityId();
$publicOrderId = $this->checkoutSession->getBoldCheckoutData()['data']['public_order_id'] ?? null;
$this->checkoutSession->setBoldCheckoutData(null);
if (!$publicOrderId) {
$this->logger->error('Public order id for order ID = ' . $order->getId() . 'is missing.');
return;
}
try {
$order = $observer->getEvent()->getOrder();
if ($order->getPayment()->getMethod() !== Service::CODE) {
return;
}
$orderId = (int)$order->getEntityId();
$publicOrderId = $this->checkoutSession->getBoldCheckoutData()['data']['public_order_id'] ?? null;
$this->checkoutSession->setBoldCheckoutData(null);
if (!$publicOrderId) {
$this->logger->error('Public order id for order ID = ' . $order->getId() . 'is missing.');
return;
}
$orderExtensionData = $this->orderExtensionDataFactory->create();
$orderExtensionData->setOrderId($orderId);
$orderExtensionData->setPublicId($publicOrderId);
Expand Down

0 comments on commit 0144359

Please sign in to comment.