public function TestEnterpriseExchanger::getRemoteData in Commerce Exchanger 8
Fetch external data.
Parameters
string|null $base_currency: If we fetch data based on specific currency.
Overrides ExchangerProviderRemoteInterface::getRemoteData
File
- tests/
modules/ commerce_exchanger_test/ src/ Plugin/ Commerce/ ExchangerProvider/ TestEnterpriseExchanger.php, line 31
Class
- TestEnterpriseExchanger
- Provides the enterprise exchange rates.
Namespace
Drupal\commerce_exchanger_test\Plugin\Commerce\ExchangerProviderCode
public function getRemoteData($base_currency = NULL) {
$data = [
'HRK' => [
'EUR' => 0.13,
'USD' => 0.16,
'AUD' => 0.22,
],
'EUR' => [
'AUD' => 1.66,
'HRK' => 7.58,
'USD' => 1.19,
],
'USD' => [
'AUD' => 1.4,
'HRK' => 6.39,
'EUR' => 0.84,
],
'AUD' => [
'EUR' => 0.6,
'HRK' => 4.56,
'USD' => 0.71,
],
];
return $data[$base_currency];
}