currencyFactory = $currencyFactory; } /** * Check base currency is available in installed currencies * * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ public function afterSave() { $value = $this->getValue(); if (!in_array($value, $this->_getInstalledCurrencies())) { throw new \Magento\Framework\Exception\LocalizedException( __('Sorry, we haven\'t installed the base currency you selected.') ); } $this->currencyFactory->create()->saveRates([$value =>[$value => 1]]); return parent::afterSave(); } }