diff --git a/modules/btcpay/btcpay.php b/modules/btcpay/btcpay.php index cf9a9a2..11d8a90 100644 --- a/modules/btcpay/btcpay.php +++ b/modules/btcpay/btcpay.php @@ -295,25 +295,30 @@ public function hookDisplayOrderDetail(array $params): ?string return null; } - // Get BTCPay URL or abort - if (empty($serverUrl = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST))) { + // Check if we actually have an order + $order = $params['order']; + if (!$order instanceof Order) { return null; } - // Ensure the client is ready for use - if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) { + // If created by another module, return + if ($order->module !== $this->name) { + return false; + } + + // Check if we actually have an cart + $cart = $params['cart']; + if (!$cart instanceof Cart) { return null; } - // Check if we actually have an order - $order = $params['order']; - if (!$order instanceof Order) { + // Get BTCPay URL or abort + if (empty($serverUrl = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST))) { return null; } - // Check if we actually have an order - $cart = $params['cart']; - if (!$cart instanceof Cart) { + // Ensure the client is ready for use + if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) { return null; }