Updates the commerce currency in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

@param commerceCurrency the commerce currency
@return the commerce currency that was updated
421345
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommerceCurrency updateCommerceCurrency(
		CommerceCurrency commerceCurrency) {
		return commerceCurrencyPersistence.update(commerceCurrency);
	}
542308
protected function updateCurrency()
    {
        $this->controlAccess('currency_edit');

        if ($this->currency->update($this->data_currency['code'], $this->getSubmitted())) {
            $this->redirect('admin/settings/currency', $this->text('Currency has been updated'), 'success');
        }

        $this->redirect('', $this->text('Currency has not been updated'), 'warning');
    }
1250490
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommercePriceEntry updateCommercePriceEntry(
		CommercePriceEntry commercePriceEntry) {
		return commercePriceEntryPersistence.update(commercePriceEntry);
	}
308223
public CreateAlipayChargeParams currency(final Currency currency) {
        return this.with("currency", currency == null ? Currency.MXN.name() : currency.name());
    }
390562
private static Currency createCurrency(
      String commonCode, String name, String unicode, String... alternativeCodes) {

    CurrencyAttributes attributes =
        new CurrencyAttributes(commonCode, name, unicode, alternativeCodes);

    Currency currency = new Currency(commonCode, attributes);

    for (String code : attributes.codes) {
      if (commonCode.equals(code)) {
        // common code will always be part of the currencies map

        currencies.put(code, currency);

      } else if (!currencies.containsKey(code)) {
        // alternative codes will never overwrite common codes

        currencies.put(code, new Currency(code, attributes));
      }
    }

    return currency;
  }
1092684
public static BitfinexCurrencyPair register(final String currency, 
			final String profitCurrency, final double minimalOrderSize) {

		final String key = buildCacheKey(currency, profitCurrency);

		final BitfinexCurrencyPair newCurrency = new BitfinexCurrencyPair(currency, profitCurrency, 
				minimalOrderSize);

		final BitfinexCurrencyPair oldCurrency = instances.putIfAbsent(key, newCurrency);

		// The currency was already registered
		if(oldCurrency != null) {
			throw new IllegalArgumentException("The currency " + key + " is already known");
		}

		return newCurrency;
	}
744683
@Override
	public void clearCache(CommerceCurrency commerceCurrency) {
		entityCache.removeResult(CommerceCurrencyModelImpl.ENTITY_CACHE_ENABLED,
			CommerceCurrencyImpl.class, commerceCurrency.getPrimaryKey());

		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

		clearUniqueFindersCache((CommerceCurrencyModelImpl)commerceCurrency,
			true);
	}
400187
@Override
	public com.liferay.commerce.currency.model.CommerceCurrency addCommerceCurrency(
		com.liferay.commerce.currency.model.CommerceCurrency commerceCurrency) {
		return _commerceCurrencyLocalService.addCommerceCurrency(commerceCurrency);
	}
653175
@Override
    public MonetaryAmountFactory<T> setCurrency(CurrencyUnit currency) {
        Objects.requireNonNull(currency);
        this.currency = currency;
        return this;
    }
936608
@Override
    public CurrencyAmount add(final CurrencyAmount money) {
        if (!money.getCurrency().equals(currency)) {
            throw new IllegalArgumentException("You cannot add " + money.getCurrency() + " with " + currency);
        }
        return new Cash(currency, BigDecimalUtil.add(amount, money.getAmount()));
    }
1117011
@Override
	public void cacheResult(CommerceCurrency commerceCurrency) {
		entityCache.putResult(CommerceCurrencyModelImpl.ENTITY_CACHE_ENABLED,
			CommerceCurrencyImpl.class, commerceCurrency.getPrimaryKey(),
			commerceCurrency);

		finderCache.putResult(FINDER_PATH_FETCH_BY_UUID_G,
			new Object[] {
				commerceCurrency.getUuid(), commerceCurrency.getGroupId()
			}, commerceCurrency);

		finderCache.putResult(FINDER_PATH_FETCH_BY_G_C,
			new Object[] {
				commerceCurrency.getGroupId(), commerceCurrency.getCode()
			}, commerceCurrency);

		commerceCurrency.resetOriginalValues();
	}
1215817
private function updateFromGoogle($defaultCurrency)
    {
        $this->info('Updating currency exchange rates from finance.google.com...');
        foreach ($this->currency->getDriver()->all() as $code => $value) {
            // Don't update the default currency, the value is always 1
            if ($code === $defaultCurrency) {
                continue;
            }

            $response = $this->request('http://finance.google.com/finance/converter?a=1&from=' . $defaultCurrency . '&to=' . $code);

            if (Str::contains($response, 'bld>')) {
                $data = explode('bld>', $response);
                $rate = explode($code, $data[1])[0];
                
                $this->currency->getDriver()->update($code, [
                    'exchange_rate' => $rate,
                ]);
            }
            else {
                $this->warn('Can\'t update rate for ' . $code);
                continue;
            }
        }
    }
1107103
@Override
    public ExchangeRate getExchangeRate(MonetaryAmount amount) {
        return this.rateProvider.getExchangeRate(ConversionQueryBuilder
                .of(conversionQuery).setBaseCurrency(amount.getCurrency())
                .build());
        // return this.rateProvider.getExchangeRate(amount.getCurrency(),
        // getCurrency());
    }
339672
private function createCurrency($currencyCode)
    {
        /** @var CurrencyInterface $currency */
        $currency = $this->currencyFactory->createNew();
        $currency->setCode($currencyCode);

        return $currency;
    }
528740
public function setTransactionCurrency($transactionCurrency)
    {
        if (!empty($transactionCurrency) && ctype_print($transactionCurrency)) {
            $this->transactionCurrency = trim($transactionCurrency);
        }

        return $this;
    }
1111401
@Override
	public void cacheResult(List<CommerceCurrency> commerceCurrencies) {
		for (CommerceCurrency commerceCurrency : commerceCurrencies) {
			if (entityCache.getResult(
						CommerceCurrencyModelImpl.ENTITY_CACHE_ENABLED,
						CommerceCurrencyImpl.class,
						commerceCurrency.getPrimaryKey()) == null) {
				cacheResult(commerceCurrency);
			}
			else {
				commerceCurrency.resetOriginalValues();
			}
		}
	}
620226
public static com.liferay.commerce.model.CommerceOrder updateCommerceOrder(
		com.liferay.commerce.model.CommerceOrder commerceOrder) {
		return getService().updateCommerceOrder(commerceOrder);
	}