26 $backendSession = $this->_objectManager->get(\
Magento\Backend\Model\Session::class);
31 throw new LocalizedException(
__(
'The Import Service is incorrect. Verify the service and try again.'));
35 $importModel = $this->_objectManager->get(\
Magento\Directory\Model\
Currency\Import\Factory::class)
37 }
catch (\Exception $e) {
39 __(
"The import model can't be initialized. Verify the model and try again.")
42 $rates = $importModel->fetchRates();
43 $errors = $importModel->getMessages();
46 $this->messageManager->addWarning($error);
48 $this->messageManager->addWarning(
49 __(
'Click "Save" to apply the rates we found.')
52 $this->messageManager->addSuccess(
__(
'Click "Save" to apply the rates we found.'));
55 $backendSession->setRates(
$rates);
56 }
catch (\Exception $e) {
57 $this->messageManager->addError($e->getMessage());
61 $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
62 return $resultRedirect->setPath(
'adminhtml/*/');