You are here

protected function UPSShipment::setPackage in Commerce UPS 8.3

Sets the package for a given shipment.

Parameters

\Ups\Entity\Shipment $api_shipment: A Ups API shipment object.

1 call to UPSShipment::setPackage()
UPSShipment::getShipment in src/UPSShipment.php
Creates and returns a UPS API shipment object.

File

src/UPSShipment.php, line 116

Class

UPSShipment
Class to create and return a UPS API shipment object.

Namespace

Drupal\commerce_ups

Code

protected function setPackage(APIShipment $api_shipment) {
  $package = new UPSPackage();
  $this
    ->setDimensions($package);
  $this
    ->setWeight($package);
  $this
    ->setPackagingType($package);
  $api_shipment
    ->addPackage($package);
}