You are here

public function UPS::__construct in Commerce UPS 8.3

Constructs a new UPS object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\commerce_shipping\PackageTypeManagerInterface $package_type_manager: The package type manager.

\Drupal\state_machine\WorkflowManagerInterface $workflow_manager: The workflow manager.

\Drupal\commerce_ups\UPSRateRequestInterface $ups_rate_request: The rate request service.

Overrides ShippingMethodBase::__construct

File

src/Plugin/Commerce/ShippingMethod/UPS.php, line 63

Class

UPS
Provides the UPS shipping method.

Namespace

Drupal\commerce_ups\Plugin\Commerce\ShippingMethod

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, PackageTypeManagerInterface $package_type_manager, WorkflowManagerInterface $workflow_manager, UPSRateRequestInterface $ups_rate_request) {

  // Rewrite the service keys to be integers.
  $plugin_definition = $this
    ->preparePluginDefinition($plugin_definition);
  parent::__construct($configuration, $plugin_id, $plugin_definition, $package_type_manager, $workflow_manager);
  $this->upsRateService = $ups_rate_request;
  $this->upsRateService
    ->setConfig($configuration);
}