diff --git a/Model/Command/UploadHistoricalOrders.php b/Model/Command/UploadHistoricalOrders.php index 17ec675..c12aac0 100644 --- a/Model/Command/UploadHistoricalOrders.php +++ b/Model/Command/UploadHistoricalOrders.php @@ -16,6 +16,11 @@ class UploadHistoricalOrders extends Command { const BATCH_SIZE = 10; + /** + * @var \Magento\Framework\App\State + */ + protected $_state; + /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ @@ -72,7 +77,7 @@ public function __construct( \Magento\Framework\Api\SearchCriteria $searchCriteriaBuilder, Helper $helper ) { - $state->setAreaCode('adminhtml'); + $this->_state = $state; $this->_scopeConfig = $scopeConfig; $this->_orderRepository = $orderRepository; @@ -103,6 +108,10 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { + if (!$this->_state->getAreaCode()) { + $this->_state->setAreaCode('adminhtml'); + } + $authToken = $this->_scopeConfig->getValue('riskified/riskified/key', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); $env = constant('\Riskified\Common\Env::' . $this->_scopeConfig->getValue('riskified/riskified/env')); $domain = $this->_scopeConfig->getValue('riskified/riskified/domain'); diff --git a/etc/di.xml b/etc/di.xml index 6fa9a08..8cf43ef 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -26,11 +26,11 @@ - + Riskified\Decider\Model\Command\UploadHistoricalOrders - \ No newline at end of file +