Skip to content

Commit

Permalink
v5.8.0: di compile fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ebanolopes committed Jun 5, 2024
1 parent 94bc451 commit d1ef9ff
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Plugin/Adyen/Payment/Helper/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
use Magento\Sales\Model\ResourceModel\Order as OrderResourceModel;
use Signifyd\Connect\Helper\OrderHelper;
use Signifyd\Connect\Logger\Logger;
use Signifyd\Connect\Model\Casedata;
use Magento\Framework\ObjectManagerInterface;
use Signifyd\Connect\Model\CasedataFactory;
use Signifyd\Connect\Model\ResourceModel\Casedata as CasedataResourceModel;
use Adyen\Payment\Helper\Webhook as AdyenWebhook;
use Adyen\Payment\Helper\Order as AdyenOrderHelper;

class Webhook
{
Expand Down Expand Up @@ -37,11 +36,10 @@ class Webhook
* @var OrderHelper
*/
public $orderHelper;

/**
* @var AdyenOrderHelper
* @var ObjectManagerInterface
*/
public $adyenOrderHelper;
public $objectManagerInterface;

/**
* Cancel constructor.
Expand All @@ -50,28 +48,32 @@ class Webhook
* @param CasedataResourceModel $casedataResourceModel
* @param OrderResourceModel $orderResourceModel
* @param OrderHelper $orderHelper
* @param AdyenOrderHelper $adyenOrderHelper
* @param ObjectManagerInterface $objectManagerInterface
*/
public function __construct(
Logger $logger,
CasedataFactory $casedataFactory,
CasedataResourceModel $casedataResourceModel,
OrderResourceModel $orderResourceModel,
OrderHelper $orderHelper,
AdyenOrderHelper $adyenOrderHelper
ObjectManagerInterface $objectManagerInterface
) {
$this->logger = $logger;
$this->casedataFactory = $casedataFactory;
$this->casedataResourceModel = $casedataResourceModel;
$this->orderResourceModel = $orderResourceModel;
$this->orderHelper = $orderHelper;
$this->adyenOrderHelper = $adyenOrderHelper;
$this->objectManagerInterface = $objectManagerInterface;
}

public function aroundProcessNotification(AdyenWebhook $subject, callable $proceed, $notification)
{
try {
$order = $this->adyenOrderHelper->getOrderByIncrementId($notification->getMerchantReference());
$adyenOrderHelper = $this->objectManagerInterface->create(
\Adyen\Payment\Helper\Order::class
);

$order = $adyenOrderHelper->getOrderByIncrementId($notification->getMerchantReference());

if (!$order) {
return $proceed($notification);
Expand All @@ -83,7 +85,6 @@ public function aroundProcessNotification(AdyenWebhook $subject, callable $proce

if ($case->isEmpty()) {
return $proceed($notification);
;
}

$isHoldedBeforeAdyenProcess = $order->canUnhold();
Expand All @@ -95,7 +96,7 @@ public function aroundProcessNotification(AdyenWebhook $subject, callable $proce

$returnValue = $proceed($notification);

$order = $this->adyenOrderHelper->getOrderByIncrementId($notification->getMerchantReference());
$order = $adyenOrderHelper->getOrderByIncrementId($notification->getMerchantReference());

//Setting order to hold after adyen process
if ($isHoldedBeforeAdyenProcess && $order->canHold()) {
Expand Down

0 comments on commit d1ef9ff

Please sign in to comment.