/**
     * @service pay_affiliate read
     */
    public function exportMassPayFile(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        $payoutOption = new Pap_Db_PayoutOption();
        $payoutOption->setID($form->getFieldValue('payoutOptionId'));
        $payoutOption->load();
        
        $this->generateExportFile($payoutOption);
        
        $download = new Gpf_File_Download_String($payoutOption->getExportFileName(),
                                                 $this->generateExportFile($payoutOption, $form->getFieldValue('affiliateNote')));
        $download->setAttachment(true);
        return $download;
    }
 public function generateFile() {
     $this->buildData();
     $file = new Gpf_File_Download_String($this->fileName, $this->buffer);
     $file->setAttachment(true);
     return $file;
 }
 private function createDownloadFile($fileName, $urlToProtect) {
 	$download = new Gpf_File_Download_String($fileName, $urlToProtect);
 	$download->setAttachment(true);
 	return $download;
 }