src/Shipment.php
public function getShipments(
        $from = '',
        $to = '',
        $tracking_pin = '',
        array $options = []
    ) {
        if (!isset($from) && !isset($tracking_pin)) {
            $message = 'You must include either a $from date or a $tracking_pin.';
            throw new \InvalidArgumentException($message);
        }
        if (empty($to)) {
            $to = date('YmdHs');
        }
        $this->verifyDates($from, $to);
        $query_params = "from={$from}&to{$to}";

        if (!empty($tracking_pin)) {
            $query_params = "trackingPIN={$tracking_pin}";
        }

        $response = $this->get(
            "rs/{$this->config['customer_number']}/{$this->config['customer_number']}/shipment?" . $query_params,
            ['Accept' => 'application/vnd.cpc.shipment-v8+xml'],
            $options
        );
        return $response;
    }
public function getShipments(
        $from = '',
        $to = '',
        $tracking_pin = '',
        array $options = []
    ) {
        if (!isset($from) && !isset($tracking_pin)) {
            $message = 'You must include either a $from date or a $tracking_pin.';
            throw new \InvalidArgumentException($message);
        }
        if (empty($to)) {
            $to = date('YmdHs');
        }
        $this->verifyDates($from, $to);
        $query_params = "from={$from}&to{$to}";

        if (!empty($tracking_pin)) {
            $query_params = "trackingPIN={$tracking_pin}";
        }

        $response = $this->get(
            "rs/{$this->config['customer_number']}/{$this->config['customer_number']}/shipment?" . $query_params,
            ['Accept' => 'application/vnd.cpc.shipment-v8+xml'],
            $options
        );
        return $response;
    }
public function getShipments ( $ from = '' , $ to = '' , $ tracking_pin = '' , array $ options = [ ] ) { if ( ! isset ( $ from ) && ! isset ( $ tracking_pin ) ) { $ message = 'You must include either a $from date or a $tracking_pin.' ; throw new \ InvalidArgumentException ( $ message ) ; } if ( empty ( $ to ) ) { $ to = date ( 'YmdHs' ) ; } $ this -> verifyDates ( $ from , $ to ) ; $ query_params = "from={$from}&to{$to}" ; if ( ! empty ( $ tracking_pin ) ) { $ query_params = "trackingPIN={$tracking_pin}" ; } $ response = $ this -> get ( "rs/{$this->config['customer_number']}/{$this->config['customer_number']}/shipment?" . $ query_params , [ 'Accept' => 'application/vnd.cpc.shipment-v8+xml' ] , $ options ) ; return $ response ; }
Get Shipments from Canada Post within the specified range.

@param string $from
The beginning range. YmdHs format, eg. 201808282359.
@param string $to
The end range, defaults to current time. YmdHs format, eg. 201808282359.
@param string $tracking_pin
The Tracking PIN of the shipment to retrieve.
@param array $options
The options array.

@see https://www.canadapost.ca/cpo/mc/business/productsservices/developers/services/shippingmanifest/shipments.jsf
@return \DOMDocument|\Psr\Http\Message\StreamInterface
@throws \GuzzleHttp\Exception\GuzzleException
Get Shipments from Canada Post within the specified range .