diff --git a/src/MerchantCapture/MerchantCaptureModule.php b/src/MerchantCapture/MerchantCaptureModule.php index a3177f88..0bdca1df 100644 --- a/src/MerchantCapture/MerchantCaptureModule.php +++ b/src/MerchantCapture/MerchantCaptureModule.php @@ -153,7 +153,11 @@ public function run(ContainerInterface $container): bool add_action( $pluginId . '_after_webhook_action', - static function (Payment $payment, WC_Order $order) use ($container) { + static function ($payment, WC_Order $order) use ($container) { + + if (!$payment instanceof Payment) { + return; + } if ($payment->isAuthorized()) { if (!$payment->getAmountCaptured() == 0.0) { diff --git a/src/Payment/MollieOrderService.php b/src/Payment/MollieOrderService.php index 43533281..ede0c6d0 100644 --- a/src/Payment/MollieOrderService.php +++ b/src/Payment/MollieOrderService.php @@ -179,9 +179,7 @@ public function onWebhookAction() )); } - if ($payment instanceof Payment) { - do_action($this->pluginId . '_after_webhook_action', $payment, $order); - } + do_action($this->pluginId . '_after_webhook_action', $payment, $order); // Status 200 } /**