Skip to content

Commit

Permalink
Merge pull request #17 from ndeet/btcpay-store-selection
Browse files Browse the repository at this point in the history
Make sure the user needs to select store.
  • Loading branch information
woutersamaey authored Jun 22, 2023
2 parents d9b8a5a + 4c340ee commit 86b24c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions Model/Config/ApiKeyComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<a target="_blank" href="' . $authorizeUrl . '">Generate API key</a>, but be sure to save any changes first.';
} else {
$r = 'Make sure you configure the <strong>VTCPay Base Url</strong> above';
$r = 'Make sure you configure the <strong>BTCPay Base Url</strong> above';
}
}
return $r;
Expand Down

0 comments on commit 86b24c0

Please sign in to comment.