Skip to content

Commit

Permalink
Merge branch 'master' into magento2.3.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
  • Loading branch information
thomas-kl1 committed Feb 26, 2019
2 parents d5bd492 + 22fc6ff commit 62234a9
Show file tree
Hide file tree
Showing 94 changed files with 322 additions and 291 deletions.
30 changes: 15 additions & 15 deletions Api/Data/EraseCustomerInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/

Expand All @@ -17,29 +17,29 @@ interface EraseCustomerInterface extends ExtensibleDataInterface
/**#@+
* Constants for fields keys
*/
const ID = 'entity_id';
const CUSTOMER_ID = 'customer_id';
const SCHEDULED_AT = 'scheduled_at';
const STATE = 'state';
const STATUS = 'status';
const ERASED_AT = 'erased_at';
public const ID = 'entity_id';
public const CUSTOMER_ID = 'customer_id';
public const SCHEDULED_AT = 'scheduled_at';
public const STATE = 'state';
public const STATUS = 'status';
public const ERASED_AT = 'erased_at';
/**#@-*/

/**#@+
* Constants for State values
*/
const STATE_PENDING = 'pending';
const STATE_PROCESSING = 'processing';
const STATE_COMPLETE = 'complete';
public const STATE_PENDING = 'pending';
public const STATE_PROCESSING = 'processing';
public const STATE_COMPLETE = 'complete';
/**#@-*/

/**#@+
* Constants for Status values
*/
const STATUS_READY = 'ready';
const STATUS_RUNNING = 'running';
const STATUS_FAILED = 'failed';
const STATUS_SUCCEED = 'succeed';
public const STATUS_READY = 'ready';
public const STATUS_RUNNING = 'running';
public const STATUS_FAILED = 'failed';
public const STATUS_SUCCEED = 'succeed';
/**#@-*/

/**
Expand Down Expand Up @@ -122,7 +122,7 @@ public function setStatus(string $status): EraseCustomerInterface;
*
* @return string|null
*/
public function getErasedAt();
public function getErasedAt(): ?string;

/**
* Set the erased at
Expand Down
2 changes: 1 addition & 1 deletion Api/Data/EraseCustomerSearchResultsInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/

Expand Down
2 changes: 1 addition & 1 deletion Api/EraseCustomerManagementInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/

Expand Down
2 changes: 1 addition & 1 deletion Api/EraseCustomerRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/

Expand Down
35 changes: 18 additions & 17 deletions Block/Messages/PrivacyMessagePopup.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/
declare(strict_types=1);
Expand All @@ -9,6 +9,7 @@

use Magento\Cms\Block\Block;
use Magento\Cms\Helper\Page as HelperPage;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
Expand All @@ -19,7 +20,7 @@
*/
class PrivacyMessagePopup extends Template
{
const COOKIE_NAME = 'cookies-policy';
public const COOKIE_NAME = 'cookies-policy';

/**
* @var \Opengento\Gdpr\Model\Config
Expand All @@ -36,11 +37,6 @@ class PrivacyMessagePopup extends Template
*/
private $jsonSerializer;

/**
* @var string
*/
protected $_template = 'Opengento_Gdpr::messages/popup.phtml';

/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Opengento\Gdpr\Model\Config $config
Expand All @@ -53,7 +49,9 @@ public function __construct(
Config $config,
HelperPage $helperPage,
Json $jsonSerializer,
array $data = []
array $data = [
'template' => 'Opengento_Gdpr::messages/popup.phtml',
]
) {
$this->config = $config;
$this->helperPage = $helperPage;
Expand All @@ -64,7 +62,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
public function getJsLayout()
public function getJsLayout(): string
{
$this->jsLayout['components']['enhanced-privacy-cookie-policy']['config'] = [
'cookieName' => self::COOKIE_NAME,
Expand All @@ -78,7 +76,7 @@ public function getJsLayout()
/**
* {@inheritdoc}
*/
protected function _toHtml()
protected function _toHtml(): string
{
return $this->config->isCookieDisclosureEnabled() ? parent::_toHtml() : '';
}
Expand All @@ -87,17 +85,20 @@ protected function _toHtml()
* Retrieve the cookie disclosure information html
*
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
private function getCookieDisclosureInformation(): string
{
if (!$this->hasData('cookie_disclosure_information')) {
$block = $this->getLayout()->createBlock(
Block::class,
'opengento.gdpr.cookie.disclosure.information',
['data' => ['block_id' => $this->config->getCookieDisclosureInformationBlockId()]]
);
$this->setData('cookie_disclosure_information', $block->toHtml());
try {
$block = $this->getLayout()->createBlock(
Block::class,
'opengento.gdpr.cookie.disclosure.information',
['data' => ['block_id' => $this->config->getCookieDisclosureInformationBlockId()]]
);
$this->setData('cookie_disclosure_information', $block->toHtml());
} catch (LocalizedException $e) {
$this->setData('cookie_disclosure_information', '');
}
}

return (string) $this->_getData('cookie_disclosure_information');
Expand Down
8 changes: 4 additions & 4 deletions Console/Command/EraseCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/
declare(strict_types=1);
Expand All @@ -25,7 +25,7 @@ final class EraseCommand extends Command
/**#@+
* Input Variables Names
*/
const INPUT_ARGUMENT_CUSTOMER = 'customer';
private const INPUT_ARGUMENT_CUSTOMER = 'customer';
/**#@-*/

/**
Expand Down Expand Up @@ -64,7 +64,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -81,7 +81,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->appState->setAreaCode(Area::AREA_GLOBAL);
$oldValue = $this->registry->registry('isSecureArea');
Expand Down
10 changes: 5 additions & 5 deletions Console/Command/ExportCommand.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/
declare(strict_types=1);
Expand All @@ -27,8 +27,8 @@ final class ExportCommand extends Command
/**#@+
* Input Variables Names
*/
const INPUT_ARGUMENT_CUSTOMER = 'customer';
const INPUT_OPTION_FILENAME = 'filename';
private const INPUT_ARGUMENT_CUSTOMER = 'customer';
private const INPUT_OPTION_FILENAME = 'filename';
/**#@-*/

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
{
parent::configure();

Expand All @@ -91,7 +91,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->appState->setAreaCode(Area::AREA_GLOBAL);

Expand Down
6 changes: 3 additions & 3 deletions Controller/AbstractPrivacy.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/
declare(strict_types=1);

namespace Opengento\Gdpr\Controller;

use Magento\Customer\Controller\AbstractAccount;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\ResultInterface;

/**
* Controller AbstractPrivacy
*/
abstract class AbstractPrivacy extends AbstractAccount implements ActionInterface
abstract class AbstractPrivacy extends AbstractAccount
{
/**
* Create a result forward to 404
Expand All @@ -26,6 +25,7 @@ public function forwardNoRoute(): ResultInterface
{
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
$resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);

return $resultForward->forward('no_route');
}
}
9 changes: 5 additions & 4 deletions Controller/Privacy/Delete.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 OpenGento, All rights reserved.
* Copyright © OpenGento, All rights reserved.
* See LICENSE bundled with this library for license details.
*/
declare(strict_types=1);
Expand All @@ -9,7 +9,6 @@

use Magento\Customer\Model\Session;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Phrase;
use Opengento\Gdpr\Api\EraseCustomerManagementInterface;
Expand All @@ -18,7 +17,7 @@
/**
* Action Index Delete
*/
class Delete extends AbstractPrivacy implements ActionInterface
class Delete extends AbstractPrivacy
{
/**
* @var \Magento\Customer\Model\Session
Expand Down Expand Up @@ -54,7 +53,9 @@ public function execute()
$this->messageManager->addErrorMessage(new Phrase('Your account is already being removed.'));
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
return $resultRedirect->setPath('customer/privacy/settings');
$resultRedirect->setRefererOrBaseUrl();

return $resultRedirect;
}

return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
Expand Down
Loading

0 comments on commit 62234a9

Please sign in to comment.