From 864197ee6a0ea259ed38efe04fbc4cab02d1acb4 Mon Sep 17 00:00:00 2001
From: Thomas Klein
Date: Mon, 14 Oct 2019 15:13:23 +0200
Subject: [PATCH] #26 add notifiers to actions list
---
Api/Data/ActionResultInterface.php | 4 +-
Api/ExportEntityManagementInterface.php | 4 +-
Console/Command/ExportCommand.php | 8 +-
Controller/Adminhtml/Guest/Export.php | 9 +-
Controller/Adminhtml/Privacy/Export.php | 8 +-
Controller/Adminhtml/Privacy/MassExport.php | 9 +-
Model/Action/Erase/NotifierActionBundle.php | 59 ++++++
Model/Action/Export/CreateOrExportAction.php | 3 +-
Model/Action/Export/ExportAction.php | 3 +-
Model/Action/Export/NotifierActionBundle.php | 59 ++++++
Model/Action/PerformedBy/FrontUser.php | 38 ----
Model/Action/PerformedBy/NotEmptyStrategy.php | 44 ++++
Model/ActionEntity.php | 12 +-
Model/Entity/EntityCheckerFactory.php | 4 +-
Model/Entity/SourceProviderFactory.php | 4 +-
Model/Erase/NotifierFactory.php | 6 +-
Model/Export/NotifierFactory.php | 6 +-
Model/ExportEntityManagement.php | 4 +-
Service/Export/ProcessorFactory.php | 4 +-
Service/Export/RendererFactory.php | 4 +-
etc/adminhtml/di.xml | 4 -
etc/config.xml | 22 +-
etc/db_schema.xml | 7 +-
etc/di.xml | 199 ++++++++++++------
etc/email_templates.xml | 8 +-
etc/frontend/di.xml | 8 +
.../ui_component/gdpr_action_form.xml | 23 --
.../ui_component/gdpr_action_listing.xml | 23 +-
view/frontend/email/export_pending.html | 25 +++
view/frontend/email/export_pending_guest.html | 25 +++
...xport_succeeded.html => export_ready.html} | 2 +
...ded_guest.html => export_ready_guest.html} | 2 +
32 files changed, 458 insertions(+), 182 deletions(-)
create mode 100644 Model/Action/Erase/NotifierActionBundle.php
create mode 100644 Model/Action/Export/NotifierActionBundle.php
delete mode 100644 Model/Action/PerformedBy/FrontUser.php
create mode 100644 Model/Action/PerformedBy/NotEmptyStrategy.php
create mode 100644 view/frontend/email/export_pending.html
create mode 100644 view/frontend/email/export_pending_guest.html
rename view/frontend/email/{export_succeeded.html => export_ready.html} (90%)
rename view/frontend/email/{export_succeeded_guest.html => export_ready_guest.html} (90%)
diff --git a/Api/Data/ActionResultInterface.php b/Api/Data/ActionResultInterface.php
index be05962..a03f9ed 100644
--- a/Api/Data/ActionResultInterface.php
+++ b/Api/Data/ActionResultInterface.php
@@ -7,9 +7,11 @@
namespace Opengento\Gdpr\Api\Data;
+use DateTime;
+
interface ActionResultInterface
{
- public function getPerformedAt()/*todo : DateTime*/;
+ public function getPerformedAt(): DateTime;
public function getState(): string;
diff --git a/Api/ExportEntityManagementInterface.php b/Api/ExportEntityManagementInterface.php
index 58c14b9..1c0235e 100644
--- a/Api/ExportEntityManagementInterface.php
+++ b/Api/ExportEntityManagementInterface.php
@@ -34,9 +34,9 @@ public function create(int $entityId, string $entityType, ?string $fileName = nu
* Export all data related to a given entity to the file
*
* @param ExportEntityInterface $exportEntity
- * @return string
+ * @return ExportEntityInterface
* @throws CouldNotSaveException
* @throws LocalizedException
*/
- public function export(ExportEntityInterface $exportEntity): string;
+ public function export(ExportEntityInterface $exportEntity): ExportEntityInterface;
}
diff --git a/Console/Command/ExportCommand.php b/Console/Command/ExportCommand.php
index 61a1f9b..98b6b55 100644
--- a/Console/Command/ExportCommand.php
+++ b/Console/Command/ExportCommand.php
@@ -12,6 +12,7 @@
use Magento\Framework\Console\Cli;
use Magento\Framework\Exception\LocalizedException;
use Opengento\Gdpr\Api\ActionInterface;
+use Opengento\Gdpr\Api\Data\ExportEntityInterface;
use Opengento\Gdpr\Model\Action\ArgumentReader;
use Opengento\Gdpr\Model\Action\ContextBuilder;
use Opengento\Gdpr\Model\Action\Export\ArgumentReader as ExportArgumentReader;
@@ -20,7 +21,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-use function reset;
class ExportCommand extends Command
{
@@ -102,8 +102,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
ExportArgumentReader::EXPORT_FILE_NAME => $fileName . '_' . $entityId
]);
$result = $this->action->execute($this->actionContextBuilder->create())->getResult();
+ /** @var ExportEntityInterface $exportEntity */
+ $exportEntity = $result[ExportArgumentReader::EXPORT_ENTITY];
- $output->writeln('Entity\'s related data have been exported to: ' . reset($result) . '.');
+ $output->writeln(
+ 'Entity\'s related data have been exported to: ' . $exportEntity->getFilePath() . '.'
+ );
}
} catch (\Exception $e) {
$output->writeln('' . $e->getMessage() . '');
diff --git a/Controller/Adminhtml/Guest/Export.php b/Controller/Adminhtml/Guest/Export.php
index 3429e80..4dff6d3 100644
--- a/Controller/Adminhtml/Guest/Export.php
+++ b/Controller/Adminhtml/Guest/Export.php
@@ -15,11 +15,12 @@
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;
use Opengento\Gdpr\Api\ActionInterface;
+use Opengento\Gdpr\Api\Data\ExportEntityInterface;
use Opengento\Gdpr\Controller\Adminhtml\AbstractAction;
use Opengento\Gdpr\Model\Action\ArgumentReader;
use Opengento\Gdpr\Model\Action\ContextBuilder;
+use Opengento\Gdpr\Model\Action\Export\ArgumentReader as ExportArgumentReader;
use Opengento\Gdpr\Model\Config;
-use function reset;
class Export extends AbstractAction
{
@@ -63,13 +64,15 @@ protected function executeAction()
]);
try {
- $result = $this->action->execute($this->actionContextBuilder->create());
+ $result = $this->action->execute($this->actionContextBuilder->create())->getResult();
+ /** @var ExportEntityInterface $exportEntity */
+ $exportEntity = $result[ExportArgumentReader::EXPORT_ENTITY];
return $this->fileFactory->create(
'guest_privacy_data_' . $entityId . '.zip',
[
'type' => 'filename',
- 'value' => reset($result),
+ 'value' => $exportEntity->getFilePath(),
'rm' => true,
],
DirectoryList::TMP
diff --git a/Controller/Adminhtml/Privacy/Export.php b/Controller/Adminhtml/Privacy/Export.php
index fc9e487..bac2ba0 100644
--- a/Controller/Adminhtml/Privacy/Export.php
+++ b/Controller/Adminhtml/Privacy/Export.php
@@ -15,9 +15,11 @@
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;
use Opengento\Gdpr\Api\ActionInterface;
+use Opengento\Gdpr\Api\Data\ExportEntityInterface;
use Opengento\Gdpr\Controller\Adminhtml\AbstractAction;
use Opengento\Gdpr\Model\Action\ArgumentReader;
use Opengento\Gdpr\Model\Action\ContextBuilder;
+use Opengento\Gdpr\Model\Action\Export\ArgumentReader as ExportArgumentReader;
use Opengento\Gdpr\Model\Config;
class Export extends AbstractAction
@@ -62,13 +64,15 @@ protected function executeAction()
]);
try {
- $result = $this->action->execute($this->actionContextBuilder->create());
+ $result = $this->action->execute($this->actionContextBuilder->create())->getResult();
+ /** @var ExportEntityInterface $exportEntity */
+ $exportEntity = $result[ExportArgumentReader::EXPORT_ENTITY];
return $this->fileFactory->create(
'customer_privacy_data_' . $customerId . '.zip',
[
'type' => 'filename',
- 'value' => reset($result),
+ 'value' => $exportEntity->getFilePath(),
'rm' => true,
],
DirectoryList::TMP
diff --git a/Controller/Adminhtml/Privacy/MassExport.php b/Controller/Adminhtml/Privacy/MassExport.php
index 1759516..08114b1 100644
--- a/Controller/Adminhtml/Privacy/MassExport.php
+++ b/Controller/Adminhtml/Privacy/MassExport.php
@@ -19,10 +19,11 @@
use Magento\Framework\Phrase;
use Magento\Ui\Component\MassAction\Filter;
use Opengento\Gdpr\Api\ActionInterface;
+use Opengento\Gdpr\Api\Data\ExportEntityInterface;
use Opengento\Gdpr\Model\Action\ArgumentReader;
use Opengento\Gdpr\Model\Action\ContextBuilder;
+use Opengento\Gdpr\Model\Action\Export\ArgumentReader as ExportArgumentReader;
use Opengento\Gdpr\Model\Archive\MoveToArchive;
-use function reset;
class MassExport extends AbstractMassAction
{
@@ -74,8 +75,10 @@ protected function massAction(AbstractCollection $collection)
ArgumentReader::ENTITY_ID => (int) $customerId,
ArgumentReader::ENTITY_TYPE => 'customer'
]);
- $result = $this->action->execute($this->actionContextBuilder->create());
- $this->moveToArchive->prepareArchive(reset($result), $archiveFileName);
+ $result = $this->action->execute($this->actionContextBuilder->create())->getResult();
+ /** @var ExportEntityInterface $exportEntity */
+ $exportEntity = $result[ExportArgumentReader::EXPORT_ENTITY];
+ $this->moveToArchive->prepareArchive($exportEntity->getFilePath(), $archiveFileName);
}
return $this->fileFactory->create(
diff --git a/Model/Action/Erase/NotifierActionBundle.php b/Model/Action/Erase/NotifierActionBundle.php
new file mode 100644
index 0000000..9f3a09d
--- /dev/null
+++ b/Model/Action/Erase/NotifierActionBundle.php
@@ -0,0 +1,59 @@
+notifiers = $notifiers;
+ $this->objectManager = $objectManager;
+ parent::__construct($resultBuilder);
+ }
+
+ public function execute(ActionContextInterface $actionContext): ActionResultInterface
+ {
+ $this->resolveNotifier($actionContext)->notify(ArgumentReader::getEntity($actionContext));
+
+ return $this->createActionResult(['is_notify' => true]);
+ }
+
+ private function resolveNotifier(ActionContextInterface $actionContext): NotifierInterface
+ {
+ $entityType = ActionArgumentReader::getEntityType($actionContext);
+
+ if (!isset($this->notifiers[$entityType])) {
+ throw new InvalidArgumentException(sprintf('Unknown notifier for entity type "%s".', $entityType));
+ }
+
+ return $this->objectManager->get($this->notifiers[$entityType]);
+ }
+}
diff --git a/Model/Action/Export/CreateOrExportAction.php b/Model/Action/Export/CreateOrExportAction.php
index bf9aeb1..7fc3156 100644
--- a/Model/Action/Export/CreateOrExportAction.php
+++ b/Model/Action/Export/CreateOrExportAction.php
@@ -12,6 +12,7 @@
use Opengento\Gdpr\Api\Data\ActionResultInterface;
use Opengento\Gdpr\Model\Action\AbstractAction;
use Opengento\Gdpr\Model\Action\ArgumentReader;
+use Opengento\Gdpr\Model\Action\Export\ArgumentReader as ExportArgumentReader;
use Opengento\Gdpr\Model\Action\ResultBuilder;
use Opengento\Gdpr\Model\Export\ExportEntityData;
@@ -40,7 +41,7 @@ public function execute(ActionContextInterface $actionContext): ActionResultInte
}
return $this->createActionResult(
- ['export_file_path' => $this->exportEntityData->export($entityId, $entityType)]
+ [ExportArgumentReader::EXPORT_ENTITY => $this->exportEntityData->export($entityId, $entityType)]
);
}
}
diff --git a/Model/Action/Export/ExportAction.php b/Model/Action/Export/ExportAction.php
index 92bd013..3a57021 100644
--- a/Model/Action/Export/ExportAction.php
+++ b/Model/Action/Export/ExportAction.php
@@ -12,6 +12,7 @@
use Opengento\Gdpr\Api\Data\ActionResultInterface;
use Opengento\Gdpr\Api\ExportEntityManagementInterface;
use Opengento\Gdpr\Model\Action\AbstractAction;
+use Opengento\Gdpr\Model\Action\Export\ArgumentReader as ExportArgumentReader;
use Opengento\Gdpr\Model\Action\ResultBuilder;
final class ExportAction extends AbstractAction
@@ -38,7 +39,7 @@ public function execute(ActionContextInterface $actionContext): ActionResultInte
}
return $this->createActionResult(
- ['export_file_path' => $this->exportEntityManagement->export($exportEntity)]
+ [ExportArgumentReader::EXPORT_ENTITY => $this->exportEntityManagement->export($exportEntity)]
);
}
}
diff --git a/Model/Action/Export/NotifierActionBundle.php b/Model/Action/Export/NotifierActionBundle.php
new file mode 100644
index 0000000..bec5e34
--- /dev/null
+++ b/Model/Action/Export/NotifierActionBundle.php
@@ -0,0 +1,59 @@
+notifiers = $notifiers;
+ $this->objectManager = $objectManager;
+ parent::__construct($resultBuilder);
+ }
+
+ public function execute(ActionContextInterface $actionContext): ActionResultInterface
+ {
+ $this->resolveNotifier($actionContext)->notify(ArgumentReader::getEntity($actionContext));
+
+ return $this->createActionResult(['is_notify' => true]);
+ }
+
+ private function resolveNotifier(ActionContextInterface $actionContext): NotifierInterface
+ {
+ $entityType = ActionArgumentReader::getEntityType($actionContext);
+
+ if (!isset($this->notifiers[$entityType])) {
+ throw new InvalidArgumentException(sprintf('Unknown notifier for entity type "%s".', $entityType));
+ }
+
+ return $this->objectManager->get($this->notifiers[$entityType]);
+ }
+}
diff --git a/Model/Action/PerformedBy/FrontUser.php b/Model/Action/PerformedBy/FrontUser.php
deleted file mode 100644
index 1245e49..0000000
--- a/Model/Action/PerformedBy/FrontUser.php
+++ /dev/null
@@ -1,38 +0,0 @@
-performedByCustomer = $performedByCustomer;
- $this->performedByGuest = $performedByGuest;
- }
-
- public function get(): string
- {
- return $this->performedByCustomer->get() ?: $this->performedByGuest->get() ?: self::PERFORMED_BY;
- }
-}
diff --git a/Model/Action/PerformedBy/NotEmptyStrategy.php b/Model/Action/PerformedBy/NotEmptyStrategy.php
new file mode 100644
index 0000000..61246ff
--- /dev/null
+++ b/Model/Action/PerformedBy/NotEmptyStrategy.php
@@ -0,0 +1,44 @@
+performedByList = (static function (PerformedByInterface ...$performedByList) {
+ return $performedByList;
+ })(...$performedByList);
+ }
+
+ public function get(): string
+ {
+ foreach ($this->performedByList as $performedBy) {
+ $performer = $performedBy->get();
+
+ if (!empty($performer)) {
+ return $performer;
+ }
+ }
+
+ return self::PERFORMED_BY;
+ }
+}
diff --git a/Model/ActionEntity.php b/Model/ActionEntity.php
index 58cbcff..b3bf37f 100644
--- a/Model/ActionEntity.php
+++ b/Model/ActionEntity.php
@@ -7,9 +7,12 @@
namespace Opengento\Gdpr\Model;
+use DateTime;
+use Exception;
use Magento\Framework\Model\AbstractExtensibleModel;
use Opengento\Gdpr\Api\Data\ActionEntityInterface;
use Opengento\Gdpr\Model\ResourceModel\ActionEntity as ActionEntityResource;
+use function is_string;
class ActionEntity extends AbstractExtensibleModel implements ActionEntityInterface
{
@@ -60,9 +63,14 @@ public function setPerformedBy(?string $performedBy): ActionEntityInterface
return $this->setData(self::PERFORMED_BY, $performedBy);
}
- public function getPerformedAt(): string
+ /**
+ * @throws Exception
+ */
+ public function getPerformedAt(): DateTime
{
- return (string) $this->_getData(self::PERFORMED_AT);
+ return is_string($this->_getData(self::PERFORMED_AT))
+ ? new DateTime($this->_getData(self::PERFORMED_AT))
+ : $this->_getData(self::PERFORMED_AT);
}
public function setPerformedAt(string $performedAt): ActionEntityInterface
diff --git a/Model/Entity/EntityCheckerFactory.php b/Model/Entity/EntityCheckerFactory.php
index 303ae09..4a889c9 100644
--- a/Model/Entity/EntityCheckerFactory.php
+++ b/Model/Entity/EntityCheckerFactory.php
@@ -7,7 +7,9 @@
namespace Opengento\Gdpr\Model\Entity;
+use InvalidArgumentException;
use Magento\Framework\ObjectManagerInterface;
+use function sprintf;
/**
* @api
@@ -39,7 +41,7 @@ public function __construct(
public function get(string $entityType): EntityCheckerInterface
{
if (!isset($this->checkers[$entityType])) {
- throw new \InvalidArgumentException(\sprintf('Unknown checker for entity type "%s".', $entityType));
+ throw new InvalidArgumentException(sprintf('Unknown checker for entity type "%s".', $entityType));
}
return $this->objectManager->get($this->checkers[$entityType]);
diff --git a/Model/Entity/SourceProviderFactory.php b/Model/Entity/SourceProviderFactory.php
index bd48af7..b81eec6 100644
--- a/Model/Entity/SourceProviderFactory.php
+++ b/Model/Entity/SourceProviderFactory.php
@@ -7,8 +7,10 @@
namespace Opengento\Gdpr\Model\Entity;
+use InvalidArgumentException;
use Magento\Framework\Data\Collection;
use Magento\Framework\ObjectManagerInterface;
+use function sprintf;
/**
* @api
@@ -40,7 +42,7 @@ public function __construct(
public function create(string $entityType): Collection
{
if (!isset($this->sourceProviders[$entityType])) {
- throw new \InvalidArgumentException(\sprintf('Unknown source provider for entity type "%s".', $entityType));
+ throw new InvalidArgumentException(sprintf('Unknown source provider for entity type "%s".', $entityType));
}
return $this->objectManager->create($this->sourceProviders[$entityType]);
diff --git a/Model/Erase/NotifierFactory.php b/Model/Erase/NotifierFactory.php
index 69d9b13..d84afe4 100644
--- a/Model/Erase/NotifierFactory.php
+++ b/Model/Erase/NotifierFactory.php
@@ -7,7 +7,9 @@
namespace Opengento\Gdpr\Model\Erase;
+use InvalidArgumentException;
use Magento\Framework\ObjectManagerInterface;
+use function sprintf;
/**
* @api
@@ -39,8 +41,8 @@ public function __construct(
public function get(string $action, string $entityType): NotifierInterface
{
if (!isset($this->notifiers[$action][$entityType])) {
- throw new \InvalidArgumentException(
- \sprintf('Unknown notifier for action "%s" and entity type "%s".', $action, $entityType)
+ throw new InvalidArgumentException(
+ sprintf('Unknown notifier for action "%s" and entity type "%s".', $action, $entityType)
);
}
diff --git a/Model/Export/NotifierFactory.php b/Model/Export/NotifierFactory.php
index c920302..1a559c5 100644
--- a/Model/Export/NotifierFactory.php
+++ b/Model/Export/NotifierFactory.php
@@ -7,7 +7,9 @@
namespace Opengento\Gdpr\Model\Export;
+use InvalidArgumentException;
use Magento\Framework\ObjectManagerInterface;
+use function sprintf;
/**
* @api
@@ -39,8 +41,8 @@ public function __construct(
public function get(string $action, string $entityType): NotifierInterface
{
if (!isset($this->notifiers[$action][$entityType])) {
- throw new \InvalidArgumentException(
- \sprintf('Unknown notifier for action "%s" and entity type "%s".', $action, $entityType)
+ throw new InvalidArgumentException(
+ sprintf('Unknown notifier for action "%s" and entity type "%s".', $action, $entityType)
);
}
diff --git a/Model/ExportEntityManagement.php b/Model/ExportEntityManagement.php
index 3960f5b..53cedb3 100644
--- a/Model/ExportEntityManagement.php
+++ b/Model/ExportEntityManagement.php
@@ -84,7 +84,7 @@ public function create(int $entityId, string $entityType, ?string $fileName = nu
* @inheritdoc
* @throws Exception
*/
- public function export(ExportEntityInterface $exportEntity): string
+ public function export(ExportEntityInterface $exportEntity): ExportEntityInterface
{
$exportEntity->setFilePath($this->exportToFile->export($exportEntity));
$exportEntity->setExpiredAt(
@@ -93,6 +93,6 @@ public function export(ExportEntityInterface $exportEntity): string
$exportEntity->setExportedAt((new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT));
$this->exportEntityRepository->save($exportEntity);
- return $exportEntity->getFilePath();
+ return $exportEntity;
}
}
diff --git a/Service/Export/ProcessorFactory.php b/Service/Export/ProcessorFactory.php
index 95b108b..845d2aa 100644
--- a/Service/Export/ProcessorFactory.php
+++ b/Service/Export/ProcessorFactory.php
@@ -7,7 +7,9 @@
namespace Opengento\Gdpr\Service\Export;
+use InvalidArgumentException;
use Magento\Framework\ObjectManagerInterface;
+use function sprintf;
/**
* @api
@@ -39,7 +41,7 @@ public function __construct(
public function get(string $entityType): ProcessorInterface
{
if (!isset($this->exporters[$entityType])) {
- throw new \InvalidArgumentException(\sprintf('Unknown exporter for entity type "%s".', $entityType));
+ throw new InvalidArgumentException(sprintf('Unknown exporter for entity type "%s".', $entityType));
}
return $this->objectManager->get($this->exporters[$entityType]);
diff --git a/Service/Export/RendererFactory.php b/Service/Export/RendererFactory.php
index 2bdfcac..3e31a18 100644
--- a/Service/Export/RendererFactory.php
+++ b/Service/Export/RendererFactory.php
@@ -7,7 +7,9 @@
namespace Opengento\Gdpr\Service\Export;
+use InvalidArgumentException;
use Magento\Framework\ObjectManagerInterface;
+use function sprintf;
/**
* @api
@@ -39,7 +41,7 @@ public function __construct(
public function get(string $rendererCode): RendererInterface
{
if (!isset($this->renderers[$rendererCode])) {
- throw new \InvalidArgumentException(\sprintf('Unknown renderer type "%s".', $rendererCode));
+ throw new InvalidArgumentException(sprintf('Unknown renderer type "%s".', $rendererCode));
}
return $this->objectManager->get($this->renderers[$rendererCode]);
diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml
index 3ca8aa8..17960a8 100644
--- a/etc/adminhtml/di.xml
+++ b/etc/adminhtml/di.xml
@@ -10,10 +10,6 @@
-
- Opengento\Gdpr\Api\Data\ActionEntityInterface::SCHEDULED_AT
- Opengento\Gdpr\Api\Data\ActionEntityInterface::PARAMETERS
- Opengento\Gdpr\Api\Data\ActionEntityInterface::MESSAGE
diff --git a/etc/config.xml b/etc/config.xml
index 51eb07d..0b262c6 100755
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -209,20 +209,34 @@
-
+ 0
- gdpr_email_export_succeeded_template
+ gdpr_email_export_pending_template
generalbcc0
- gdpr_email_export_succeeded_guest_template
+ gdpr_email_export_pending_guest_template
generalbcc
-
+
+
+
+ 0
+ gdpr_email_export_ready_template
+ general
+ bcc
+
+
+ 0
+ gdpr_email_export_ready_guest_template
+ general
+ bcc
+
+
diff --git a/etc/db_schema.xml b/etc/db_schema.xml
index 2645851..0b297ff 100644
--- a/etc/db_schema.xml
+++ b/etc/db_schema.xml
@@ -56,8 +56,11 @@
-
-
+
+
+
+
+
diff --git a/etc/di.xml b/etc/di.xml
index bebe892..15a21cb 100644
--- a/etc/di.xml
+++ b/etc/di.xml
@@ -50,65 +50,109 @@
Magento\Framework\EntityManager\AbstractModelHydratorMagento\Framework\EntityManager\AbstractModelHydratorMagento\Framework\EntityManager\AbstractModelHydrator
+ Magento\Framework\EntityManager\AbstractModelHydrator
+
+ Magento\Framework\EntityManager\AbstractModelHydrator
+ Magento\Framework\EntityManager\AbstractModelHydrator
+ Magento\Framework\EntityManager\AbstractModelHydrator
+ Magento\Framework\EntityManager\AbstractModelHydrator
+
+
+
+
+ Opengento\Gdpr\Model\Customer\Erase\Notifier\Pending
+ Opengento\Gdpr\Model\Order\Erase\Notifier\Pending
+
+
+
+
+
+
+ Opengento\Gdpr\Model\Customer\Erase\Notifier\Succeeded
+ Opengento\Gdpr\Model\Order\Erase\Notifier\Succeeded
+
+
+
+
+
+
+ Opengento\Gdpr\Model\Customer\Erase\Notifier\Canceled
+ Opengento\Gdpr\Model\Order\Erase\Notifier\Canceled
+
+
+
+
+
+
+
+ Opengento\Gdpr\Model\Customer\Export\Notifier\Pending
+ Opengento\Gdpr\Model\Order\Export\Notifier\Pending
+
+
+
+
+
+
+ Opengento\Gdpr\Model\Customer\Export\Notifier\Ready
+ Opengento\Gdpr\Model\Order\Export\Notifier\Ready
+
+
+
-
erase_createOpengento\Gdpr\Model\Action\Erase\CreateAction
-
+ Opengento\Gdpr\Model\Action\Erase\CreateNotifier
-
erase_executeOpengento\Gdpr\Model\Action\Erase\ExecuteAction
-
+ Opengento\Gdpr\Model\Action\Erase\ExecuteNotifier
-
erase_cancelOpengento\Gdpr\Model\Action\Erase\CancelAction
-
+ Opengento\Gdpr\Model\Action\Erase\CancelNotifier
+ erase_create_executeOpengento\Gdpr\Model\Action\Erase\CreateActionOpengento\Gdpr\Model\Action\Erase\ExecuteAction
-
export_createOpengento\Gdpr\Model\Action\Export\CreateAction
-
+ Opengento\Gdpr\Model\Action\Export\CreateNotifier
-
export_executeOpengento\Gdpr\Model\Action\Export\ExportAction
-
+ Opengento\Gdpr\Model\Action\Export\ExportNotifier
@@ -117,7 +161,7 @@
export_create_or_executeOpengento\Gdpr\Model\Action\Export\CreateOrExportAction
-
+ Opengento\Gdpr\Model\Action\Export\ExportNotifier
@@ -178,17 +222,6 @@
-
-
-
- Magento\Framework\EntityManager\AbstractModelHydrator
- Magento\Framework\EntityManager\AbstractModelHydrator
- Magento\Framework\EntityManager\AbstractModelHydrator
- Magento\Framework\EntityManager\AbstractModelHydrator
- Magento\Framework\EntityManager\AbstractModelHydrator
-
-
-
@@ -1517,30 +1550,15 @@
Opengento\Gdpr\Model\Archive\MoveToZip
-
-
-
-
-
- Opengento\Gdpr\Model\Customer\Erase\Notifier\Pending
- Opengento\Gdpr\Model\Order\Erase\Notifier\Pending
-
-
- Opengento\Gdpr\Model\Customer\Erase\Notifier\Succeeded
- Opengento\Gdpr\Model\Order\Erase\Notifier\Succeeded
-
-
- Opengento\Gdpr\Model\Customer\Erase\Notifier\Canceled
- Opengento\Gdpr\Model\Order\Erase\Notifier\Canceled
-
-
-
-
-
+ gdpr/notification/erasure/pending/customer/enabled
+ gdpr/notification/erasure/pending/customer/identity
+ gdpr/notification/erasure/pending/customer/copy_to
+ gdpr/notification/erasure/pending/customer/copy_method
+ gdpr/notification/erasure/pending/customer/template
@@ -1554,7 +1572,11 @@
-
+ gdpr/notification/erasure/succeeded/customer/enabled
+ gdpr/notification/erasure/succeeded/customer/identity
+ gdpr/notification/erasure/succeeded/customer/copy_to
+ gdpr/notification/erasure/succeeded/customer/copy_method
+ gdpr/notification/erasure/succeeded/customer/template
@@ -1568,7 +1590,11 @@
-
+ gdpr/notification/erasure/canceled/customer/enabled
+ gdpr/notification/erasure/canceled/customer/identity
+ gdpr/notification/erasure/canceled/customer/copy_to
+ gdpr/notification/erasure/canceled/customer/copy_method
+ gdpr/notification/erasure/canceled/customer/template
@@ -1583,7 +1609,11 @@
-
+ gdpr/notification/erasure/pending/order/enabled
+ gdpr/notification/erasure/pending/order/identity
+ gdpr/notification/erasure/pending/order/copy_to
+ gdpr/notification/erasure/pending/order/copy_method
+ gdpr/notification/erasure/pending/order/template
@@ -1597,7 +1627,11 @@
-
+ gdpr/notification/erasure/succeeded/order/enabled
+ gdpr/notification/erasure/succeeded/order/identity
+ gdpr/notification/erasure/succeeded/order/copy_to
+ gdpr/notification/erasure/succeeded/order/copy_method
+ gdpr/notification/erasure/succeeded/order/template
@@ -1611,7 +1645,11 @@
-
+ gdpr/notification/erasure/canceled/order/enabled
+ gdpr/notification/erasure/canceled/order/identity
+ gdpr/notification/erasure/canceled/order/copy_to
+ gdpr/notification/erasure/canceled/order/copy_method
+ gdpr/notification/erasure/canceled/order/template
@@ -1622,44 +1660,77 @@
-
-
+
+
-
-
- Opengento\Gdpr\Model\Customer\Export\Notifier\Succeeded
- Opengento\Gdpr\Model\Order\Export\Notifier\Succeeded
-
+
+ gdpr/notification/export/pending/customer/enabled
+ gdpr/notification/export/pending/customer/identity
+ gdpr/notification/export/pending/customer/copy_to
+ gdpr/notification/export/pending/customer/copy_method
+ gdpr/notification/export/pending/customer/template
-
-
-
+
+
+
+
+ Opengento\Gdpr\Model\Customer\Export\Notifier\Pending\MailSender
+
+
+
+
-
+ gdpr/notification/export/ready/customer/enabled
+ gdpr/notification/export/ready/customer/identity
+ gdpr/notification/export/ready/customer/copy_to
+ gdpr/notification/export/ready/customer/copy_method
+ gdpr/notification/export/ready/customer/template
-
+
- Opengento\Gdpr\Model\Customer\Export\Notifier\Succeeded\MailSender
+ Opengento\Gdpr\Model\Customer\Export\Notifier\Ready\MailSender
-
+
+
+
+ gdpr/notification/export/pending/order/enabled
+ gdpr/notification/export/pending/order/identity
+ gdpr/notification/export/pending/order/copy_to
+ gdpr/notification/export/pending/order/copy_method
+ gdpr/notification/export/pending/order/template
+
+
+
+
+
+
+ Opengento\Gdpr\Model\Order\Export\Notifier\Pending\MailSender
+
+
+
+
-
+ gdpr/notification/export/ready/order/enabled
+ gdpr/notification/export/ready/order/identity
+ gdpr/notification/export/ready/order/copy_to
+ gdpr/notification/export/ready/order/copy_method
+ gdpr/notification/export/ready/order/template
-
+
- Opengento\Gdpr\Model\Order\Export\Notifier\Succeeded\MailSender
+ Opengento\Gdpr\Model\Order\Export\Notifier\Ready\MailSender
diff --git a/etc/email_templates.xml b/etc/email_templates.xml
index c960af2..1c69ef5 100644
--- a/etc/email_templates.xml
+++ b/etc/email_templates.xml
@@ -5,13 +5,15 @@
* See LICENSE bundled with this library for license details.
*/
-->
-
+
-
-
+
+
+
+
diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml
index 3084b54..f5d6e26 100644
--- a/etc/frontend/di.xml
+++ b/etc/frontend/di.xml
@@ -6,6 +6,14 @@
*/
-->
+
+
+
+ Opengento\Gdpr\Model\Action\PerformedBy\Guest
+ Opengento\Gdpr\Model\Action\PerformedBy\Customer
+
+
+
diff --git a/view/adminhtml/ui_component/gdpr_action_form.xml b/view/adminhtml/ui_component/gdpr_action_form.xml
index 9d6d3aa..be1d699 100644
--- a/view/adminhtml/ui_component/gdpr_action_form.xml
+++ b/view/adminhtml/ui_component/gdpr_action_form.xml
@@ -68,29 +68,6 @@
-
-
-
- true
-
- text
-
- Schedule the action in the time.
- scheduled_at
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/view/adminhtml/ui_component/gdpr_action_listing.xml b/view/adminhtml/ui_component/gdpr_action_listing.xml
index 1f5a394..8fae4fb 100644
--- a/view/adminhtml/ui_component/gdpr_action_listing.xml
+++ b/view/adminhtml/ui_component/gdpr_action_listing.xml
@@ -103,32 +103,21 @@
true
-
-
- dateRange
-
- date
-
- date
-
- true
-
-
-
+ texttrue
-
+ texttrue
-
+ dateRangedate
@@ -136,7 +125,7 @@
true
-
+ select
@@ -144,7 +133,7 @@
-
+ text
@@ -154,7 +143,7 @@
true
-
+ text
diff --git a/view/frontend/email/export_pending.html b/view/frontend/email/export_pending.html
new file mode 100644
index 0000000..ecebd4b
--- /dev/null
+++ b/view/frontend/email/export_pending.html
@@ -0,0 +1,25 @@
+
+
+
+
+{{template config_path="design/email/header_template"}}
+
+
{{trans "%name," name=$customer.name}}
+
+
+ {{trans "We have received a request to export the information associated with your account at %store_name." store_name=$store.getFrontendName()}}
+ {{trans 'If you have not authorized this action, please contact us immediately at %store_email' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at %store_phone' store_phone=$store_phone |raw}}{{/depend}}.
+
+
+
{{trans "We will notify you when the export will be ready. The action will be available in your account."}}
+ {{trans "We have received a request to export the information associated with your account at %store_name." store_name=$store.getFrontendName()}}
+ {{trans 'If you have not authorized this action, please contact us immediately at %store_email' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at %store_phone' store_phone=$store_phone |raw}}{{/depend}}.
+
+
+
{{trans "We will notify you when the export will be ready. The action will be available in your account."}}
+
+{{template config_path="design/email/footer_template"}}
diff --git a/view/frontend/email/export_succeeded.html b/view/frontend/email/export_ready.html
similarity index 90%
rename from view/frontend/email/export_succeeded.html
rename to view/frontend/email/export_ready.html
index 48ac1e5..fe1f0be 100644
--- a/view/frontend/email/export_succeeded.html
+++ b/view/frontend/email/export_ready.html
@@ -18,6 +18,8 @@
{{trans 'If you have not authorized this action, please contact us immediately at %store_email' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at %store_phone' store_phone=$store_phone |raw}}{{/depend}}.
+
{{trans "The export of you personal data is ready. The action is now available in your account."}}
{{template config_path="design/email/footer_template"}}
diff --git a/view/frontend/email/export_succeeded_guest.html b/view/frontend/email/export_ready_guest.html
similarity index 90%
rename from view/frontend/email/export_succeeded_guest.html
rename to view/frontend/email/export_ready_guest.html
index 351aa22..7269a28 100644
--- a/view/frontend/email/export_succeeded_guest.html
+++ b/view/frontend/email/export_ready_guest.html
@@ -18,6 +18,8 @@
{{trans 'If you have not authorized this action, please contact us immediately at %store_email' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at %store_phone' store_phone=$store_phone |raw}}{{/depend}}.
+
{{trans "The export of you personal data is ready. The action is now available in your account."}}