/** * Delete shipment * * @param Dhl_Intraship_Model_Shipment $shipment * @return Dhl_Intraship_Model_Soap_Client_Response */ public function delete(Dhl_Intraship_Model_Shipment $shipment) { // Set request parameters. $params = $this->_cli->getDefaultParams(); $params += array('ShipmentNumber' => array('shipmentNumber' => $shipment->getShipmentNumber())); // Get response message. $response = $this->_cli->DeleteShipmentDD($params); return $response->DeletionState; }
/** * Recover a document. * * @param Dhl_Intraship_Model_Shipment_Document $document * @param Dhl_Intraship_Model_Shipment $shipment * @return Dhl_Intraship_Helper_Pdf $this */ public function recoverDocument(Dhl_Intraship_Model_Shipment_Document $document, Dhl_Intraship_Model_Shipment $shipment) { try { if (file_exists($document->getFilePath())) { return $this; } /* @var $helper Dhl_Intraship_Helper_Pdf_Document */ $helper = Mage::helper('intraship/pdf_document'); $helper->setPdfName($helper->getFileNameLabel($shipment->getShipmentNumber()))->setPdfContent(file_get_contents($document->getDocumentUrl()))->savePdf(); /* * Workaround - sometimes the given path to the pdf is not identic with the generated one * In this case, save the new generated path to the document */ if ($document->getFilePath() != $helper->getPathToPdf()) { $document->setFilePath($helper->getPathToPdf()); $document->save(); } } catch (Exception $e) { Mage::log($e->getMessage()); throw new Dhl_Intraship_Helper_Pdf_Exception('pdf creation failed. service temporary not available. ' . $e->getMessage(), $e->getCode()); } return $this; }