Skip to content

Commit

Permalink
NTR: change the output for components (#414)
Browse files Browse the repository at this point in the history
* NTR: change the output for components

* NTR: Csfixer

---------

Co-authored-by: Vitalij Mik <[email protected]>
  • Loading branch information
BlackScorp and Vitalij Mik authored May 29, 2024
1 parent bbfe9f2 commit be4b3cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Controllers/Frontend/Mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ public function idealIssuersAction()
public function componentsAction()
{
Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender();
$response = Shopware()->Front()->Response();
try {
$this->loadServices();

Expand All @@ -514,16 +515,14 @@ public function componentsAction()

$mollieTestMode = $this->config->isTestmodeActive();

$response->setHeader('Content-Type', 'text/javascript');

header('Content-Type: text/javascript');

$script = file_get_contents(__DIR__ . '/../../Resources/views/frontend/_public/src/js/components.js');
$script = str_replace('[mollie_profile_id]', $mollieProfileId, $script);
$script = str_replace('[mollie_locale]', $this->localeFinder->getPaymentLocale(Shopware()->Shop()->getLocale()->getLocale()), $script);
$script = str_replace('[mollie_testmode]', ($mollieTestMode === true) ? 'true' : 'false', $script);
echo $script;

ob_end_flush();
$response->setBody($script);
} catch (\Exception $ex) {
$this->logger->error('Error when showing Credit Card Components: ' . $ex->getMessage());

Expand Down

0 comments on commit be4b3cf

Please sign in to comment.