/** * Send mail notification to customer that his products return has been rejected * * @param \XLite\Module\XC\CanadaPost\Model\ProductsReturn $return Canada Post products return model * * @return void */ public static function sendProductsReturnRejected(\XLite\Module\XC\CanadaPost\Model\ProductsReturn $return) { if ($return->getOrder() && $return->getOrder()->getProfile()) { static::register(array('productsReturn' => $return, 'notes' => nl2br($return->getAdminNotes(), false))); static::compose(static::TYPE_PRODUCTS_RETURN_REJECTED, static::getOrdersDepartmentMail(), $return->getOrder()->getProfile()->getLogin(), 'modules/XC/CanadaPost/return_rejected', array(), true, \XLite::CUSTOMER_INTERFACE, static::getMailer()->getLanguageCode(\XLite::CUSTOMER_INTERFACE, $return->getOrder()->getProfile()->getLanguage())); } }
/** * Call "Create Authorized Return" request by the ProductsReturn model * * @param \XLite\Module\XC\CanadaPost\Model\ProductsReturn $return Canada Post return model * * @return \XLite\Core\CommonCell */ public function callCreateAuthorizedReturnByProductsReturn(\XLite\Module\XC\CanadaPost\Model\ProductsReturn $return) { $xmlHeader = '<' . '?xml version="1.0" encoding="utf-8"?' . '>'; // Convert weight into KG $itemsWeight = \XLite\Core\Converter::convertWeightUnits($return->getItemsTotalWeight(), \XLite\Core\Config::getInstance()->Units->weight_unit, 'kg'); $itemsWeight = static::adjustFloatValue($itemsWeight, 3, 0.1, 999.999); $requestData = <<<XML {$xmlHeader} <authorized-return xmlns="http://www.canadapost.ca/ws/authreturn-v2"> <service-code>{$return->getOrder()->getCapostShippingMethodCode()}</service-code> {$this->getXmlBlockReturnerAddress($return->getOrder()->getProfile())} {$this->getXmlBlockReceiverAddress()} <parcel-characteristics> <weight>{$itemsWeight}</weight> </parcel-characteristics> <print-preferences> <output-format>8.5x11</output-format> <encoding>PDF</encoding> </print-preferences> <settlement-info></settlement-info> </authorized-return> XML; return $this->callCreateAuthorizedReturn($requestData); }
/** * {@inheritDoc} */ public function getOrder() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getOrder', array()); return parent::getOrder(); }
/** * Preprocess "id" feild * * @param integer $id Canada Post return ID * @param array $column Column data * @param \XLite\Module\XC\CanadaPost\Model\ProductsReturn $entity Canada Post return model * * @return string */ protected function preprocessOrderNumber($id, array $column, \XLite\Module\XC\CanadaPost\Model\ProductsReturn $entity) { return $entity->getOrder()->getPrintableOrderNumber(); }