class TestEnterpriseExchanger in Commerce Exchanger 8
Provides the enterprise exchange rates.
Plugin annotation
@CommerceExchangerProvider(
id = "enterprise",
label = "Enterprise",
display_label = "Enterprise",
historical_rates = TRUE,
enterprise = TRUE,
api_key= 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\TestEnterpriseExchanger
- 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 TestEnterpriseExchanger
File
- tests/
modules/ commerce_exchanger_test/ src/ Plugin/ Commerce/ ExchangerProvider/ TestEnterpriseExchanger.php, line 19
Namespace
Drupal\commerce_exchanger_test\Plugin\Commerce\ExchangerProviderView source
class TestEnterpriseExchanger extends ExchangerProviderRemoteBase {
/**
* {@inheritdoc}
*/
public function apiUrl() {
return 'http://example.enterprise';
}
/**
* {@inheritdoc}
*/
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];
}
}
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. | |
TestEnterpriseExchanger:: |
public | function |
URL from remote provider upon API call should be made. Overrides ExchangerProviderRemoteInterface:: |
|
TestEnterpriseExchanger:: |
public | function |
Fetch external data. Overrides ExchangerProviderRemoteInterface:: |