parent
a3b90582ad
commit
d2a16d9789
|
@ -23,14 +23,18 @@ class Fcc
|
||||||
private $httpClient;
|
private $httpClient;
|
||||||
/** @var \Magento\Framework\Json\Helper\Data */
|
/** @var \Magento\Framework\Json\Helper\Data */
|
||||||
private $jsonHelper;
|
private $jsonHelper;
|
||||||
|
/** @var \Psr\Log\LoggerInterface */
|
||||||
|
private $logger;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
\Psr\Log\LoggerInterface $logger,
|
||||||
\Magento\Framework\HTTP\ZendClient $httpClient,
|
\Magento\Framework\HTTP\ZendClient $httpClient,
|
||||||
\Magento\Directory\Model\CurrencyFactory $currencyFactory,
|
\Magento\Directory\Model\CurrencyFactory $currencyFactory,
|
||||||
\Magento\Framework\Json\Helper\Data $jsonHelper,
|
\Magento\Framework\Json\Helper\Data $jsonHelper,
|
||||||
\Flancer32\FreeRates\Helper\Config $hlpCfg
|
\Flancer32\FreeRates\Helper\Config $hlpCfg
|
||||||
) {
|
) {
|
||||||
parent::__construct($currencyFactory);
|
parent::__construct($currencyFactory);
|
||||||
|
$this->logger = $logger;
|
||||||
$this->httpClient = $httpClient;
|
$this->httpClient = $httpClient;
|
||||||
$this->jsonHelper = $jsonHelper;
|
$this->jsonHelper = $jsonHelper;
|
||||||
$this->hlpCfg = $hlpCfg;
|
$this->hlpCfg = $hlpCfg;
|
||||||
|
@ -47,6 +51,7 @@ class Fcc
|
||||||
$result = null;
|
$result = null;
|
||||||
$url = str_replace('{{CURRENCY_FROM}}', $currencyFrom, self::CURRENCY_CONVERTER_URL);
|
$url = str_replace('{{CURRENCY_FROM}}', $currencyFrom, self::CURRENCY_CONVERTER_URL);
|
||||||
$url = str_replace('{{CURRENCY_TO}}', $currencyTo, $url);
|
$url = str_replace('{{CURRENCY_TO}}', $currencyTo, $url);
|
||||||
|
$this->logger->info("Currency rates request: $url");
|
||||||
$delay = $this->hlpCfg->getDelay();
|
$delay = $this->hlpCfg->getDelay();
|
||||||
$timeout = $this->hlpCfg->getTimeout();
|
$timeout = $this->hlpCfg->getTimeout();
|
||||||
try {
|
try {
|
||||||
|
@ -73,4 +78,4 @@ class Fcc
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue