setPricesCurrency

Sets the prices currency

@access        public
@param        $pricesCurrency string[3]
@return        true
978281
public function setPricesCurrency($pricesCurrency = 'RON')
    {
        $pricesCurrency = strtoupper(trim($pricesCurrency));
        switch ($pricesCurrency) {
            case 'ROL':
                $this->pricesCurrency = 'ROL';
                break;

            case 'EUR':
                $this->pricesCurrency = 'EUR';
                break;

            case 'USD':
                $this->pricesCurrency = 'USD';
                break;

            case 'GBP':
                $this->pricesCurrency = 'GBP';
                break;

            case 'BGN':
                $this->pricesCurrency = 'BGN';
                break;

            case 'RON':
            default:
                $this->pricesCurrency = 'RON';
        }

        return true;
    }
1119312
public RoundingContextBuilder setCurrency(CurrencyUnit currencyUnit) {
        Objects.requireNonNull(currencyUnit);
        return set(CurrencyUnit.class, currencyUnit);
    }
1184426
public function forCurrency($currency)
    {
        if (!isset($this->value[$currency])) {
            Yii::warning('Value for currency $currency was not found. Using fake free value. Most probably, tariff is free', __METHOD__);

            return new Value(['value' => 0, 'price' => 0]);
        }

        return $this->value[$currency];
    }
1275855
protected function convertValue(array $price_rule, $currency)
    {
        $amount = $this->price->amount(abs($price_rule['value']), $price_rule['currency']);
        $converted = $this->currency->convert($amount, $price_rule['currency'], $currency);
        return $price_rule['value'] < 0 ? -$converted : $converted;
    }
80708
public function setExchangeRate(string $sourceCurrencyCode, string $targetCurrencyCode, $exchangeRate) : self
    {
        $this->exchangeRates[$sourceCurrencyCode][$targetCurrencyCode] = $exchangeRate;

        return $this;
    }
527651
protected function updateCurrencyRates(Currency $currency)
    {
        $baseExchangeRate = $this->table[$currency->getCode()];

        foreach ($this->table as $currencySymbol => $exchangeRate) {
            $rate = $this->calculateExchangeRate($baseExchangeRate, $currencySymbol);
            $this->addUpdateExchangeRate($currency->getCode(), $currencySymbol, $rate);
        }

        $this->helper->getEntityManager()->flush();
    }
1079313
public function setCurrency($currency)
    {
        if ( ! in_array($currency, self::$supportedCurrencies)) {
            throw new CurrencyNotSupported(sprintf('Currency "%s" is not supported.', $currency));
        }
        $this->currency = $currency;
    }
836727
public function set(CurrencyInterface $currency)
    {
        $this
            ->session
            ->set(
                $this->sessionFieldName,
                $currency->getIso()
            );

        return $this;
    }
783218
private function hasPriceInDefaultCurrency($prices, $defaultCurrency)
    {
        foreach ($prices as $price) {
            if ($price->getCurrency()->getCode() === $defaultCurrency) {
                return true;
            }
        }

        return false;
    }
741964
public function formatPrice($price) {
    // Fetch the config.
    $config = $this->configFactory->get('acm.currency');

    // Get currency with the correct locale.
    $locale = \Drupal::languageManager()->getCurrentLanguage()->getId();
    $currency = \Drupal::service('repository.currency');
    $numberFormat = \Drupal::service('repository.number_format');
    $currencyFormatter = new CurrencyFormatter($numberFormat, $currency, ['locale' => $locale]);

    $currencyCode = $currency->get($config->get('currency_code'))->getCurrencyCode();

    return $currencyFormatter->format($price, $currencyCode);
  }
1268295
public function setCurrency(string $currency): self
    {
        $this->isValidCurrency($currency);

        $this->currency = $currency;

        return $this;
    }
1370024
public function setPrice($price)
    {
        if (is_string($price)) {
            $this->checkPriceFormat($price);
        }

        $this->price = (float)$price;

        return $this;
    }
138255
public function setCurrencyId( $currencyid )
	{
		if ( $currencyid == $this->getCurrencyId() ) { return; }

		$this->_checkCurrencyId( $currencyid, false );
		$this->_values['currencyid'] = $currencyid;
		$this->setModified();
	}
84528
public function filterByCurrency($currency)
    {
        $filteredArr = array();
        foreach ($this->_paymentMethodsArrayFiltered as $paymentMethod) {
            $continue = true;
            foreach ($paymentMethod["Issuers"] as $issuer) {
                foreach ($issuer["Countries"] as $country) {
                    if (in_array(strtoupper($currency), $country["Currencies"])) {
                        array_push($filteredArr, $paymentMethod); //return//return
                        $continue = false;
                    }
                    if (!$continue)
                        break;
                }
                if (!$continue)
                    break;
            }
        }
        $this->_paymentMethodsArrayFiltered = $filteredArr;
        return $this;
    }
548252
public function isValidShopProduct($defaultCurrency)
    {
        $isValid = false;

        if (method_exists($this, 'getPrices') &&
            $this->getStatus()->getId() == Status::ACTIVE &&
            $this->getPrices() &&
            count($this->getPrices()) > 0 &&
            $this->hasPriceInDefaultCurrency($this->getPrices(), $defaultCurrency) &&
            $this->getSupplier()
        ) {
            $isValid = true;
        }

        return $isValid;
    }
119857
function checkCurrency( $currency )
    {
        //get the order currency
        $productCollection = $this->order->productCollection();
        $orderCurrency = $productCollection->attribute( 'currency_code' );

        if ( $orderCurrency == $currency )
        {
            return true;
        }

        $this->logger->writeTimedString( "Order currency ($orderCurrency) and received currency ($currency).", 'checkCurrency failed' );
        return false;
    }
1305616
public function setTotalPrice(Money $totalPrice = null)
    {
        $this->totalPrice = $totalPrice ? $totalPrice->getAmount() : $totalPrice;

        return $this;
    }