private function initializeRelayPoint(ShipmentInterface $shipment)
    {
        // Abort if shipment method is not defined
        if (null === $method = $shipment->getMethod()) {
            // Clear the relay point if it is set
            if (null !== $shipment->getRelayPoint()) {
                $shipment->setRelayPoint(null);
            }

            return;
        }

        $gateway = $this->registry->getGateway($method->getGatewayName());

        // If gateway does not support relay point
        if (!$gateway->supports(GatewayInterface::CAPABILITY_RELAY)) {
            // Clear the relay point if it is set
            if (null !== $shipment->getRelayPoint()) {
                $shipment->setRelayPoint(null);
            }

            return;
        }

        // Set default relay point
        if (null !== $relayPoint = $shipment->getSale()->getRelayPoint()) {
            $shipment->setRelayPoint($relayPoint);
        }
    }
private function initializeRelayPoint(ShipmentInterface $shipment)
    {
        // Abort if shipment method is not defined
        if (null === $method = $shipment->getMethod()) {
            // Clear the relay point if it is set
            if (null !== $shipment->getRelayPoint()) {
                $shipment->setRelayPoint(null);
            }

            return;
        }

        $gateway = $this->registry->getGateway($method->getGatewayName());

        // If gateway does not support relay point
        if (!$gateway->supports(GatewayInterface::CAPABILITY_RELAY)) {
            // Clear the relay point if it is set
            if (null !== $shipment->getRelayPoint()) {
                $shipment->setRelayPoint(null);
            }

            return;
        }

        // Set default relay point
        if (null !== $relayPoint = $shipment->getSale()->getRelayPoint()) {
            $shipment->setRelayPoint($relayPoint);
        }
    }
private function initializeRelayPoint ( ShipmentInterface $ shipment ) { // Abort if shipment method is not defined if ( null === $ method = $ shipment -> getMethod ( ) ) { // Clear the relay point if it is set if ( null !== $ shipment -> getRelayPoint ( ) ) { $ shipment -> setRelayPoint ( null ) ; } return ; } $ gateway = $ this -> registry -> getGateway ( $ method -> getGatewayName ( ) ) ; // If gateway does not support relay point if ( ! $ gateway -> supports ( GatewayInterface :: CAPABILITY_RELAY ) ) { // Clear the relay point if it is set if ( null !== $ shipment -> getRelayPoint ( ) ) { $ shipment -> setRelayPoint ( null ) ; } return ; } // Set default relay point if ( null !== $ relayPoint = $ shipment -> getSale ( ) -> getRelayPoint ( ) ) { $ shipment -> setRelayPoint ( $ relayPoint ) ; } }
Initializes the shipment's relay point.

@param ShipmentInterface $shipment
Initializes the shipment s relay point .