You are here

protected function FedEx::adjustPackage in Commerce FedEx 8

Query plugins for package adjustments.

Parameters

\NicholasCreativeMedia\FedExPHP\Structs\RequestedPackageLineItem $requested_package_line_item: Te package line item to be adjusted.

array $shipment_items: The shipment items in the package.

\Drupal\commerce_shipping\Entity\ShipmentInterface $shipment: The full shipment.

Return value

\NicholasCreativeMedia\FedExPHP\Structs\RequestedPackageLineItem The adjusted line item.

2 calls to FedEx::adjustPackage()
FedEx::getRequestedPackageLineItemsAllInOne in src/Plugin/Commerce/ShippingMethod/FedEx.php
Gets package line items for PACKAGE_ALL_IN_ONE strategy.
FedEx::getRequestedPackageLineItemsIndividual in src/Plugin/Commerce/ShippingMethod/FedEx.php
Gets package line items for PACKAGE_INDIVIDUAL strategy.

File

src/Plugin/Commerce/ShippingMethod/FedEx.php, line 870

Class

FedEx
Provides the FedEx shipping method.

Namespace

Drupal\commerce_fedex\Plugin\Commerce\ShippingMethod

Code

protected function adjustPackage(RequestedPackageLineItem $requested_package_line_item, array $shipment_items, ShipmentInterface $shipment) {
  foreach ($this->fedExServiceManager
    ->getDefinitions() as $plugin_id => $definition) {

    /** @var \Drupal\commerce_fedex\Plugin\Commerce\FedEx\FedExPluginInterface $plugin */
    $plugin = $this->plugins
      ->get($plugin_id);
    $requested_package_line_item = $plugin
      ->adjustPackage($requested_package_line_item, $shipment_items, $shipment);
  }
  return $requested_package_line_item;
}