Skip to content

Commit

Permalink
Merge pull request #1171 from PrestaShopCorp/feature/PAYSHIP-2557-PS-…
Browse files Browse the repository at this point in the history
…Accounts-with-psx-name-ps6

PAYSHIP-2557 PS Accounts psx source name - PS1.6
  • Loading branch information
Matt75 authored Dec 1, 2023
2 parents 093dc5a + ade2bca commit 3121b7d
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions ps_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,18 +526,34 @@ public function hookDisplayFooterProduct()

public function getContent()
{
/** @var \PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts $psAccountsFacade */
$psAccountsFacade = $this->getService('ps_accounts.facade');
$env = new \PrestaShop\Module\PrestashopCheckout\Environment\Env();
try {
/** @var \PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts $psAccountsFacade */
$psAccountsFacade = $this->getService('ps_accounts.facade');
/** @var \PrestaShop\PsAccountsInstaller\Installer\Presenter\InstallerPresenter $psAccountsPresenter */
$psAccountsPresenter = $psAccountsFacade->getPsAccountsPresenter();
// @phpstan-ignore-next-line
$contextPsAccounts = $psAccountsPresenter->present($this->name);
} catch (Exception $exception) {
$contextPsAccounts = [];
$this->getLogger()->error(
'Failed to get PsAccounts context',
[
'exception' => get_class($exception),
'exceptionCode' => $exception->getCode(),
'exceptionMessage' => $exception->getMessage(),
]
);
}

/** @var \PrestaShop\Module\PrestashopCheckout\Presenter\Store\StorePresenter $storePresenter */
$storePresenter = $this->getService('ps_checkout.store.store');

Media::addJsDef([
'store' => $storePresenter->present(),
'contextPsAccounts' => $psAccountsFacade->getPsAccountsPresenter()->present(),
'contextPsAccounts' => $contextPsAccounts,
]);

$env = new \PrestaShop\Module\PrestashopCheckout\Environment\Env();
$boSdkUrl = $env->getEnv('CHECKOUT_BO_SDK_URL');
if (substr($boSdkUrl, -3) !== '.js') {
$boSdkVersion = $env->getEnv('CHECKOUT_BO_SDK_VERSION');
Expand Down

0 comments on commit 3121b7d

Please sign in to comment.