class TestExchanger in Commerce Exchanger 8
Provides the test exchange rates.
Plugin annotation
@CommerceExchangerProvider(
id = "test",
label = "Test",
display_label = "Test",
historical_rates = TRUE,
base_currency = "HRK",
refresh_once = TRUE,
transform_rates = TRUE,
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\commerce_exchanger\Plugin\Commerce\ExchangerProvider\ExchangerProviderBase implements ExchangerProviderInterface, ContainerFactoryPluginInterface
- class \Drupal\commerce_exchanger\Plugin\Commerce\ExchangerProvider\ExchangerProviderRemoteBase implements ExchangerProviderRemoteInterface
- class \Drupal\commerce_exchanger_test\Plugin\Commerce\ExchangerProvider\TestExchanger
- class \Drupal\commerce_exchanger\Plugin\Commerce\ExchangerProvider\ExchangerProviderRemoteBase implements ExchangerProviderRemoteInterface
- class \Drupal\commerce_exchanger\Plugin\Commerce\ExchangerProvider\ExchangerProviderBase implements ExchangerProviderInterface, ContainerFactoryPluginInterface
Expanded class hierarchy of TestExchanger
File
- tests/
modules/ commerce_exchanger_test/ src/ Plugin/ Commerce/ ExchangerProvider/ TestExchanger.php, line 20
Namespace
Drupal\commerce_exchanger_test\Plugin\Commerce\ExchangerProviderView source
class TestExchanger extends ExchangerProviderRemoteBase {
/**
* {@inheritdoc}
*/
public function apiUrl() {
return 'http://example.test';
}
/**
* {@inheritdoc}
*/
public function getRemoteData($base_currency = NULL) {
return [
'EUR' => 0.13,
'USD' => 0.16,
'AUD' => 0.22,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExchangerProviderBase:: |
protected | property | Configuration management. | |
ExchangerProviderBase:: |
protected | property | Return formatted array of currencies ['HRK' => 'Croatian Kuna']. | |
ExchangerProviderBase:: |
protected | property | The currency storage. | |
ExchangerProviderBase:: |
private | property | Parent entity if present. | |
ExchangerProviderBase:: |
protected | property | The HTTP client to fetch the feed data with. | |
ExchangerProviderBase:: |
protected | property | The logger. | |
ExchangerProviderBase:: |
public | function |
Form constructor. Overrides PluginFormInterface:: |
|
ExchangerProviderBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
ExchangerProviderBase:: |
public | function | ||
ExchangerProviderBase:: |
public | function |
Return config object name where exchange rates are saved. Overrides ExchangerProviderInterface:: |
|
ExchangerProviderBase:: |
public | function | ||
ExchangerProviderBase:: |
protected | function | Simple key-value array for enabled currencies. | |
ExchangerProviderBase:: |
public | function | ||
ExchangerProviderBase:: |
public | function | ||
ExchangerProviderBase:: |
public | function |
Form submission handler. Overrides PluginFormInterface:: |
|
ExchangerProviderBase:: |
public | function | ||
ExchangerProviderBase:: |
public | function |
Form validation handler. Overrides PluginFormInterface:: |
|
ExchangerProviderBase:: |
public | function |
Constructs a new ExchangeProvider object. Overrides PluginBase:: |
|
ExchangerProviderRemoteBase:: |
public | function |
Generic wrapper around Drupal http client. Overrides ExchangerProviderRemoteInterface:: |
|
ExchangerProviderRemoteBase:: |
protected | function | Process all currencies for rates for other currencies. | |
ExchangerProviderRemoteBase:: |
protected | function | Rates calculation for currencies when we use cross sync conversion. | |
ExchangerProviderRemoteBase:: |
public | function |
Remote providers api key. Overrides ExchangerProviderRemoteInterface:: |
|
ExchangerProviderRemoteBase:: |
public | function |
Remote authentication credentials. Overrides ExchangerProviderRemoteInterface:: |
|
ExchangerProviderRemoteBase:: |
public | function |
Either remote provider defined base currency, or use entered. Overrides ExchangerProviderRemoteInterface:: |
|
ExchangerProviderRemoteBase:: |
public | function |
Method which supports remote provider. Overrides ExchangerProviderRemoteInterface:: |
|
ExchangerProviderRemoteBase:: |
public | function | ||
ExchangerProviderRemoteBase:: |
protected | function | Preform cross conversion between currencies to build exchange data rates. | |
ExchangerProviderRemoteBase:: |
protected | function | Fetch remote provider by each currency and create dataset. | |
ExchangerProviderRemoteBase:: |
public | function |
Determine if remote provider supports querying by different base currency. Overrides ExchangerProviderRemoteInterface:: |
|
ExchangerProviderRemoteBase:: |
protected | function | Helper function to create array for exchange rates. | |
ExchangerProviderRemoteBase:: |
protected | function | Process data with checking structure and preparing data for importing. | |
ExchangerProviderRemoteBase:: |
protected | function | Recalculate currencies from exchange rate between two other currencies. | |
ExchangerProviderRemoteBase:: |
public | function |
Determine if rates provided by provider needs to be transformed
in a required rate ratio based on base currency. Overrides ExchangerProviderRemoteInterface:: |
|
ExchangerProviderRemoteBase:: |
public | function |
Either remote provider defined or use defined choice. Overrides ExchangerProviderRemoteInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
TestExchanger:: |
public | function |
URL from remote provider upon API call should be made. Overrides ExchangerProviderRemoteInterface:: |
|
TestExchanger:: |
public | function |
Fetch external data. Overrides ExchangerProviderRemoteInterface:: |