MultishippingErrorMessageSupport.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * @copyright Vertex. All rights reserved. https://www.vertexinc.com/
  4. * @author Mediotype https://www.mediotype.com/
  5. */
  6. namespace Vertex\Tax\Model\Plugin;
  7. use Magento\Framework\App\ActionInterface;
  8. use Vertex\Tax\Model\Config;
  9. use Vertex\Tax\Model\ErrorMessageDisplayState;
  10. /**
  11. * Turn on error messages during Multishipping
  12. */
  13. class MultishippingErrorMessageSupport
  14. {
  15. /** @var Config */
  16. private $config;
  17. /** @var ErrorMessageDisplayState */
  18. private $messageDisplayState;
  19. /**
  20. * @param ErrorMessageDisplayState $messageDisplayState
  21. * @param Config $config
  22. */
  23. public function __construct(
  24. ErrorMessageDisplayState $messageDisplayState,
  25. Config $config
  26. ) {
  27. $this->messageDisplayState = $messageDisplayState;
  28. $this->config = $config;
  29. }
  30. /**
  31. * Turn on error messages
  32. *
  33. * @param ActionInterface $subject
  34. * @return void
  35. * @SuppressWarnings(PHPMD.UnusedFormalParameter) $subject required for interceptor
  36. */
  37. public function beforeExecute(ActionInterface $subject)
  38. {
  39. if ($this->config->isVertexActive()) {
  40. $this->messageDisplayState->enable();
  41. }
  42. }
  43. }