Payment/EventListener/AbstractPaymentListener.php
protected function updateExchangeRate(PaymentInterface $payment)
    {
        if (null !== $payment->getExchangeRate()) {
            return false;
        }

        $date = new \DateTime();

        $rate = $this->currencyConverter->getRate(
            $this->currencyConverter->getDefaultCurrency(),
            $payment->getCurrency()->getCode(),
            $date
        );

        $payment
            ->setExchangeRate($rate)
            ->setExchangeDate($date);

        return true;
    }
protected function updateExchangeRate(PaymentInterface $payment)
    {
        if (null !== $payment->getExchangeRate()) {
            return false;
        }

        $date = new \DateTime();

        $rate = $this->currencyConverter->getRate(
            $this->currencyConverter->getDefaultCurrency(),
            $payment->getCurrency()->getCode(),
            $date
        );

        $payment
            ->setExchangeRate($rate)
            ->setExchangeDate($date);

        return true;
    }
Updates the payment exchange rate.

@param PaymentInterface $payment

@return bool Whether the payment has been changed or not.