Load currency from session.

@return CurrencyInterface|null Currency

@throws CurrencyNotAvailableException No currency available
511726
private function loadCurrencyFromSession()
    {
        $currencyIdInSession = $this
            ->currencySessionManager
            ->get();

        return $currencyIdInSession
            ? $this->currency = $this
                ->currencyRepository
                ->find($currencyIdInSession)
            : null;
    }
350577
public static function defaultCurrency($currency = null)
    {
        if (!empty($currency)) {
            return self::$_defaultCurrency = $currency;
        }

        if ($currency === false) {
            return self::$_defaultCurrency = null;
        }

        if (empty(self::$_defaultCurrency)) {
            $locale = ini_get('intl.default_locale') ?: static::DEFAULT_LOCALE;
            $formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
            self::$_defaultCurrency = $formatter->getTextAttribute(NumberFormatter::CURRENCY_CODE);
        }

        return self::$_defaultCurrency;
    }
926270
public function getCurrency($lang = null)
    {
        if (!is_null($lang)) {
            $original_lang = $this->getLanguage();
            $this->setLanguage($lang);
        }
        $formatter = new NumberFormatter($this->getLocale(), NumberFormatter::CURRENCY);
        $currency = $formatter->getTextAttribute(NumberFormatter::CURRENCY_CODE);
        if (!empty($original_lang)) {
            $this->setLanguage($original_lang);
        }
        return $currency;
    }
555515
public function populate()
    {
        $currenciesCodes = [];
        $currencies = $this
            ->currencyRepository
            ->findAll();

        /**
         * Create an array of all active currency codes.
         *
         * @var CurrencyInterface $currency
         */
        foreach ($currencies as $currency) {
            if ($currency->getIso() != $this->defaultCurrency) {
                $currenciesCodes[] = $currency->getIso();
            }
        }

        /**
         * Get rates for all of the enabled and active currencies.
         */
        $rates = $this
            ->currencyExchangeRatesAdapter
            ->getExchangeRates(
                $this->defaultCurrency,
                $currenciesCodes
            );

        /**
         * @var CurrencyInterface $sourceCurrency
         */
        $sourceCurrency = $this
            ->currencyRepository
            ->findOneBy([
                'iso' => $this->defaultCurrency,
            ]);

        /**
         * [
         *      "EUR" => "1,378278",
         *      "YEN" => "0,784937",
         * ].
         */
        foreach ($rates as $code => $rate) {

            /**
             * @var CurrencyInterface $targetCurrency
             */
            $targetCurrency = $this
                ->currencyRepository
                ->findOneBy([
                    'iso' => $code,
                ]);

            if (!($targetCurrency instanceof CurrencyInterface)) {
                continue;
            }

            /**
             * check if this is a new exchange rate, or if we have to
             * create a new one.
             */
            $exchangeRate = $this
                ->currencyExchangeRateObjectDirector
                ->findOneBy([
                    'sourceCurrency' => $sourceCurrency,
                    'targetCurrency' => $targetCurrency,
                ]);

            if (!($exchangeRate instanceof CurrencyExchangeRateInterface)) {
                $exchangeRate = $this
                    ->currencyExchangeRateObjectDirector
                    ->create();
            }

            $exchangeRate
                ->setExchangeRate($rate)
                ->setSourceCurrency($sourceCurrency)
                ->setTargetCurrency($targetCurrency);

            $this
                ->currencyExchangeRateObjectDirector
                ->save($exchangeRate);
        }

        return $this;
    }
1277464
protected function getCurrencyByCode(string $isoCode): CurrencyTransfer
    {
        if (!isset($this->currenciesHeap[$isoCode])) {
            try {
                $currencyTransfer = $this->currencyFacade->fromIsoCode($isoCode);

                $this->currenciesHeap[$isoCode] = $currencyTransfer;
            } catch (Throwable $throwable) {
                throw new EntityNotFoundException(sprintf('Currency not found: %s', $isoCode));
            }
        }

        return $this->currenciesHeap[$isoCode];
    }
521586
protected function validateCurrency()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->currency->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Currency'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
381739
private function setUserCurrency($currency, $request)
    {
        $currency = strtoupper($currency);

        // Set user selection globally
        currency()->setUserCurrency($currency);

        // Save it for later too!
        $request->getSession()->put(['currency' => $currency]);

        return $currency;
    }
77563
public static function getCurrencySymbol($currency) {
    return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["symbol"] : null;
  }
1199243
public function getOrderCurrency()
    {
        if ($this->_oOrderCurrency === null) {
            // setting default in case unrecognized currency was set during order
            $aCurrencies = \OxidEsales\Eshop\Core\Registry::getConfig()->getCurrencyArray();
            $this->_oOrderCurrency = current($aCurrencies);

            foreach ($aCurrencies as $oCurr) {
                if ($oCurr->name == $this->oxorder__oxcurrency->value) {
                    $this->_oOrderCurrency = $oCurr;
                    break;
                }
            }
        }

        return $this->_oOrderCurrency;
    }
1072616
public static CurrencyUnit getCurrency(CurrencyQuery query) {
        return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
                () -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
                .getCurrency(query);
    }
1179969
public function setCurrency($currency)
    {
        if ($currency) {
            $currency = strtoupper($currency);
            Currency::getNumericCode($currency); // ensure currency support
            $this->currency = $currency;
        } else {
            $this->currency = null;
        }

        return $this;
    }
935880
public static function parse($money, $forceCurrency = null, $locale = null, Currencies $currencies = null)
    {
        return self::parseByIntl($money, $forceCurrency, $locale, $currencies);
    }
1041674
public function update()
    {
        $this->helper->progress('--- Currencies');

        $this->helper->eraseDataDir($dataDir = '/currencies/default');

        $currencies = $this->helper->loadJsonFiles($directory = $this->helper->dataDir('third-party/world-currencies/package/src'));

        if ($currencies->isEmpty()) {
            throw new Exception("No currencies found in {$directory}");
        }

        $currencies = $currencies->mapWithKeys(function ($currency) {
            return $currency;
        });

        $this->helper->message('Processing currencies...');

        $normalizerClosure = function ($item) {
            $item = $this->updater->addDataSource($item, 'world-currencies');

            $item = $this->updater->addRecordType($item, 'currency');

            return [$item];
        };

        $getCodeClosure = function () {
        };

        $generateTaxData = function ($tax) {
            return $tax;
        };

        $currencies = $this->updater->generateJsonFiles($currencies, $dataDir, $normalizerClosure, $getCodeClosure, $generateTaxData, null);

        $this->helper->progress('Generated '.count($currencies).' currencies.');
    }
124268
public function getBasketCurrency()
    {
        $oCurrency = $this->_getContainer()->getSession()->getBasket()->getBasketCurrency();

        return $oCurrency !== null ? $oCurrency->name : '';
    }
366041
public function create()
    {
        /**
         * @var Currency $currency
         */
        $classNamespace = $this->getEntityNamespace();
        $currency = new $classNamespace();
        $currency
            ->setEnabled(true)
            ->setCreatedAt($this->now());

        return $currency;
    }
1352946
public function getCurrency( $iso_code ) {

		$currencies = $this->all();
		if ( isset( $currencies[ $iso_code ] ) ) {
			return $currencies[ $iso_code ];
		}

		return null;
	}
928590
public function getCurrency()
    {
        // @todo
        $result = array (
            Meta::Currency => $this->source->currency_code,
            Meta::CurrencyRate => (float) $this->source->conversion_rate,
            Meta::CurrencyDoConvert => true,
        );
        return $result;
    }