protected function updateExchangeRate(SaleInterface $sale)
    {
        if (null !== $sale->getExchangeRate()) {
            return false;
        }

        $date = $sale->getExchangeDate() ?? new \DateTime();

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

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

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

        $date = $sale->getExchangeDate() ?? new \DateTime();

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

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

        return true;
    }
protected function updateExchangeRate ( SaleInterface $ sale ) { if ( null !== $ sale -> getExchangeRate ( ) ) { return false ; } $ date = $ sale -> getExchangeDate ( ) ?? new \ DateTime ( ) ; $ rate = $ this -> currencyConverter -> getRate ( $ this -> currencyConverter -> getDefaultCurrency ( ) , $ sale -> getCurrency ( ) -> getCode ( ) , $ date ) ; $ sale -> setExchangeRate ( $ rate ) -> setExchangeDate ( $ date ) ; return true ; }
Sets the sale's exchange rate.

@param SaleInterface $sale

@return bool
Sets the sale s exchange rate .