/** * Check - is notification "On shipment" enabled or not * * @param \XLite\Module\XC\CanadaPost\Model\Order\Parcel $parcel Canada Post parcel model * * @return boolean */ public function isNotifyOnShipment(\XLite\Module\XC\CanadaPost\Model\Order\Parcel $parcel) { return $parcel->isDeliveryToPostOffice() || $parcel->getNotifyOnShipment(); }
/** * Get "notification" XML block * Common for "Create Non-Contract Shipment" and "Create Shipment" calls * * @param \XLite\Module\XC\CanadaPost\Model\Order\Parcel $parcel Canada Post parcel model * * @return string */ protected function getNotificationCommonXmlBlockByParcel(\XLite\Module\XC\CanadaPost\Model\Order\Parcel $parcel) { $notifications = array(); foreach (array('shipment', 'exception', 'delivery') as $v) { $notifications[$v] = $parcel->{'getNotifyOn' . \XLite\Core\Converter::convertToCamelCase($v)}() ? 'true' : 'false'; } if ($parcel->isDeliveryToPostOffice()) { // Notification "on shipment" is mandatory when parcel should be delivered to a Canada Post post office $notifications['shipment'] = 'true'; } $xmlData = <<<XML <notification> <email>{$parcel->getOrder()->getProfile()->getLogin()}</email> <on-shipment>{$notifications['shipment']}</on-shipment> <on-exception>{$notifications['exception']}</on-exception> <on-delivery>{$notifications['delivery']}</on-delivery> </notification> XML; return $xmlData; }
/** * {@inheritDoc} */ public function isDeliveryToPostOffice() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'isDeliveryToPostOffice', array()); return parent::isDeliveryToPostOffice(); }