/** * download SEPA mandate PDF file on success page * * @return mixed */ public function downloadMandateAction() { if (!Shopware()->Session()->moptMandateDataDownload) { $this->forward('downloadError'); return; } $params = $this->moptPayoneMain->getParamBuilder()->buildGetFile($this->getPaymentId(), Shopware()->Session()->moptMandateDataDownload); $service = $this->payoneServiceBuilder->buildServiceManagementGetFile(); $request = new Payone_Api_Request_GetFile($params); try { $response = $service->getFile($request); $this->Front()->Plugins()->ViewRenderer()->setNoRender(); $httpResponse = $this->Response(); $httpResponse->setHeader('Cache-Control', 'public'); $httpResponse->setHeader('Content-Description', 'File Transfer'); $httpResponse->setHeader('Content-disposition', 'attachment; filename=' . "Payone_Mandate.pdf"); $httpResponse->setHeader('Content-Type', 'application/pdf'); $httpResponse->setHeader('Content-Transfer-Encoding', 'binary'); $httpResponse->setHeader('Content-Length', strlen($response->getRawResponse())); echo $response->getRawResponse(); } catch (Exception $exc) { $this->forward('downloadError'); } }