Skip to content

Commit

Permalink
Updating to serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
khushboo-singhvi committed Oct 30, 2024
1 parent 42429ce commit 27dbd8f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Helper/Webhook/OrderClosedWebhookHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Adyen\Payment\Model\Notification;
use Magento\Sales\Model\Order as MagentoOrder;
use Adyen\Payment\Model\ResourceModel\Order\Payment\CollectionFactory as OrderPaymentCollectionFactory;
use Magento\Framework\Serialize\SerializerInterface;

class OrderClosedWebhookHandler implements WebhookHandlerInterface
{
Expand All @@ -38,6 +39,11 @@ class OrderClosedWebhookHandler implements WebhookHandlerInterface
/** @var OrderPaymentCollectionFactory */
private $adyenOrderPaymentCollectionFactory;

/**
* @var SerializerInterface
*/
private $serializer;

/**
* @param AdyenOrderPayment $adyenOrderPayment
* @param OrderHelper $orderHelper
Expand All @@ -50,13 +56,15 @@ public function __construct(
OrderHelper $orderHelper,
Config $configHelper,
OrderPaymentCollectionFactory $adyenOrderPaymentCollectionFactory,
AdyenLogger $adyenLogger
AdyenLogger $adyenLogger,
SerializerInterface $serializer
) {
$this->adyenOrderPaymentHelper = $adyenOrderPayment;
$this->orderHelper = $orderHelper;
$this->configHelper = $configHelper;
$this->adyenOrderPaymentCollectionFactory = $adyenOrderPaymentCollectionFactory;
$this->adyenLogger = $adyenLogger;
$this->serializer = $serializer;
}

/**
Expand All @@ -73,7 +81,7 @@ public function handleWebhook(
): MagentoOrder {
$additionalData = $notification->getAdditionalData();
if (is_string($additionalData)) {
$additionalData = @unserialize($additionalData) ?: [];
$additionalData = $this->serializer->unserialize($additionalData);
}
if ($notification->isSuccessful()) {
foreach ($additionalData as $key => $value) {
Expand Down

0 comments on commit 27dbd8f

Please sign in to comment.