* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\Currency\CommandHandler; use Currency; use PrestaShop\PrestaShop\Core\Domain\Currency\Command\RefreshExchangeRatesCommand; use PrestaShop\PrestaShop\Core\Domain\Currency\CommandHandler\RefreshExchangeRatesHandlerInterface; use PrestaShop\PrestaShop\Core\Domain\Currency\Exception\CannotRefreshExchangeRatesException; use PrestaShop\PrestaShop\Core\Domain\Currency\Exception\CurrencyException; /** * Class RefreshExchangeRatesHandler is responsible for refreshing currency exchange rates. * * @internal */ final class RefreshExchangeRatesHandler implements RefreshExchangeRatesHandlerInterface { /** * {@inheritdoc} * * @throws CurrencyException */ public function handle(RefreshExchangeRatesCommand $command) { $error = Currency::refreshCurrencies(); if ($error) { throw new CannotRefreshExchangeRatesException($error); } } }