diff --git a/Helper/Data.php b/Helper/Data.php index 2941059..aa3d0c8 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -291,8 +291,11 @@ public function getGenerateApiKeyUrl(int $magentoStoreId) $applicationIdentifier = 'magento2'; $baseUrl = $this->btcPayService->getBtcPayServerBaseUrl(); + $authorizeUrl = null; - $authorizeUrl = \BTCPayServer\Client\ApiKey::getAuthorizeUrl($baseUrl, \Storefront\BTCPay\Helper\Data::REQUIRED_API_PERMISSIONS, 'Magento 2 @ ' . $magentoRootDomain, true, false, $redirectToUrlAfterCreation, $applicationIdentifier); + if ($baseUrl) { + $authorizeUrl = \BTCPayServer\Client\ApiKey::getAuthorizeUrl($baseUrl, \Storefront\BTCPay\Helper\Data::REQUIRED_API_PERMISSIONS, 'Magento 2 @ ' . $magentoRootDomain, true, true, $redirectToUrlAfterCreation, $applicationIdentifier); + } return $authorizeUrl; } diff --git a/Model/Config/ApiKeyComment.php b/Model/Config/ApiKeyComment.php index 53b50e6..f82332a 100644 --- a/Model/Config/ApiKeyComment.php +++ b/Model/Config/ApiKeyComment.php @@ -68,10 +68,10 @@ public function getCommentText($elementValue) $baseUrl = $this->btcPayService->getBtcPayServerBaseUrl(); if ($baseUrl) { - $authorizeUrl = \BTCPayServer\Client\ApiKey::getAuthorizeUrl($baseUrl, \Storefront\BTCPay\Helper\Data::REQUIRED_API_PERMISSIONS, 'Magento 2 @ ' . $magentoRootDomain, true, false, $redirectToUrlAfterCreation, $applicationIdentifier); + $authorizeUrl = \BTCPayServer\Client\ApiKey::getAuthorizeUrl($baseUrl, \Storefront\BTCPay\Helper\Data::REQUIRED_API_PERMISSIONS, 'Magento 2 @ ' . $magentoRootDomain, true, true, $redirectToUrlAfterCreation, $applicationIdentifier); $r = 'Generate API key, but be sure to save any changes first.'; } else { - $r = 'Make sure you configure the VTCPay Base Url above'; + $r = 'Make sure you configure the BTCPay Base Url above'; } } return $r;