By xano on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
7.x-2.x
Description:
Currency exchange rates are now completely pluggable. Instead of using currency_api_convert(), you should now use CurrencyExchanger::load(). All exchange rates are now numeric strings. Use PHP's BCMath extension to perform calculations on those strings. Examples:
// 7.x-1.x.
$exchange_rate = currency_api_convert('EUR', 'UAH');
// 7.x-2.x.
$exchange_rate = CurrencyExchanger::load('EUR', 'UAH');
// 7.x-1.x.
$amount_from = 9.95;
$amount_to = currency_api_convert('EUR', 'UAH', $amount_from);
// 7.x-2.x.
$amount_from = '9.95';
$exchange_rate = CurrencyExchanger::load('EUR', 'UAH');
$amount_to = bcmul($exchange_rate, $amount_from);
Impacts:
Module developers